We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday 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 ...@@ -147,6 +147,15 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
$result['authentication']['threeds2.challengeToken'] $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 // Save the payments response because we are going to need it during the place order flow
$payment->setAdditionalInformation("paymentsResponse", $result); $payment->setAdditionalInformation("paymentsResponse", $result);
......
...@@ -281,6 +281,23 @@ define( ...@@ -281,6 +281,23 @@ define(
self.threeDS2ChallengeComponent.mount(threeDS2Node); 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 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 * This will solve issues when you cancel the 3DS2 challenge and retry the payment
...@@ -384,9 +401,13 @@ define( ...@@ -384,9 +401,13 @@ define(
// render component // render component
self.renderThreeDS2Component(response.type, response.token, orderId); self.renderThreeDS2Component(response.type, response.token, orderId);
} else { } else {
window.location.replace(url.build( if (response.type === 'RedirectShopper') {
window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl 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