From fcba6b0d7945a63197096ffabebcdad2445544bb Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 21 Mar 2007 22:09:07 +0000 Subject: [PATCH] realtime_bop: if a transaction fails without an error_message, output additional debugging information, if available --- FS/FS/cust_main.pm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index f6270e1d4..c60fc8345 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -21,6 +21,7 @@ use Date::Parse; use String::Approx qw(amatch); use Business::CreditCard 0.28; use Locale::Country; +use Data::Dumper; use FS::UID qw( getotaker dbh ); use FS::Record qw( qsearchs qsearch dbdef ); use FS::Misc qw( send_email ); @@ -2767,6 +2768,42 @@ sub realtime_bop { my $perror = "$processor error: ". $transaction->error_message; + unless ( $transaction->error_message ) { + + my $t_response; + #this should be normalized :/ + # + # bad, ad-hoc B:OP:PayflowPro "transaction_response" BS + if ( $transaction->can('param') + && $transaction->param('transaction_response') ) { + $t_response = $transaction->param('transaction_response') + + # slightly better, ad-hoc B:OP:TransactionCentral without "param" + } elsif ( $transaction->can('response_page') ) { + $t_response = { + 'page' => ( $transaction->can('response_page') + ? $transaction->response_page + : '' + ), + 'code' => ( $transaction->can('response_code') + ? $transaction->response_code + : '' + ), + 'headers' => ( $transaction->can('response_headers') + ? $transaction->response_headers + : '' + ), + }; + } else { + $t_response .= + "No additional debugging information available for $processor"; + } + + $perror .= "No error_message returned from $processor -- "; + ( ref($t_response) ? Dumper($t_response) : $t_response ); + + } + if ( !$options{'quiet'} && !$realtime_bop_decline_quiet && $conf->exists('emaildecline') && grep { $_ ne 'POST' } $self->invoicing_list -- 2.11.0