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 540ffa7f authored by attilak's avatar attilak

Remove breaking change for PWA

Some PWA integrations can still use the session to retrieve the order
but in the next major release only the orderId request parameter can be
used to retrieve the order object
parent 80cd9ce9
......@@ -84,11 +84,14 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
}
if (empty($payload['orderId'])) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure 2.0 failed because of a missing order id'));
$order = $this->getOrder();
// In the next major release remove support for retrieving order from session and throw exception instead
//throw new \Magento\Framework\Exception\LocalizedException(__('3D secure 2.0 failed because of a missing order id'));
} else {
// Create order by order id
$order = $this->orderFactory->create()->load($payload['orderId']);
}
// Create order by order id
$order = $this->orderFactory->create()->load($payload['orderId']);
$payment = $order->getPayment();
// Init payments/details request
......@@ -157,4 +160,18 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
$response['result'] = $result['resultCode'];
return json_encode($response);
}
/**
* Get order object
*
* @return \Magento\Sales\Model\Order
* @deprecated Will be removed in 7.0.0
*/
protected function getOrder()
{
$incrementId = $this->checkoutSession->getLastRealOrderId();
$order = $this->orderFactory->create()->loadByIncrementId($incrementId);
return $order;
}
}
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