Skip to content

Commit 0642bf7

Browse files
committed
MC-37820: [UX] Payment methods list is not refreshed on billing address change
1 parent 0a2353f commit 0642bf7

File tree

3 files changed

+6
-72
lines changed

3 files changed

+6
-72
lines changed

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,5 @@
6565
<element name="billingAddressSelectShared" type="select" selector=".checkout-billing-address select[name='billing_address_id']"/>
6666
<element name="discount" type="block" selector="tr.totals.discount"/>
6767
<element name="discountPrice" type="text" selector=".discount .price"/>
68-
<element name="paymentMethodName" type="text" selector="//div[contains(@class, 'payment-method-title')]//span[contains(text(),'{{paymentMethodTitle}}')]" timeout="30" parameterized="true"/>
6968
</section>
7069
</sections>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithDifferentShippingAndBillingAddressWithRestrictedCountriesForPaymentTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<argument name="customerVar" value="CustomerEntityOne"/>
4646
<argument name="customerAddressVar" value="CustomerAddressSimple"/>
4747
</actionGroup>
48-
<dontSeeElement selector="{{CheckoutPaymentSection.paymentMethodName('Check / Money order')}}" stepKey="assertNoCheckMoneyOrderPaymentMethod"/>
48+
<dontSee selector="{{CheckoutPaymentSection.paymentMethodTitle}}" userInput="Check / Money order" stepKey="assertNoCheckMoneyOrderPaymentMethod"/>
4949
<waitForElementVisible selector="{{CheckoutPaymentSection.billingAddressNotSameBankTransferCheckbox}}" stepKey="waitForBillingAddressNotSameAsShippingCheckbox"/>
5050
<uncheckOption selector="{{CheckoutPaymentSection.billingAddressNotSameBankTransferCheckbox}}" stepKey="uncheckSameBillingAndShippingAddress"/>
5151
<conditionalClick selector="{{CheckoutPaymentSection.editAddress}}" dependentSelector="{{CheckoutShippingSection.editAddressButton}}" visible="true" stepKey="clickEditBillingAddressButton"/>
@@ -55,6 +55,6 @@
5555
<actionGroup ref="StorefrontFillBillingAddressActionGroup" stepKey="fillBillingAddress"/>
5656
<click selector="{{CheckoutPaymentSection.update}}" stepKey="clickOnUpdateButton"/>
5757
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear" />
58-
<seeElement selector="{{CheckoutPaymentSection.paymentMethodName('Check / Money order')}}" stepKey="assertCheckMoneyOrderPaymentMethod"/>
58+
<see selector="{{CheckoutPaymentSection.paymentMethodTitle}}" userInput="Check / Money order" stepKey="sdadasdasdsdaasd"/>
5959
</test>
6060
</tests>

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

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ define([
1818
'Magento_Checkout/js/action/set-billing-address',
1919
'Magento_Ui/js/model/messageList',
2020
'mage/translate',
21-
'Magento_Checkout/js/model/billing-address-postcode-validator',
22-
'mage/storage',
23-
'Magento_Checkout/js/model/resource-url-manager',
24-
'Magento_Checkout/js/model/payment-service',
25-
'Magento_Checkout/js/model/payment/method-converter',
26-
'Magento_Checkout/js/model/shipping-save-processor/payload-extender',
27-
'Magento_Checkout/js/model/full-screen-loader',
28-
'Magento_Checkout/js/model/error-processor'
21+
'Magento_Checkout/js/model/billing-address-postcode-validator'
2922
],
3023
function (
3124
ko,
@@ -42,14 +35,7 @@ function (
4235
setBillingAddressAction,
4336
globalMessageList,
4437
$t,
45-
billingAddressPostcodeValidator,
46-
storage,
47-
resourceUrlManager,
48-
paymentService,
49-
methodConverter,
50-
payloadExtender,
51-
fullScreenLoader,
52-
errorProcessor
38+
billingAddressPostcodeValidator
5339
) {
5440
'use strict';
5541

@@ -179,7 +165,7 @@ function (
179165
checkoutData.setNewCustomerBillingAddress(addressData);
180166
}
181167
}
182-
this.updatePaymentMethods();
168+
setBillingAddressAction(globalMessageList);
183169
this.updateAddresses();
184170
},
185171

@@ -237,11 +223,7 @@ function (
237223
* Trigger action to update shipping and billing addresses
238224
*/
239225
updateAddresses: function () {
240-
if (window.checkoutConfig.reloadOnBillingAddress ||
241-
!window.checkoutConfig.displayBillingOnPaymentMethod
242-
) {
243-
setBillingAddressAction(globalMessageList);
244-
}
226+
setBillingAddressAction(globalMessageList);
245227
},
246228

247229
/**
@@ -304,53 +286,6 @@ function (
304286
}
305287

306288
return label;
307-
},
308-
309-
/**
310-
* Updates payment methods list
311-
*
312-
* @returns {*}
313-
*/
314-
updatePaymentMethods: function () {
315-
var payload;
316-
317-
if (quote.shippingMethod() !== null) {
318-
payload = {
319-
addressInformation: {
320-
'shipping_address': quote.shippingAddress(),
321-
'billing_address': quote.billingAddress(),
322-
'shipping_method_code': quote.shippingMethod()['method_code'],
323-
'shipping_carrier_code': quote.shippingMethod()['carrier_code']
324-
}
325-
};
326-
} else {
327-
payload = {
328-
addressInformation: {
329-
'shipping_address': quote.shippingAddress(),
330-
'billing_address': quote.billingAddress()
331-
}
332-
};
333-
}
334-
335-
payloadExtender(payload);
336-
337-
fullScreenLoader.startLoader();
338-
339-
return storage.post(
340-
resourceUrlManager.getUrlForSetShippingInformation(quote),
341-
JSON.stringify(payload)
342-
).done(
343-
function (response) {
344-
quote.setTotals(response.totals);
345-
paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
346-
fullScreenLoader.stopLoader();
347-
}
348-
).fail(
349-
function (response) {
350-
errorProcessor.process(response);
351-
fullScreenLoader.stopLoader();
352-
}
353-
);
354289
}
355290
});
356291
});

0 commit comments

Comments
 (0)