Commit 7565212c authored by attilak's avatar attilak

Adjust retrieveAvailablePaymentMethods in the adyen-cc-method.js

Handle the ajax response when the request is done
TODO: check if ratepay device fingerprint script is still necessary
parent aef5b40a
...@@ -71,31 +71,32 @@ define( ...@@ -71,31 +71,32 @@ define(
var self = this; var self = this;
this._super(); this._super();
// reset variable: adyenPaymentService.retrieveAvailablePaymentMethods().done(function (response) {
adyenPaymentService.setPaymentMethods();
adyenPaymentService.retrieveAvailablePaymentMethods(function () { var responseJson = JSON.parse(response);
var paymentMethods = adyenPaymentService.getAvailablePaymentMethods(); var paymentMethodsResponse = responseJson.paymentMethodsResponse;
console.log(paymentMethods); var paymentMethods = paymentMethodsResponse.paymentMethods;
if (!!window.checkoutConfig.payment.adyenHpp) {
// TODO check if this is still required or if can be outsourced for the generic component, or checkout can create a ratepay component
/*if (!!window.checkoutConfig.payment.adyenHpp) {
if (JSON.stringify(paymentMethods).indexOf("ratepay") > -1) { if (JSON.stringify(paymentMethods).indexOf("ratepay") > -1) {
var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
var dfValueRatePay = self.getRatePayDeviceIdentToken();
window.di = { var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
t: dfValueRatePay.replace(':', ''), var dfValueRatePay = self.getRatePayDeviceIdentToken();
v: ratePayId,
l: 'Checkout' window.di = {
}; t: dfValueRatePay.replace(':', ''),
v: ratePayId,
l: 'Checkout'
};
// Load Ratepay script // Load Ratepay script
var ratepayScriptTag = document.createElement('script'); var ratepayScriptTag = document.createElement('script');
ratepayScriptTag.src = "//d.ratepay.com/" + ratePayId + "/di.js"; ratepayScriptTag.src = "//d.ratepay.com/" + ratePayId + "/di.js";
ratepayScriptTag.type = "text/javascript"; ratepayScriptTag.type = "text/javascript";
document.body.appendChild(ratepayScriptTag); document.body.appendChild(ratepayScriptTag);
} }
} }*/
});
// Initialises adyen checkout main component with default configuration // Initialises adyen checkout main component with default configuration
adyenPaymentService.initCheckoutComponent( adyenPaymentService.initCheckoutComponent(
......
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