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(
var self = this;
this._super();
// reset variable:
adyenPaymentService.setPaymentMethods();
adyenPaymentService.retrieveAvailablePaymentMethods().done(function (response) {
adyenPaymentService.retrieveAvailablePaymentMethods(function () {
var paymentMethods = adyenPaymentService.getAvailablePaymentMethods();
console.log(paymentMethods);
if (!!window.checkoutConfig.payment.adyenHpp) {
var responseJson = JSON.parse(response);
var paymentMethodsResponse = responseJson.paymentMethodsResponse;
var paymentMethods = paymentMethodsResponse.paymentMethods;
// 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) {
var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
var dfValueRatePay = self.getRatePayDeviceIdentToken();
window.di = {
t: dfValueRatePay.replace(':', ''),
v: ratePayId,
l: 'Checkout'
};
var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
var dfValueRatePay = self.getRatePayDeviceIdentToken();
window.di = {
t: dfValueRatePay.replace(':', ''),
v: ratePayId,
l: 'Checkout'
};
// Load Ratepay script
var ratepayScriptTag = document.createElement('script');
ratepayScriptTag.src = "//d.ratepay.com/" + ratePayId + "/di.js";
ratepayScriptTag.type = "text/javascript";
document.body.appendChild(ratepayScriptTag);
// Load Ratepay script
var ratepayScriptTag = document.createElement('script');
ratepayScriptTag.src = "//d.ratepay.com/" + ratePayId + "/di.js";
ratepayScriptTag.type = "text/javascript";
document.body.appendChild(ratepayScriptTag);
}
}
});
}*/
// Initialises adyen checkout main component with default configuration
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