We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 9d870e65 authored by attilak's avatar attilak

only trigger new paymentMethods call when the country has changed

parent d5518aea
...@@ -32,7 +32,7 @@ define( ...@@ -32,7 +32,7 @@ define(
/** /**
* 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 (callback = null) {
var self = this; var self = this;
// retrieve payment methods // retrieve payment methods
...@@ -56,7 +56,9 @@ define( ...@@ -56,7 +56,9 @@ define(
).done( ).done(
function (response) { function (response) {
self.setPaymentMethods(response); self.setPaymentMethods(response);
callback(); if (callback !== null) {
callback();
}
} }
).fail( ).fail(
function (response) { function (response) {
......
...@@ -130,8 +130,17 @@ define( ...@@ -130,8 +130,17 @@ define(
}); });
self.messageComponents = messageComponents; self.messageComponents = messageComponents;
quote.shippingAddress.subscribe( function(address) { var shippingAddressCopuntryCode = quote.shippingAddress().countryId;
adyenPaymentService.retrieveAvailablePaymentMethods(); console.log(shippingAddressCopuntryCode);
quote.shippingAddress.subscribe( function(shippingAddress) {
console.log(shippingAddressCopuntryCode);
console.log(shippingAddress.countryId);
if (shippingAddressCopuntryCode != shippingAddress.countryId) {
adyenPaymentService.retrieveAvailablePaymentMethods();
shippingAddressCopuntryCode = shippingAddress.countryId;
}
}); });
fullScreenLoader.stopLoader(); fullScreenLoader.stopLoader();
......
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