Skip to content

Commit

Permalink
Fix Braintree error showing despite successful MOTO order.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Canning committed Oct 31, 2019
1 parent 964c349 commit 3c8799b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Gateway/Validator/ResponseValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ static function ($response) {
&& isset($response->transaction)
&& in_array(
$response->transaction->status,
[Transaction::AUTHORIZED, Transaction::SUBMITTED_FOR_SETTLEMENT, Transaction::SETTLING, Transaction::SETTLEMENT_PENDING]
[
Transaction::AUTHORIZED,
Transaction::SUBMITTED_FOR_SETTLEMENT,
Transaction::SETTLING,
Transaction::SETTLEMENT_PENDING
],
true
),
[__('Wrong transaction status')]
];
Expand Down
2 changes: 1 addition & 1 deletion view/adminhtml/templates/payment/script.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $code = $block->escapeHtml($block->getCode());
], function(Braintree, $) {
let config = <?= /* @noEscape */ $block->getPaymentConfig() ?>,
payment,
form = $('#payment_form_<?= $block->escapeJs($code) ?>');
form = $('#payment_form_<?= /* @noEscape */ $code ?>');

config.active = form.length > 0 && !form.is(':hidden');
payment = new Braintree(config);
Expand Down
4 changes: 2 additions & 2 deletions view/adminhtml/web/js/braintree.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ define([
* Place order
*/
placeOrder: function () {
$('#' + this.container).find('[type="submit"]').trigger('click');
$('#' + this.selector).trigger('realOrder');
},

/**
Expand Down Expand Up @@ -312,7 +312,7 @@ define([
}
} else {
this.setPaymentDetails(payload.nonce);
this.placeOrder();
$('#' + this.container).find('[type="submit"]').trigger('click');
}
}.bind(this));
}
Expand Down

0 comments on commit 3c8799b

Please sign in to comment.