[interchange/gateway_log: 7/9] Field modifications for gateway log
Mark Johnson <[email protected]> Thu, 23 Nov 2017 00:10:49 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit bca7d6b8b607b0b08df131688b0f854ea139629b Author: Mark Johnson <[email protected]> Date: Wed Nov 22 19:07:21 2017 -0500 Field modifications for gateway log * Remove order_md5 * Add amount, host_ip, username * Create cart_md5 that hashes $Vend::Items if it has any items. Otherwise, left blank. dist/strap/dbconf/mysql/gateway_log.mysql | 2 -- dist/strap/dbconf/sqlite/gateway_log.lite | 2 -- dist/strap/products/gateway_log.txt | 2 +- lib/Vend/Payment/AuthorizeNet.pm | 23 ++++++++++++----------- lib/Vend/Payment/Braintree.pm | 23 ++++++++++++----------- lib/Vend/Payment/CyberSource.pm | 23 ++++++++++++----------- lib/Vend/Payment/PayflowPro.pm | 21 +++++++++++---------- lib/Vend/Payment/PaypalExpress.pm | 23 ++++++++++++----------- 8 files changed, 60 insertions(+), 59 deletions(-) --- diff --git a/dist/strap/dbconf/mysql/gateway_log.mysql b/dist/strap/dbconf/mysql/gateway_log.mysql index e08f7e5..0f351b9 100644 --- a/dist/strap/dbconf/mysql/gateway_log.mysql +++ b/dist/strap/dbconf/mysql/gateway_log.mysql @@ -3,7 +3,6 @@ Database gateway_log gateway_log.txt __SQLDSN__ Database gateway_log DEFAULT_TYPE text not null default '' Database gateway_log AUTO_SEQUENCE 1 Database gateway_log KEY gateway_log_id -Database gateway_log COLUMN_DEF "order_md5=varchar(32) not null default ''" Database gateway_log COLUMN_DEF "request_date=varchar(32) not null default ''" Database gateway_log COLUMN_DEF "request_id=varchar(255) not null default ''" Database gateway_log COLUMN_DEF "order_number=varchar(32) not null default ''" @@ -12,5 +11,4 @@ Database gateway_log INDEX request_date Database gateway_log INDEX request_id Database gateway_log INDEX order_number Database gateway_log INDEX email -Database gateway_log INDEX order_md5 Database gateway_log NO_ASCII_INDEX 1 diff --git a/dist/strap/dbconf/sqlite/gateway_log.lite b/dist/strap/dbconf/sqlite/gateway_log.lite index e08f7e5..0f351b9 100644 --- a/dist/strap/dbconf/sqlite/gateway_log.lite +++ b/dist/strap/dbconf/sqlite/gateway_log.lite @@ -3,7 +3,6 @@ Database gateway_log gateway_log.txt __SQLDSN__ Database gateway_log DEFAULT_TYPE text not null default '' Database gateway_log AUTO_SEQUENCE 1 Database gateway_log KEY gateway_log_id -Database gateway_log COLUMN_DEF "order_md5=varchar(32) not null default ''" Database gateway_log COLUMN_DEF "request_date=varchar(32) not null default ''" Database gateway_log COLUMN_DEF "request_id=varchar(255) not null default ''" Database gateway_log COLUMN_DEF "order_number=varchar(32) not null default ''" @@ -12,5 +11,4 @@ Database gateway_log INDEX request_date Database gateway_log INDEX request_id Database gateway_log INDEX order_number Database gateway_log INDEX email -Database gateway_log INDEX order_md5 Database gateway_log NO_ASCII_INDEX 1 diff --git a/dist/strap/products/gateway_log.txt b/dist/strap/products/gateway_log.txt index a04a22b..e2e2a45 100644 --- a/dist/strap/products/gateway_log.txt +++ b/dist/strap/products/gateway_log.txt @@ -1 +1 @@ -gateway_log_id trans_type processor catalog order_md5 result_code result_subcode reason_code response_msg request_id order_number email session_id request_source request_date request_duration request response +gateway_log_id trans_type processor catalog cart_md5 result_code result_subcode reason_code response_msg request_id order_number email amount session_id host_ip username request_source request_date request_duration request response diff --git a/lib/Vend/Payment/AuthorizeNet.pm b/lib/Vend/Payment/AuthorizeNet.pm index 3faecc6..61a3bda 100644 --- a/lib/Vend/Payment/AuthorizeNet.pm +++ b/lib/Vend/Payment/AuthorizeNet.pm @@ -708,20 +708,21 @@ sub log_it { email => $request->{x_Email} || $response->{x_email} || '', request => ::uneval($request) || '', response => ::uneval($response) || '', - session_id => $::Session->{id}, + session_id => $::Session->{id} || '', request_source => $self->source, + amount => $request->{x_Amount} || '', + host_ip => $::Session->{shost} || $::Session->{ohost} || '', + username => $::Session->{username} || '', + cart_md5 => '', ); - $fields{order_md5} = - Digest::MD5::md5_hex( - $request->{x_Email}, - $request->{x_Type}, - $request->{x_Auth_Code}, - $request->{x_Amount}, - $::Session->{id}, - map { ($_->{code}, $_->{quantity}) } @$Vend::Items - ) - ; + if (@$Vend::Items) { + $fields{cart_md5} = + Digest::MD5::md5_hex( + map { ($_->{code}, $_->{quantity}) } @$Vend::Items + ) + ; + } $self->write(\%fields); } diff --git a/lib/Vend/Payment/Braintree.pm b/lib/Vend/Payment/Braintree.pm index 738cdde..f409f77 100644 --- a/lib/Vend/Payment/Braintree.pm +++ b/lib/Vend/Payment/Braintree.pm @@ -1242,19 +1242,20 @@ sub log_it { email => $opt->{actual}{email} || '', request => ::uneval($request) || '', response => ::uneval($thinned_response) || '', - session_id => $::Session->{id}, + session_id => $::Session->{id} || '', + amount => $request->{args}{AMT} || $request->{args}{amount} || '', + host_ip => $::Session->{shost} || $::Session->{ohost} || '', + username => $::Session->{username} || '', + cart_md5 => '', ); - $fields{order_md5} = - Digest::MD5::md5_hex( - $opt->{actual}{email}, - $opt->{transtype} || 'x', - $request->{args}{ORIGID}, - $request->{args}{AMT} || $request->{args}{amount}, - $::Session->{id}, - map { ($_->{code}, $_->{quantity}) } @$Vend::Items - ) - ; + if (@$Vend::Items) { + $fields{cart_md5} = + Digest::MD5::md5_hex( + map { ($_->{code}, $_->{quantity}) } @$Vend::Items + ) + ; + } $self->write(\%fields); } diff --git a/lib/Vend/Payment/CyberSource.pm b/lib/Vend/Payment/CyberSource.pm index 861dab0..76b39e6 100644 --- a/lib/Vend/Payment/CyberSource.pm +++ b/lib/Vend/Payment/CyberSource.pm @@ -2622,20 +2622,21 @@ sub log_it { email => $request->{billTo_email} || '', request => ::uneval($request) || '', response => ::uneval($response) || '', - session_id => $::Session->{id}, + session_id => $::Session->{id} || '', request_source => $self->source, + amount => $request->{purchaseTotals_grandTotalAmount} || '', + host_ip => $::Session->{shost} || $::Session->{ohost} || '', + username => $::Session->{username} || '', + cart_md5 => '', ); - $fields{order_md5} = - Digest::MD5::md5_hex( - $request->{billTo_email}, - $self->{trans_type}, - $self->{origid}, - $request->{purchaseTotals_grandTotalAmount}, - $::Session->{id}, - map { ($_->{code}, $_->{quantity}) } @$Vend::Items - ) - ; + if (@$Vend::Items) { + $fields{cart_md5} = + Digest::MD5::md5_hex( + map { ($_->{code}, $_->{quantity}) } @$Vend::Items + ) + ; + } $self->write(\%fields); } diff --git a/lib/Vend/Payment/PayflowPro.pm b/lib/Vend/Payment/PayflowPro.pm index 796136c..0b93744 100644 --- a/lib/Vend/Payment/PayflowPro.pm +++ b/lib/Vend/Payment/PayflowPro.pm @@ -913,18 +913,19 @@ sub log_it { response => ::uneval($response) || '', session_id => $::Session->{id}, request_source => $self->source, + amount => $request->{AMT} || '', + host_ip => $::Session->{shost} || $::Session->{ohost} || '', + username => $::Session->{username} || '', + cart_md5 => '', ); - $fields{order_md5} = - Digest::MD5::md5_hex( - $request->{EMAIL}, - $request->{TRXTYPE}, - $request->{ORIGID}, - $request->{AMT}, - $::Session->{id}, - map { ($_->{code}, $_->{quantity}) } @$Vend::Items - ) - ; + if (@$Vend::Items) { + $fields{cart_md5} = + Digest::MD5::md5_hex( + map { ($_->{code}, $_->{quantity}) } @$Vend::Items + ) + ; + } $self->write(\%fields); } diff --git a/lib/Vend/Payment/PaypalExpress.pm b/lib/Vend/Payment/PaypalExpress.pm index 10f1f47..8d16b5a 100644 --- a/lib/Vend/Payment/PaypalExpress.pm +++ b/lib/Vend/Payment/PaypalExpress.pm @@ -2112,20 +2112,21 @@ sub log_it { email => $self->{email} || '', request => ::uneval($request) || '', response => ::uneval($response) || '', - session_id => $::Session->{id}, + session_id => $::Session->{id} || '', request_source => $self->source, + amount => $self->{amount} || '', + host_ip => $::Session->{shost} || $::Session->{ohost} || '', + username => $::Session->{username} || '', + cart_md5 => '', ); - $fields{order_md5} = - Digest::MD5::md5_hex( - $self->{email}, - $response->{DoExpressCheckoutPaymentResponseDetails}{PaymentInfo}{TransactionType}, - $::Scratch->{token}, - $self->{amount}, - $::Session->{id}, - map { ($_->{code}, $_->{quantity}) } @$Vend::Items - ) - ; + if (@$Vend::Items) { + $fields{cart_md5} = + Digest::MD5::md5_hex( + map { ($_->{code}, $_->{quantity}) } @$Vend::Items + ) + ; + } $self->write(\%fields); }