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,14 +71,16 @@ define( ...@@ -71,14 +71,16 @@ 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 ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
var dfValueRatePay = self.getRatePayDeviceIdentToken(); var dfValueRatePay = self.getRatePayDeviceIdentToken();
...@@ -94,8 +96,7 @@ define( ...@@ -94,8 +96,7 @@ define(
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