Commit ab470b0d authored by Rik ter Beek's avatar Rik ter Beek

catch exception and throw nice error to shopper

parent b56c3bc3
......@@ -208,7 +208,13 @@ class Boleto extends \Magento\Payment\Model\Method\AbstractMethod
{
switch ($request) {
case "authorise":
$response = $this->_paymentRequest->fullApiRequest($payment, $this->_code);
try {
$response = $this->_paymentRequest->fullApiRequest($payment, $this->_code);
} catch (\Adyen\AdyenException $e) {
$errorMsg = __('Error with payment method please select different payment method.');
$this->_logger->critical($e->getMessage());
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
}
break;
}
......
......@@ -278,7 +278,13 @@ class Sepa extends \Magento\Payment\Model\Method\AbstractMethod
{
switch ($request) {
case "authorise":
$response = $this->_paymentRequest->fullApiRequest($payment, $this->_code);
try {
$response = $this->_paymentRequest->fullApiRequest($payment, $this->_code);
} catch (\Adyen\AdyenException $e) {
$errorMsg = __('Error with payment method please select different payment method.');
$this->_logger->critical($e->getMessage());
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
}
break;
}
......
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