From 3c8799bd86f92461252ec26c31e20b12a9b2e6c4 Mon Sep 17 00:00:00 2001 From: Paul Canning Date: Thu, 31 Oct 2019 16:00:39 +0000 Subject: [PATCH] Fix Braintree error showing despite successful MOTO order. --- Gateway/Validator/ResponseValidator.php | 8 +++++++- view/adminhtml/templates/payment/script.phtml | 2 +- view/adminhtml/web/js/braintree.js | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Gateway/Validator/ResponseValidator.php b/Gateway/Validator/ResponseValidator.php index 2a52c884..8b376e08 100755 --- a/Gateway/Validator/ResponseValidator.php +++ b/Gateway/Validator/ResponseValidator.php @@ -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')] ]; diff --git a/view/adminhtml/templates/payment/script.phtml b/view/adminhtml/templates/payment/script.phtml index a542bd7d..71b76bd2 100755 --- a/view/adminhtml/templates/payment/script.phtml +++ b/view/adminhtml/templates/payment/script.phtml @@ -20,7 +20,7 @@ $code = $block->escapeHtml($block->getCode()); ], function(Braintree, $) { let config = getPaymentConfig() ?>, payment, - form = $('#payment_form_escapeJs($code) ?>'); + form = $('#payment_form_'); config.active = form.length > 0 && !form.is(':hidden'); payment = new Braintree(config); diff --git a/view/adminhtml/web/js/braintree.js b/view/adminhtml/web/js/braintree.js index 17e51eea..6075a40e 100755 --- a/view/adminhtml/web/js/braintree.js +++ b/view/adminhtml/web/js/braintree.js @@ -234,7 +234,7 @@ define([ * Place order */ placeOrder: function () { - $('#' + this.container).find('[type="submit"]').trigger('click'); + $('#' + this.selector).trigger('realOrder'); }, /** @@ -312,7 +312,7 @@ define([ } } else { this.setPaymentDetails(payload.nonce); - this.placeOrder(); + $('#' + this.container).find('[type="submit"]').trigger('click'); } }.bind(this)); }