Skip to content

Commit

Permalink
Adding message for PAYMENT_SOURCE_CANNOT_BE_USED error
Browse files Browse the repository at this point in the history
  • Loading branch information
btafforeau authored and Matt75 committed Jan 31, 2024
1 parent 713afd8 commit 2299b5c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/front/validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Exception/PayPalException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions src/PayPalError.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2299b5c

Please sign in to comment.