Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 6ae5a06

Browse files
author
olysenko
committed
Merge remote-tracking branch 'origin/MAGETWO-95739' into chaika_november
2 parents 0fa2560 + 64606aa commit 6ae5a06

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ define([
3535
var checkoutConfig = window.checkoutConfig,
3636
validators = [],
3737
observedElements = [],
38-
postcodeElement = null,
3938
postcodeElementName = 'postcode';
4039

4140
validators.push(defaultValidator);
@@ -79,7 +78,11 @@ define([
7978
}
8079

8180
$.each(elements, function (index, field) {
82-
uiRegistry.async(formPath + '.' + field)(self.doElementBinding.bind(self));
81+
var elementBinding = self.doElementBinding.bind(self),
82+
fullPath = formPath + '.' + field,
83+
func = uiRegistry.async(fullPath);
84+
85+
func(elementBinding);
8386
});
8487
},
8588

@@ -101,7 +104,6 @@ define([
101104

102105
if (element.index === postcodeElementName) {
103106
this.bindHandler(element, delay);
104-
postcodeElement = element;
105107
}
106108
},
107109

@@ -136,7 +138,7 @@ define([
136138
if (!formPopUpState.isVisible()) {
137139
clearTimeout(self.validateAddressTimeout);
138140
self.validateAddressTimeout = setTimeout(function () {
139-
self.postcodeValidation();
141+
self.postcodeValidation(element);
140142
self.validateFields();
141143
}, delay);
142144
}
@@ -148,7 +150,7 @@ define([
148150
/**
149151
* @return {*}
150152
*/
151-
postcodeValidation: function () {
153+
postcodeValidation: function (postcodeElement) {
152154
var countryId = $('select[name="country_id"]').val(),
153155
validationResult,
154156
warnMessage;
@@ -178,8 +180,8 @@ define([
178180
*/
179181
validateFields: function () {
180182
var addressFlat = addressConverter.formDataProviderToFlatData(
181-
this.collectObservedData(),
182-
'shippingAddress'
183+
this.collectObservedData(),
184+
'shippingAddress'
183185
),
184186
address;
185187

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ define([
1717
'Magento_Customer/js/customer-data',
1818
'Magento_Checkout/js/action/set-billing-address',
1919
'Magento_Ui/js/model/messageList',
20-
'mage/translate'
20+
'mage/translate',
21+
'Magento_Checkout/js/model/shipping-rates-validator'
2122
],
2223
function (
2324
ko,
@@ -33,7 +34,8 @@ function (
3334
customerData,
3435
setBillingAddressAction,
3536
globalMessageList,
36-
$t
37+
$t,
38+
shippingRatesValidator
3739
) {
3840
'use strict';
3941

@@ -71,6 +73,7 @@ function (
7173
quote.paymentMethod.subscribe(function () {
7274
checkoutDataResolver.resolveBillingAddress();
7375
}, this);
76+
shippingRatesValidator.initFields(this.get('name') + '.form-fields');
7477
},
7578

7679
/**

0 commit comments

Comments
 (0)