From: Ivan Kohler Date: Fri, 21 Jun 2013 20:56:05 +0000 (-0700) Subject: When IPPay returns a non-sensical response, don't include it in the error message... X-Git-Url: http://git.freeside.biz/gitweb/?p=Business-OnlinePayment-IPPay.git;a=commitdiff_plain;h=20e2917873bd6c764ca03ff763869fdc88aaf506 When IPPay returns a non-sensical response, don't include it in the error message unless debug is on --- diff --git a/Changes b/Changes index 510cee5..a3c1a5e 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,8 @@ Revision history for Perl extension Business::OnlinePayment::IPPay. 0.09 unreleased - Set UDField3 per IPPay request - Require password + - When IPPay returns a non-sensical response, don't include it in the + error message unless debug is on 0.08 Fri Dec 14 12:54:14 PST 2012 - Pass ACH account type diff --git a/IPPay.pm b/IPPay.pm index 3d1582d..2dd2c85 100644 --- a/IPPay.pm +++ b/IPPay.pm @@ -54,12 +54,9 @@ sub set_defaults { response_page response_code response_headers )); - # module specific data - if ( $opts{debug} ) { - $self->debug( $opts{debug} ); - delete $opts{debug}; - } + $DEBUG = exists($opts{debug}) ? $opts{debug} : 0; + # module specific data my %_defaults = (); foreach my $key (keys %opts) { $key =~ /^default_(\w*)$/ or next; @@ -240,7 +237,7 @@ sub submit { "(HTTPS headers: ". join(", ", map { "$_ => ". $headers{$_} } keys %headers ). ") ". "(Raw HTTPS content: $page)" - if $DEBUG; + if $DEBUG > 1; return unless $server_response=~ /^200/; $transaction_id = $page; } @@ -387,11 +384,11 @@ sub submit { $writer->endTag('JetPay'); $writer->end(); - warn "$post_data\n" if $DEBUG; + warn "$post_data\n" if $DEBUG > 1; my ($page,$server_response,%headers) = $self->https_post($post_data); - warn "$page\n" if $DEBUG; + warn "$page\n" if $DEBUG > 1; my $response = {}; if ($server_response =~ /^200/){ @@ -414,13 +411,20 @@ sub submit { $self->is_success($self->result_code() eq '000' ? 1 : 0); unless ($self->is_success()) { - unless ( $self->error_message() ) { #additional logging information - $self->error_message( - "(HTTPS response: $server_response) ". - "(HTTPS headers: ". - join(", ", map { "$_ => ". $headers{$_} } keys %headers ). ") ". - "(Raw HTTPS content: $page)" - ); + unless ( $self->error_message() ) { + if ( $DEBUG ) { + #additional logging information, possibly too sensitive for an error msg + # (IPPay seems to have a failure mode where they return the full + # original request including card number) + $self->error_message( + "(HTTPS response: $server_response) ". + "(HTTPS headers: ". + join(", ", map { "$_ => ". $headers{$_} } keys %headers ). ") ". + "(Raw HTTPS content: $page)" + ); + } else { + $self->error_message('No ResponseText or ErrMsg was returned by IPPay (enable debugging for raw HTTPS response)'); + } } }