X-Git-Url: http://git.freeside.biz/gitweb/?p=Business-OnlinePayment-IPPay.git;a=blobdiff_plain;f=IPPay.pm;fp=IPPay.pm;h=2dd2c85ada6f6970fed7d908242efd8abf50cf82;hp=3d1582d838b0d690f7c4ab480663d19a43b441f1;hb=20e2917873bd6c764ca03ff763869fdc88aaf506;hpb=8552a65db4413334d7755f6c1228da3dcdb92dcc 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)'); + } } }