diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-05-20 11:38:19 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-05-20 11:38:19 -0700 |
commit | 0d60ccd9aed8af2473ba936648dd6ca889d35c04 (patch) | |
tree | 7a7f92761cce7f9ff122d3a9ca7e6fe59bc068d1 | |
parent | 1dfeb8c498824e8a4164edac87546bcecdeb40ff (diff) |
Handle and pass back error responses in ResultCode as well
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | lib/Business/OnlinePayment/vSecureProcessing.pm | 18 |
2 files changed, 12 insertions, 9 deletions
@@ -1,5 +1,8 @@ Revision history for Perl module Business::OnlinePayment::vSecureProcessing +0.06 Wed May 20 11:38:02 PDT 2015 + - Handle and pass back error responses in ResultCode as well + 0.05 Thu Feb 19 13:38:21 PST 2015 - cvv2_response should never be passed back as a hashref diff --git a/lib/Business/OnlinePayment/vSecureProcessing.pm b/lib/Business/OnlinePayment/vSecureProcessing.pm index 0ae9adc..85d5f1b 100644 --- a/lib/Business/OnlinePayment/vSecureProcessing.pm +++ b/lib/Business/OnlinePayment/vSecureProcessing.pm @@ -11,7 +11,7 @@ use Business::OnlinePayment::HTTPS; @ISA = qw(Business::OnlinePayment::HTTPS); $DEBUG = 0; -$VERSION = '0.05'; +$VERSION = '0.06'; # mapping out all possible endpoints # but this version will only be building out "charge", "void", & "credit" @@ -361,17 +361,17 @@ sub parse_response { $self->is_success($self->result_code() eq '0' ? 1 : 0); if ($self->is_success()) { $self->authorization($response->{ReferenceNumber}); - } - # fill in error_message if there is is an error - if ( !$self->is_success && exists($response->{AdditionalResponseData})) { - $self->error_message('Error '.$response->{ResponseCode}.': '.$response->{AdditionalResponseData}); - }elsif ( !$self->is_success && exists($response->{Receipt}) ) { - $self->error_message('Error '.$response->{ResponseCode}.': '.(exists($response->{Receipt})) ? $response->{Receipt} : ''); + } else { # fill in error_message if there is is an error + $self->error_message( 'Error '.$response->{ResponseCode}.': '. + ( $response->{AdditionalResponseData} + || $response->{Receipt} + || $response->{ResultCode} + ) + ); } } else { - die 'Error communicating with vSecureProcessing server'; - return; + die 'Error communicating with vSecureProcessing server (server sent response: '. $self->server_response. ')'; } } |