From f0d26f1a87258cf753cc059aa5840febfeaece4f Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Tue, 15 Dec 2020 13:02:25 +0000 Subject: [PATCH] [FIX] point_of_sale: Electronic payment cancel might fail With Worldline, the cancel command fails when the card was already inserted. closes odoo/odoo#67560 Taskid: 2415526 X-original-commit: c71f71fab63d2ccb1faeccbe54425f5b0fb488f0 Signed-off-by: pimodoo --- .../static/src/js/Screens/PaymentScreen/PaymentScreen.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js index 7242ea158cf..e5dca209f9a 100644 --- a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js @@ -332,10 +332,11 @@ odoo.define('point_of_sale.PaymentScreen', function (require) { async _sendPaymentCancel({ detail: line }) { const payment_terminal = line.payment_method.payment_terminal; line.set_payment_status('waitingCancel'); - try { - payment_terminal.send_payment_cancel(this.currentOrder, line.cid); - } finally { + const isCancelSuccessful = await payment_terminal.send_payment_cancel(this.currentOrder, line.cid); + if (isCancelSuccessful) { line.set_payment_status('retry'); + } else { + line.set_payment_status('waitingCard'); } } async _sendPaymentReverse({ detail: line }) {