commit 526513bd12760f8f5d8fd9c69cf4062413dddf84
Author: Marco Pessotto <melmothx@gmail.com>
Date: Thu Apr 3 15:06:43 2014 +0200
Prevent the function to crash when the response is unparsable
Background: it looks like SOAP::Lite sometimes (or always?) fails to escape
some entities (notably &). In this case the charging route crashes, because
$response->valueof('//SetExpressCheckoutResponse') just returns undef.
This patch basically prevent the charge action to complete and set the
redirection to the checkout, the same way as it would have failed for
other reasons.
lib/Vend/Payment/PaypalExpress.pm | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/lib/Vend/Payment/PaypalExpress.pm b/lib/Vend/Payment/PaypalExpress.pm
index 6a0ff48..1a892fa 100644
--- a/lib/Vend/Payment/PaypalExpress.pm
+++ b/lib/Vend/Payment/PaypalExpress.pm
@@ -911,7 +911,13 @@ sub paypalexpress {
$method = SOAP::Data->name('SetExpressCheckoutReq')->attr({xmlns=>$xmlns});
$response = $service->call($header, $method => $request);
- %result = %{$response->valueof('//SetExpressCheckoutResponse')};
+
+ my $result_hashref = $response->valueof('//SetExpressCheckoutResponse');
+ unless ($result_hashref) {
+ $Tag->error({ name => 'paypal_failure', set => errmsg('Unable to parse the PayPal response') });
+ return $Tag->deliver({ location => $checkouturl });
+ }
+ %result = %$result_hashref;
$::Scratch->{'token'} = $result{'Token'};
if (!$result{'Token'}) {
_______________________________________________
interchange-cvs mailing list
interchange-cvs@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-cvs
Author: Marco Pessotto <melmothx@gmail.com>
Date: Thu Apr 3 15:06:43 2014 +0200
Prevent the function to crash when the response is unparsable
Background: it looks like SOAP::Lite sometimes (or always?) fails to escape
some entities (notably &). In this case the charging route crashes, because
$response->valueof('//SetExpressCheckoutResponse') just returns undef.
This patch basically prevent the charge action to complete and set the
redirection to the checkout, the same way as it would have failed for
other reasons.
lib/Vend/Payment/PaypalExpress.pm | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/lib/Vend/Payment/PaypalExpress.pm b/lib/Vend/Payment/PaypalExpress.pm
index 6a0ff48..1a892fa 100644
--- a/lib/Vend/Payment/PaypalExpress.pm
+++ b/lib/Vend/Payment/PaypalExpress.pm
@@ -911,7 +911,13 @@ sub paypalexpress {
$method = SOAP::Data->name('SetExpressCheckoutReq')->attr({xmlns=>$xmlns});
$response = $service->call($header, $method => $request);
- %result = %{$response->valueof('//SetExpressCheckoutResponse')};
+
+ my $result_hashref = $response->valueof('//SetExpressCheckoutResponse');
+ unless ($result_hashref) {
+ $Tag->error({ name => 'paypal_failure', set => errmsg('Unable to parse the PayPal response') });
+ return $Tag->deliver({ location => $checkouturl });
+ }
+ %result = %$result_hashref;
$::Scratch->{'token'} = $result{'Token'};
if (!$result{'Token'}) {
_______________________________________________
interchange-cvs mailing list
interchange-cvs@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-cvs