[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 <pimodoo@users.noreply.github.com>
Co-authored-by:  nle-odoo <nle@odoo.com>
This commit is contained in:
Goffin Simon
2021-08-12 16:17:03 +00:00
co-authored by nle-odoo
parent 42f8e68e7a
commit 18cc746e8e
@@ -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;