Commit a865b74f authored by Ángel Campos's avatar Ángel Campos Committed by GitHub

[PW-3133] Refactor threeds2 to paymentDetails (#829)

* Refactor threeds2 to paymentDetails

* paymentDetails.paymentDetails -> paymentDetails.process
parent 935f8042
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
namespace Adyen\Payment\Api; namespace Adyen\Payment\Api;
interface AdyenThreeDS2ProcessInterface interface AdyenPaymentDetailsInterface
{ {
/** /**
* @param string $payload * @param string $payload
......
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
namespace Adyen\Payment\Model; namespace Adyen\Payment\Model;
use Adyen\Payment\Api\AdyenThreeDS2ProcessInterface; use Adyen\Payment\Api\AdyenPaymentDetailsInterface;
use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Data;
use Adyen\Payment\Helper\Vault; use Adyen\Payment\Helper\Vault;
use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Logger\AdyenLogger;
use Magento\Checkout\Model\Session; use Magento\Checkout\Model\Session;
use Magento\Sales\Model\OrderFactory; use Magento\Sales\Model\OrderFactory;
class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface class AdyenPaymentDetails implements AdyenPaymentDetailsInterface
{ {
/** /**
* @var Session * @var Session
...@@ -58,7 +58,7 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface ...@@ -58,7 +58,7 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
private $vaultHelper; private $vaultHelper;
/** /**
* AdyenThreeDS2Process constructor. * AdyenPaymentDetails constructor.
* *
* @param Session $checkoutSession * @param Session $checkoutSession
* @param Data $adyenHelper * @param Data $adyenHelper
......
...@@ -1019,8 +1019,8 @@ ...@@ -1019,8 +1019,8 @@
type="Adyen\Payment\Model\AdyenRequestMerchantSession"/> type="Adyen\Payment\Model\AdyenRequestMerchantSession"/>
<preference for="Adyen\Payment\Api\AdyenInitiateTerminalApiInterface" <preference for="Adyen\Payment\Api\AdyenInitiateTerminalApiInterface"
type="Adyen\Payment\Model\AdyenInitiateTerminalApi"/> type="Adyen\Payment\Model\AdyenInitiateTerminalApi"/>
<preference for="Adyen\Payment\Api\AdyenThreeDS2ProcessInterface" <preference for="Adyen\Payment\Api\AdyenPaymentDetailsInterface"
type="Adyen\Payment\Model\AdyenThreeDS2Process"/> type="Adyen\Payment\Model\AdyenPaymentDetails"/>
<preference for="Adyen\Payment\Api\AdyenOriginKeyInterface" <preference for="Adyen\Payment\Api\AdyenOriginKeyInterface"
type="Adyen\Payment\Model\AdyenOriginKey"/> type="Adyen\Payment\Model\AdyenOriginKey"/>
<preference for="Adyen\Payment\Api\AdyenOrderPaymentStatusInterface" <preference for="Adyen\Payment\Api\AdyenOrderPaymentStatusInterface"
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
</resources> </resources>
</route> </route>
<route url="/V1/adyen/threeDS2Process" method="POST"> <route url="/V1/adyen/paymentDetails" method="POST">
<service class="Adyen\Payment\Api\AdyenThreeDS2ProcessInterface" method="initiate"/> <service class="Adyen\Payment\Api\AdyenPaymentDetailsInterface" method="initiate"/>
<resources> <resources>
<resource ref="anonymous"/> <resource ref="anonymous"/>
</resources> </resources>
......
...@@ -11,17 +11,17 @@ define( ...@@ -11,17 +11,17 @@ define(
'use strict'; 'use strict';
return { return {
/** /**
* The results that the 3DS2 components returns in the onComplete callback needs to be sent to the * The results that the components returns in the onComplete callback needs to be sent to the
* backend to the /adyen/threeDS2Process endpoint and based on the response render a new threeDS2 * backend to the /adyen/paymentDetails endpoint and based on the response render a new
* component or place the order (validateThreeDS2OrPlaceOrder) * component or place the order (validateThreeDS2OrPlaceOrder)
* @param response * @param response
*/ */
processThreeDS2: function (data) { process: function (data) {
var payload = { var payload = {
"payload": JSON.stringify(data) "payload": JSON.stringify(data)
}; };
var serviceUrl = urlBuilder.createUrl('/adyen/threeDS2Process', {}); var serviceUrl = urlBuilder.createUrl('/adyen/paymentDetails', {});
return storage.post( return storage.post(
serviceUrl, serviceUrl,
......
...@@ -37,7 +37,7 @@ define( ...@@ -37,7 +37,7 @@ define(
'Magento_Paypal/js/action/set-payment-method', 'Magento_Paypal/js/action/set-payment-method',
'Magento_Checkout/js/action/select-payment-method', 'Magento_Checkout/js/action/select-payment-method',
'Adyen_Payment/js/threeds2-js-utils', 'Adyen_Payment/js/threeds2-js-utils',
'Adyen_Payment/js/model/threeds2', 'Adyen_Payment/js/model/payment-details',
'Magento_Checkout/js/model/error-processor', 'Magento_Checkout/js/model/error-processor',
'Adyen_Payment/js/model/adyen-payment-service', 'Adyen_Payment/js/model/adyen-payment-service',
'adyenCheckout', 'adyenCheckout',
...@@ -60,7 +60,7 @@ define( ...@@ -60,7 +60,7 @@ define(
setPaymentMethodAction, setPaymentMethodAction,
selectPaymentMethodAction, selectPaymentMethodAction,
threeDS2Utils, threeDS2Utils,
threeds2, paymentDetails,
errorProcessor, errorProcessor,
adyenPaymentService, adyenPaymentService,
AdyenCheckout, AdyenCheckout,
...@@ -229,7 +229,7 @@ define( ...@@ -229,7 +229,7 @@ define(
self.threeDS2IdentifyComponent.unmount(); self.threeDS2IdentifyComponent.unmount();
var request = result.data; var request = result.data;
request.orderId = orderId; request.orderId = orderId;
threeds2.processThreeDS2(request).done(function (responseJSON) { paymentDetails.process(request).done(function (responseJSON) {
self.validateThreeDS2OrPlaceOrder(responseJSON, orderId) self.validateThreeDS2OrPlaceOrder(responseJSON, orderId)
}).fail(function (result) { }).fail(function (result) {
errorProcessor.process(result, self.messageContainer); errorProcessor.process(result, self.messageContainer);
...@@ -268,7 +268,7 @@ define( ...@@ -268,7 +268,7 @@ define(
fullScreenLoader.startLoader(); fullScreenLoader.startLoader();
var request = result.data; var request = result.data;
request.orderId = orderId; request.orderId = orderId;
threeds2.processThreeDS2(request).done(function (responseJSON) { paymentDetails.process(request).done(function (responseJSON) {
self.validateThreeDS2OrPlaceOrder(responseJSON, orderId); self.validateThreeDS2OrPlaceOrder(responseJSON, orderId);
}).fail(function (result) { }).fail(function (result) {
errorProcessor.process(result, self.messageContainer); errorProcessor.process(result, self.messageContainer);
......
...@@ -36,7 +36,7 @@ define( ...@@ -36,7 +36,7 @@ define(
'Magento_Checkout/js/action/place-order', 'Magento_Checkout/js/action/place-order',
'uiLayout', 'uiLayout',
'Magento_Ui/js/model/messages', 'Magento_Ui/js/model/messages',
'Adyen_Payment/js/model/threeds2', 'Adyen_Payment/js/model/payment-details',
'Magento_Checkout/js/model/error-processor', 'Magento_Checkout/js/model/error-processor',
'adyenCheckout', 'adyenCheckout',
'Adyen_Payment/js/bundle' 'Adyen_Payment/js/bundle'
...@@ -57,7 +57,7 @@ define( ...@@ -57,7 +57,7 @@ define(
placeOrderAction, placeOrderAction,
layout, layout,
Messages, Messages,
threeds2, paymentDetails,
errorProcessor, errorProcessor,
AdyenCheckout, AdyenCheckout,
AdyenComponent AdyenComponent
...@@ -752,7 +752,7 @@ define( ...@@ -752,7 +752,7 @@ define(
request.orderId = self.orderId; request.orderId = self.orderId;
// Using the same processor as 3DS2, refactor to generic name in a upcomming release will be breaking change for merchants. // Using the same processor as 3DS2, refactor to generic name in a upcomming release will be breaking change for merchants.
threeds2.processThreeDS2(request).done(function() { paymentDetails.process(request).done(function() {
$.mage.redirect( $.mage.redirect(
window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl, window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl,
); );
......
...@@ -39,7 +39,7 @@ define( ...@@ -39,7 +39,7 @@ define(
'Magento_Checkout/js/model/url-builder', 'Magento_Checkout/js/model/url-builder',
'mage/storage', 'mage/storage',
'Magento_Checkout/js/action/place-order', 'Magento_Checkout/js/action/place-order',
'Adyen_Payment/js/model/threeds2', 'Adyen_Payment/js/model/payment-details',
'Magento_Checkout/js/model/error-processor', 'Magento_Checkout/js/model/error-processor',
'Adyen_Payment/js/model/adyen-payment-service', 'Adyen_Payment/js/model/adyen-payment-service',
'adyenCheckout', 'adyenCheckout',
...@@ -66,7 +66,7 @@ function( ...@@ -66,7 +66,7 @@ function(
urlBuilder, urlBuilder,
storage, storage,
placeOrderAction, placeOrderAction,
threeds2, paymentDetails,
errorProcessor, errorProcessor,
adyenPaymentService, adyenPaymentService,
AdyenCheckout, AdyenCheckout,
...@@ -350,7 +350,7 @@ function( ...@@ -350,7 +350,7 @@ function(
onComplete: function(result) { onComplete: function(result) {
var request = result.data; var request = result.data;
request.orderId = orderId; request.orderId = orderId;
threeds2.processThreeDS2(request). paymentDetails.process(request).
done(function(responseJSON) { done(function(responseJSON) {
self.validateThreeDS2OrPlaceOrder(responseJSON, self.validateThreeDS2OrPlaceOrder(responseJSON,
orderId); orderId);
...@@ -389,7 +389,7 @@ function( ...@@ -389,7 +389,7 @@ function(
fullScreenLoader.startLoader(); fullScreenLoader.startLoader();
var request = result.data; var request = result.data;
request.orderId = orderId; request.orderId = orderId;
threeds2.processThreeDS2(request). paymentDetails.process(request).
done(function(responseJSON) { done(function(responseJSON) {
self.validateThreeDS2OrPlaceOrder(responseJSON, self.validateThreeDS2OrPlaceOrder(responseJSON,
orderId); orderId);
......
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