Skip Menu |

This queue is for tickets about the Business-OnlinePayment-Vanco CPAN distribution.

Report information
The Basics
Id: 42471
Status: new
Priority: 0/
Queue: Business-OnlinePayment-Vanco

People
Owner: Nobody in particular
Requestors: bradoaks [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.01
  • 0.02
Fixed in: (no value)



Subject: problem parsing multiple errors in response
A response with multiple errors is causing the following error to be reported: Bad index while coercing array into hash at /usr/local/asp/arcos/lib/Business/OnlinePayment/Vanco.pm line 434. Here is a snippet of a response with two errors: <Response> <Errors> <Error> <ErrorCode>495</ErrorCode> <ErrorDescription>CustomerAddress1 Field Contains Invalid Characters</ErrorDescription> </Error> <Error> <ErrorCode>495</ErrorCode> <ErrorDescription>CardBillingAddr1 Field Contains Invalid Characters</ErrorDescription> </Error> </Errors> </Response> XMLIn gives the array ref at $response->{Response}->{Errors}->{Error} not at $response->{Response}->{Errors} where we are currently looking. A small change has this fixed in my local copy: diff -rub Business-OnlinePayment-Vanco-0.024/Vanco.pm Business-OnlinePayment-Vanco-0.025/Vanco.pm --- Business-OnlinePayment-Vanco-0.024/Vanco.pm 2009-01-08 12:28:34.000000000 -0500 +++ Business-OnlinePayment-Vanco-0.025/Vanco.pm 2009-01-16 12:29:16.000000000 -0500 @@ -421,8 +421,8 @@ && !exists($response->{Response}->{Errors})) { # so much for docs $error->{ErrorDescription} = ''; $error->{ErrorCode} = ''; - }elsif (ref($response->{Response}->{Errors}) eq 'ARRAY') { - $error = $response->{Response}->{Errors}->[0]; + }elsif (ref($response->{Response}->{Errors}->{Error}) eq 'ARRAY') { + $error = $response->{Response}->{Errors}->{Error}->[0]; }else{ $error = $response->{Response}->{Errors}->{Error}; }
attached is the patch for my proposed changes.
diff -rub Business-OnlinePayment-Vanco-0.024/Changes Business-OnlinePayment-Vanco-0.025/Changes --- Business-OnlinePayment-Vanco-0.024/Changes 2009-01-08 12:53:46.000000000 -0500 +++ Business-OnlinePayment-Vanco-0.025/Changes 2009-01-16 12:31:57.000000000 -0500 @@ -1,4 +1,7 @@ Revision history for Perl extension Business::OnlinePayment::Vanco. +0.025 + - fixing location in response to check for multiple Errors + 0.024 Thu Jan 8 12:52:09 EST 2009 - adding CardBillingCountryCode (specified using 'country') to the feed. diff -rub Business-OnlinePayment-Vanco-0.024/Vanco.pm Business-OnlinePayment-Vanco-0.025/Vanco.pm --- Business-OnlinePayment-Vanco-0.024/Vanco.pm 2009-01-08 12:28:34.000000000 -0500 +++ Business-OnlinePayment-Vanco-0.025/Vanco.pm 2009-01-16 12:29:16.000000000 -0500 @@ -421,8 +421,8 @@ && !exists($response->{Response}->{Errors})) { # so much for docs $error->{ErrorDescription} = ''; $error->{ErrorCode} = ''; - }elsif (ref($response->{Response}->{Errors}) eq 'ARRAY') { - $error = $response->{Response}->{Errors}->[0]; + }elsif (ref($response->{Response}->{Errors}->{Error}) eq 'ARRAY') { + $error = $response->{Response}->{Errors}->{Error}->[0]; }else{ $error = $response->{Response}->{Errors}->{Error}; }