Skip to content

Commit 8f29e52

Browse files
committed
ACP2E-862: Cash on Delivery method is visible even if it is not allowed for that particular country
1 parent dfb6252 commit 8f29e52

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function (
4242
'use strict';
4343

4444
var lastSelectedBillingAddress = null,
45-
addressUpadated = false,
45+
addressUpdated = false,
4646
addressEdited = false,
4747
countryData = customerData.get('directory-data'),
4848
addressOptions = addressList().filter(function (address) {
@@ -123,17 +123,15 @@ function (
123123
* @return {Boolean}
124124
*/
125125
useShippingAddress: function () {
126-
if (this.isAddressSameAsShipping()) {
127-
addressUpadated = true;
126+
lastSelectedBillingAddress = quote.billingAddress();
128127

128+
if (this.isAddressSameAsShipping()) {
129129
selectBillingAddress(quote.shippingAddress());
130130
checkoutData.setSelectedBillingAddress(quote.shippingAddress().getKey());
131-
setBillingAddressAction(globalMessageList);
132131

133-
this.updateAddresses();
132+
setBillingAddressAction(globalMessageList);
134133
this.isAddressDetailsVisible(true);
135134
} else {
136-
lastSelectedBillingAddress = quote.billingAddress();
137135
quote.billingAddress(null);
138136
this.isAddressDetailsVisible(false);
139137
}
@@ -148,7 +146,7 @@ function (
148146
updateAddress: function () {
149147
var addressData, newBillingAddress;
150148

151-
addressUpadated = true;
149+
addressUpdated = true;
152150

153151
if (this.selectedAddress() && !this.isAddressFormVisible()) {
154152
selectBillingAddress(this.selectedAddress());
@@ -183,7 +181,7 @@ function (
183181
* Edit address action
184182
*/
185183
editAddress: function () {
186-
addressUpadated = false;
184+
addressUpdated = false;
187185
addressEdited = true;
188186
lastSelectedBillingAddress = quote.billingAddress();
189187
quote.billingAddress(null);
@@ -194,7 +192,7 @@ function (
194192
* Cancel address edit action
195193
*/
196194
cancelAddressEdit: function () {
197-
addressUpadated = true;
195+
addressUpdated = true;
198196
this.restoreBillingAddress();
199197

200198
if (quote.billingAddress()) {
@@ -219,7 +217,7 @@ function (
219217
* Check if Billing Address Changes should be canceled
220218
*/
221219
needCancelBillingAddressChanges: function () {
222-
if (addressEdited && !addressUpadated) {
220+
if (addressEdited && !addressUpdated) {
223221
this.cancelAddressEdit();
224222
}
225223
},

0 commit comments

Comments
 (0)