We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday 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,8 +56,10 @@ define(
).done(
function (response) {
self.setPaymentMethods(response);
if (callback !== null) {
callback();
}
}
).fail(
function (response) {
self.setPaymentMethods([]);
......
......@@ -130,8 +130,17 @@ define(
});
self.messageComponents = messageComponents;
quote.shippingAddress.subscribe( function(address) {
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