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(
/**
* Retrieve the list of available payment methods from the server
*/
retrieveAvailablePaymentMethods: function (callback) {
retrieveAvailablePaymentMethods: function (callback = null) {
var self = this;
// retrieve payment methods
......@@ -56,7 +56,9 @@ define(
).done(
function (response) {
self.setPaymentMethods(response);
callback();
if (callback !== null) {
callback();
}
}
).fail(
function (response) {
......
......@@ -130,8 +130,17 @@ define(
});
self.messageComponents = messageComponents;
quote.shippingAddress.subscribe( function(address) {
adyenPaymentService.retrieveAvailablePaymentMethods();
var shippingAddressCopuntryCode = quote.shippingAddress().countryId;
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();
......
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