File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
app/code/Magento/Braintree/view/frontend/web/js/view/payment Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ define([
117
117
options . bin = context . paymentPayload . details . bin ;
118
118
}
119
119
120
- if ( shippingAddress ) {
120
+ if ( shippingAddress && this . isValidShippingAddress ( shippingAddress ) ) {
121
121
options . additionalInformation = {
122
122
shippingGivenName : shippingAddress . firstname ,
123
123
shippingSurname : shippingAddress . lastname ,
@@ -206,6 +206,25 @@ define([
206
206
}
207
207
208
208
return false ;
209
+ } ,
210
+
211
+ /**
212
+ * Validate shipping address
213
+ *
214
+ * @param {Object } shippingAddress
215
+ * @return {Boolean }
216
+ */
217
+ isValidShippingAddress : function ( shippingAddress ) {
218
+ var isValid = false ;
219
+
220
+ // check that required fields are not empty
221
+ if ( shippingAddress . firstname && shippingAddress . lastname && shippingAddress . telephone &&
222
+ shippingAddress . street && shippingAddress . city && shippingAddress . regionCode &&
223
+ shippingAddress . postcode && shippingAddress . countryId ) {
224
+ isValid = true ;
225
+ }
226
+
227
+ return isValid ;
209
228
}
210
229
} ;
211
230
} ) ;
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ define(
91
91
} )
92
92
. then ( function ( hostedFieldsInstance ) {
93
93
self . hostedFieldsInstance = hostedFieldsInstance ;
94
- self . isPlaceOrderActionAllowed ( true ) ;
94
+ self . isPlaceOrderActionAllowed ( false ) ;
95
95
self . initFormValidationEvents ( hostedFieldsInstance ) ;
96
96
97
97
return self . hostedFieldsInstance ;
You can’t perform that action at this time.
0 commit comments