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 9ca462ca authored by Rik ter Beek's avatar Rik ter Beek

Fix 3D secure payments for vault and billingagreements

parent 67ada465
...@@ -146,15 +146,16 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -146,15 +146,16 @@ class Validate3d extends \Magento\Framework\App\Action\Action
try { try {
$result = $this->_authorise3d($order->getPayment()); $result = $this->_authorise3d($order->getPayment());
$responseCode = $result['resultCode'];
} catch (\Exception $e) { } catch (\Exception $e) {
$this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused"); $this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused");
$result = 'Refused'; $responseCode = 'Refused';
} }
$this->_adyenLogger->addAdyenResult("Process 3D secure payment result is: " . $result); $this->_adyenLogger->addAdyenResult("Process 3D secure payment result is: " . $responseCode);
// check if authorise3d was successful // check if authorise3d was successful
if ($result == 'Authorised') { if ($responseCode == 'Authorised') {
$order->addStatusHistoryComment(__('3D-secure validation was successful'))->save(); $order->addStatusHistoryComment(__('3D-secure validation was successful'))->save();
/** /**
...@@ -163,7 +164,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -163,7 +164,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action
*/ */
$order->getPayment()->setAdditionalInformation('3dActive', ''); $order->getPayment()->setAdditionalInformation('3dActive', '');
$order->getPayment()->setAdditionalInformation('3dSuccess', true); $order->getPayment()->setAdditionalInformation('3dSuccess', true);
$this->_orderRepository->save($order);
// TODO: add better checks if variables are available in the result // TODO: add better checks if variables are available in the result
if (!$this->_adyenHelper->isCreditCardVaultEnabled()) { if (!$this->_adyenHelper->isCreditCardVaultEnabled()) {
...@@ -201,6 +202,8 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -201,6 +202,8 @@ class Validate3d extends \Magento\Framework\App\Action\Action
} }
} }
$this->_orderRepository->save($order);
$this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]); $this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]);
} else { } else {
...@@ -251,8 +254,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -251,8 +254,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action
} catch (\Exception $e) { } catch (\Exception $e) {
throw $e; throw $e;
} }
$responseCode = $response['resultCode']; return $response;
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