Skip to content

Commit 7599e03

Browse files
committed
MAGETWO-72626: [2.3.x][Github] Race condition causing duplicate orders with double-clicks on Braintree "Place Order" button #10767
1 parent f16c0c4 commit 7599e03

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ define([
6161
},
6262

6363
/**
64-
* @returns {Bool}
64+
* @returns {Boolean}
6565
*/
6666
isVaultEnabled: function () {
6767
return this.vaultEnabler.isVaultEnabled();
@@ -142,11 +142,20 @@ define([
142142
return true;
143143
},
144144

145+
/**
146+
* Returns state of place order button
147+
* @returns {Boolean}
148+
*/
149+
isButtonActive: function () {
150+
return this.isActive() && this.isPlaceOrderActionAllowed();
151+
},
152+
145153
/**
146154
* Trigger order placing
147155
*/
148156
placeOrderClick: function () {
149157
if (this.validateCardType()) {
158+
this.isPlaceOrderActionAllowed(false);
150159
$(this.getSelector('submit')).trigger('click');
151160
}
152161
},

app/code/Magento/Braintree/view/frontend/web/template/payment/form.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@
141141
data-bind="
142142
click: placeOrderClick,
143143
attr: {title: $t('Place Order')},
144-
css: {disabled: !isPlaceOrderActionAllowed()},
145-
enable: isActive()
144+
enable: isButtonActive()
146145
"
147146
disabled>
148147
<span data-bind="i18n: 'Place Order'"></span>

0 commit comments

Comments
 (0)