summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-06-21 13:56:05 -0700
committerIvan Kohler <ivan@freeside.biz>2013-06-21 13:56:05 -0700
commit20e2917873bd6c764ca03ff763869fdc88aaf506 (patch)
treeea1d7f95f4cc79df9df73a70403a5de74ffd7771
parent8552a65db4413334d7755f6c1228da3dcdb92dcc (diff)
When IPPay returns a non-sensical response, don't include it in the error message unless debug is on
-rw-r--r--Changes2
-rw-r--r--IPPay.pm34
2 files changed, 21 insertions, 15 deletions
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)');
+ }
}
}