Skip to content

Commit 327d73c

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

File tree

3 files changed

+8
-28
lines changed

3 files changed

+8
-28
lines changed

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ public function getConfig()
358358
$output['originCountryCode'] = $this->getOriginCountryCode();
359359
$output['paymentMethods'] = $this->getPaymentMethods();
360360
$output['autocomplete'] = $this->isAutocompleteEnabled();
361-
$output['displayBillingOnPaymentMethod'] = $this->checkoutHelper->isDisplayBillingOnPaymentMethodAvailable();
362361
return $this->configPostProcessor->process($output);
363362
}
364363

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,12 @@ function (
123123
* @return {Boolean}
124124
*/
125125
useShippingAddress: function () {
126-
lastSelectedBillingAddress = quote.billingAddress();
127-
128126
if (this.isAddressSameAsShipping()) {
129127
selectBillingAddress(quote.shippingAddress());
130-
checkoutData.setSelectedBillingAddress(quote.shippingAddress().getKey());
131-
132-
setBillingAddressAction(globalMessageList);
128+
this.updateAddresses();
133129
this.isAddressDetailsVisible(true);
134130
} else {
131+
lastSelectedBillingAddress = quote.billingAddress();
135132
quote.billingAddress(null);
136133
this.isAddressDetailsVisible(false);
137134
}
@@ -173,7 +170,6 @@ function (
173170
checkoutData.setNewCustomerBillingAddress(addressData);
174171
}
175172
}
176-
setBillingAddressAction(globalMessageList);
177173
this.updateAddresses();
178174
},
179175

@@ -241,18 +237,19 @@ function (
241237
* @return {*}
242238
*/
243239
getCountryName: function (countryId) {
240+
if (lastSelectedBillingAddress && lastSelectedBillingAddress["countryId"] != countryId) {
241+
this.updateAddresses();
242+
}
243+
lastSelectedBillingAddress = quote.billingAddress();
244+
244245
return countryData()[countryId] != undefined ? countryData()[countryId].name : ''; //eslint-disable-line
245246
},
246247

247248
/**
248249
* Trigger action to update shipping and billing addresses
249250
*/
250251
updateAddresses: function () {
251-
if (window.checkoutConfig.reloadOnBillingAddress ||
252-
!window.checkoutConfig.displayBillingOnPaymentMethod
253-
) {
254-
setBillingAddressAction(globalMessageList);
255-
}
252+
setBillingAddressAction(globalMessageList);
256253
},
257254

258255
/**

app/code/Magento/Tax/Model/TaxConfigProvider.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public function getConfig()
7272
'includeTaxInGrandTotal' => $this->isTaxDisplayedInGrandTotal(),
7373
'isFullTaxSummaryDisplayed' => $this->isFullTaxSummaryDisplayed(),
7474
'isZeroTaxDisplayed' => $this->taxConfig->displayCartZeroTax(),
75-
'reloadOnBillingAddress' => $this->reloadOnBillingAddress(),
7675
'defaultCountryId' => $this->scopeConfig->getValue(
7776
\Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY,
7877
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
@@ -172,19 +171,4 @@ public function isTaxDisplayedInGrandTotal()
172171
{
173172
return $this->taxConfig->displayCartTaxWithGrandTotal();
174173
}
175-
176-
/**
177-
* Reload totals(taxes) on billing address update
178-
*
179-
* @return bool
180-
*/
181-
protected function reloadOnBillingAddress()
182-
{
183-
$quote = $this->checkoutSession->getQuote();
184-
$configValue = $this->scopeConfig->getValue(
185-
Config::CONFIG_XML_PATH_BASED_ON,
186-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
187-
);
188-
return 'billing' == $configValue || $quote->isVirtual();
189-
}
190174
}

0 commit comments

Comments
 (0)