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