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 fcc5d4f1 authored by Alexandros Moraitis's avatar Alexandros Moraitis Committed by GitHub

[PW-2916 ]3ds fallback (#812)

* 3ds fallback

* remove debug statement

* update js

* fix recommendations
Co-authored-by: default avatarAttila Kiss <42297201+cyattilakiss@users.noreply.github.com>
parent ab20f519
......@@ -147,6 +147,15 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
$result['authentication']['threeds2.challengeToken']
);
}
//Fallback for 3DS in case of redirect
if (!empty($result['resultCode']) &&
$result['resultCode'] === 'RedirectShopper'
) {
$response['type'] = $result['resultCode'];
$response['action']= $result['action'];
return json_encode($response);
}
// Save the payments response because we are going to need it during the place order flow
$payment->setAdditionalInformation("paymentsResponse", $result);
......
......@@ -281,6 +281,23 @@ define(
self.threeDS2ChallengeComponent.mount(threeDS2Node);
}
},
threedsfallback: function (action) {
var self = this;
var actionNode = document.getElementById('ActionContainer');
self.popupModal = $('#ActionModal').modal({
// disable user to hide popup
clickableOverlay: false,
responsive: true,
innerScroll: false,
// empty buttons, we don't need that
buttons: [],
modalClass: 'ActionModal'
});
self.popupModal.modal("openModal");
self.threedsfallbackComponent = self.checkout.createFromAction(action).mount(actionNode);
},
/**
* This method is a workaround to close the modal in the right way and reconstruct the threeDS2Modal.
* This will solve issues when you cancel the 3DS2 challenge and retry the payment
......@@ -384,9 +401,13 @@ define(
// render component
self.renderThreeDS2Component(response.type, response.token, orderId);
} else {
window.location.replace(url.build(
window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl
));
if (response.type === 'RedirectShopper') {
self.threedsfallback(response.action);
} else {
window.location.replace(url.build(
window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl
));
}
}
},
/**
......
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