Commit aef5b40a authored by attilak's avatar attilak

Do not save payment methods in the adyen-method-list

Remove adyen-method-list.js
Remove callback parameter from retrieveAvailablePaymentMethods and
remove handling the ajax request handling when done
Move processThreeDS2 from threeds2.js and remove threeds2.js file
Remove callback parameter from processThreeDS2 and
remove handling the ajax request handling when done
parent 2ad9783f
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'ko'
],
function(ko) {
'use strict';
return ko.observableArray([]);
}
);
...@@ -6,34 +6,19 @@ define( ...@@ -6,34 +6,19 @@ define(
[ [
'underscore', 'underscore',
'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/quote',
'Adyen_Payment/js/model/adyen-method-list',
'Magento_Customer/js/model/customer', 'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/url-builder', 'Magento_Checkout/js/model/url-builder',
'mage/storage', 'mage/storage',
'Adyen_Payment/js/bundle', 'Adyen_Payment/js/bundle',
], ],
function (_, quote, methodList, customer, urlBuilder, storage) { function (_, quote, customer, urlBuilder, storage, adyenComponent) {
'use strict'; 'use strict';
var checkoutComponent = {}; var checkoutComponent = {};
return { return {
/**
* Populate the list of payment methods
* @param {Array} methods
*/
setPaymentMethods: function (methods) {
methodList(methods);
},
/**
* Get the list of available payment methods.
* @returns {Array}
*/
getAvailablePaymentMethods: function () {
return methodList();
},
/** /**
* Retrieve the list of available payment methods from the server * Retrieve the list of available payment methods from the server
*/ */
retrieveAvailablePaymentMethods: function (callback) { retrieveAvailablePaymentMethods: function () {
var self = this; var self = this;
// retrieve payment methods // retrieve payment methods
...@@ -52,24 +37,31 @@ define( ...@@ -52,24 +37,31 @@ define(
shippingAddress: quote.shippingAddress() shippingAddress: quote.shippingAddress()
}; };
storage.post( return storage.post(
serviceUrl, JSON.stringify(payload) serviceUrl,
).done( JSON.stringify(payload),
function (response) { true
var jsonResponse = JSON.parse(response);
console.log(jsonResponse);
self.setPaymentMethods(jsonResponse);
if (callback) {
callback();
}
}
).fail(
function () {
self.setPaymentMethods([]);
}
) )
}, },
/**
* 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
* component or place the order (validateThreeDS2OrPlaceOrder)
* @param response
*/
processThreeDS2: function (data) {
var payload = {
"payload": JSON.stringify(data)
};
var serviceUrl = urlBuilder.createUrl('/adyen/threeDS2Process', {});
return storage.post(
serviceUrl,
JSON.stringify(payload),
true
);
},
getOrderPaymentStatus: function (orderId) { getOrderPaymentStatus: function (orderId) {
var serviceUrl = urlBuilder.createUrl('/adyen/orders/:orderId/payment-status', { var serviceUrl = urlBuilder.createUrl('/adyen/orders/:orderId/payment-status', {
orderId: orderId orderId: orderId
......
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'Magento_Checkout/js/model/url-builder',
'mage/storage'
],
function (urlBuilder, storage) {
'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
* component or place the order (validateThreeDS2OrPlaceOrder)
* @param response
*/
processThreeDS2: function (data) {
var payload = {
"payload": JSON.stringify(data)
};
var serviceUrl = urlBuilder.createUrl('/adyen/threeDS2Process', {});
return storage.post(
serviceUrl,
JSON.stringify(payload),
true
);
}
};
}
);
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