We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 75fb358b authored by Rik ter Beek's avatar Rik ter Beek Committed by GitHub

Merge pull request #64 from Adyen/release-1.4.5

Fixes #63 reactivate quote and show error message when 3D secure failed
parents 7314cb4f 57960ab0
......@@ -94,10 +94,13 @@ class Validate3d extends \Magento\Framework\App\Action\Action
try {
$result = $order->getPayment()->getMethodInstance()->authorise3d($order->getPayment());
} catch (Exception $e) {
} catch (\Exception $e) {
$this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused");
$result = 'Refused';
}
$this->_adyenLogger->addAdyenResult("Process 3D secure payment result is: " . $result);
// check if authorise3d was successful
if ($result == 'Authorised') {
$order->addStatusHistoryComment(__('3D-secure validation was successful'))->save();
......@@ -105,6 +108,15 @@ class Validate3d extends \Magento\Framework\App\Action\Action
} else {
$order->addStatusHistoryComment(__('3D-secure validation was unsuccessful.'))->save();
$this->_adyenHelper->cancelOrder($order);
$this->messageManager->addErrorMessage("3D-secure validation was unsuccessful");
// reactivate the quote
$session = $this->_getCheckout();
// restore the quote
$session->restoreQuote();
$this->_redirect('checkout/cart');
}
}
} else {
......
......@@ -322,7 +322,7 @@ class PaymentRequest extends DataObject
try {
$service = new \Adyen\Service\Payment($this->_client);
$result = $service->authorise3D($request);
} catch(Exception $e) {
} catch(\Adyen\AdyenException $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed'));
}
......
......@@ -371,7 +371,11 @@ class Cc extends \Magento\Payment\Model\Method\Cc
*/
public function authorise3d($payment)
{
$response = $this->_paymentRequest->authorise3d($payment);
try {
$response = $this->_paymentRequest->authorise3d($payment);
} catch(\Exception $e) {
throw $e;
}
$responseCode = $response['resultCode'];
return $responseCode;
}
......
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