Commit 6d52d407 authored by pajor's avatar pajor Committed by mglaman

Issue #2941933 by pajor, aestigarribia, kala4ek: EC onReturn() errors and...

Issue #2941933 by pajor, aestigarribia, kala4ek: EC onReturn() errors and order state (processing/paid etc.) issues
parent 3b44fcba
......@@ -300,10 +300,22 @@ class ExpressCheckout extends OffsitePaymentGatewayBase implements ExpressChecko
$paypal_response = $this->doExpressCheckoutDetails($order);
// Nothing to do for failures for now - no payment saved.
if ($paypal_response['PAYMENTINFO_0_PAYMENTSTATUS'] == 'Failed') {
if (isset($paypal_response['PAYMENTINFO_0_PAYMENTSTATUS']) && $paypal_response['PAYMENTINFO_0_PAYMENTSTATUS'] == 'Failed') {
throw new PaymentGatewayException($paypal_response['PAYMENTINFO_0_LONGMESSAGE'], $paypal_response['PAYMENTINFO_0_ERRORCODE']);
}
if ($paypal_response['ACK'] == 'Failure') {
// When a buyer's funding source fails, the DoExpressCheckoutPayment and
// DoAuthorization call, a 10486 error is returned.
// @link https://developer.paypal.com/docs/classic/express-checkout/ht_ec_fundingfailure10486/
if (isset($paypal_response['L_ERRORCODE0']) && $paypal_response['L_ERRORCODE0'] == "10486") {
$message = $paypal_response['L_LONGMESSAGE0'];
throw new PaymentGatewayException("$message Express Checkout payment failed due to a bad funding source; it is possible that the transaction exceeded the buyer's card limit.", $paypal_response['L_ERRORCODE0']);
}
throw new PaymentGatewayException($paypal_response['L_LONGMESSAGE0'], $paypal_response['L_ERRORCODE0']);
}
$payment_storage = $this->entityTypeManager->getStorage('commerce_payment');
$payment = $payment_storage->create([
'state' => 'authorization',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment