diff --git a/controllers/front/validate.php b/controllers/front/validate.php index be9c2ab95..1ef8999c7 100644 --- a/controllers/front/validate.php +++ b/controllers/front/validate.php @@ -402,6 +402,10 @@ private function handleException(Exception $exception) $exceptionMessageForCustomer = $this->module->l('Transaction expired, please try again.'); $notifyCustomerService = false; break; + case PayPalException::PAYMENT_SOURCE_CANNOT_BE_USED: + $exceptionMessageForCustomer = $this->module->l('The selected payment method does not support this type of transaction. Please choose another payment method or contact support for assistance.'); + $notifyCustomerService = false; + break; } } diff --git a/src/Exception/PayPalException.php b/src/Exception/PayPalException.php index c95725238..015b0a728 100644 --- a/src/Exception/PayPalException.php +++ b/src/Exception/PayPalException.php @@ -153,4 +153,5 @@ class PayPalException extends PsCheckoutException const PAYMENT_DENIED = 128; const CARD_BRAND_NOT_SUPPORTED = 129; const RESOURCE_NOT_FOUND = 130; + const PAYMENT_SOURCE_CANNOT_BE_USED = 131; } diff --git a/src/PayPalError.php b/src/PayPalError.php index 8a6d2eea5..7d30d09c1 100644 --- a/src/PayPalError.php +++ b/src/PayPalError.php @@ -303,6 +303,8 @@ public function throwException() throw new PayPalException('Processing of this card brand is not supported. Use another type of card.', PayPalException::CARD_BRAND_NOT_SUPPORTED); case 'RESOURCE_NOT_FOUND': throw new PayPalException('The specified resource does not exist.', PayPalException::RESOURCE_NOT_FOUND); + case 'PAYMENT_SOURCE_CANNOT_BE_USED': + throw new PayPalException('The provided payment source cannot be used to pay for the order. Please try again with a different payment source by creating a new order.', PayPalException::PAYMENT_SOURCE_CANNOT_BE_USED); default: throw new PayPalException($this->message, PayPalException::UNKNOWN); }