From 18cc746e8e36d50c313ab79720b0a6bc751aeac3 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 11 Aug 2021 14:59:24 +0000 Subject: [PATCH] [FIX] pos_adyen: Connection failure during Adyen payment Steps to reproduce the bug: When making a payment intent from Adyen terminal with the POS, the payment intent was validated by Adyen but Odoo stopped polling because a connection failure happened and then on retry it made second payment even if the first one was successful. Fix: Now after a failure, it will try to poll again the last transaction (with get_latest_adyen_status) and set the payment as successful or cancelled based on the last response. opw:2587625 closes odoo/odoo#75053 X-original-commit: dcb1e2b4823c917f4c547d2cad604187f893948d Signed-off-by: pimodoo Co-authored-by: nle-odoo --- addons/pos_adyen/static/src/js/payment_adyen.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/pos_adyen/static/src/js/payment_adyen.js b/addons/pos_adyen/static/src/js/payment_adyen.js index 2d53c46146e..9c9c43164a0 100644 --- a/addons/pos_adyen/static/src/js/payment_adyen.js +++ b/addons/pos_adyen/static/src/js/payment_adyen.js @@ -118,6 +118,12 @@ var PaymentAdyen = PaymentInterface.extend({ return Promise.resolve(); } + + if (this.poll_response_error) { + this.poll_response_error = false; + return self._adyen_handle_response({}); + } + var data = this._adyen_pay_data(); return this._call_adyen(data).then(function (data) { @@ -185,6 +191,7 @@ var PaymentAdyen = PaymentInterface.extend({ shadow: true, }).catch(function (data) { reject(); + self.poll_response_error = true; return self._handle_odoo_connection_failure(data); }).then(function (status) { var notification = status.latest_response;