From 91d4c3cc4040f4d507e716fb1a125e2bf7e96502 Mon Sep 17 00:00:00 2001 From: "Antoine Vandevenne (anv)" Date: Mon, 2 Aug 2021 14:28:18 +0000 Subject: [PATCH] [FIX] payment_authorize: confirm refunded validation transactions As validation transactions are authorized rather than captured, they are refunded with a void request. Before this commit, a voided validation transaction was mistakenly flagged as canceled while it should have been confirmed. This commit makes the distinction between a voided regular transaction and a validation transaction. task-2612977 closes odoo/odoo#74581 Signed-off-by: Antoine Vandevenne (anv) --- addons/payment_authorize/models/payment_transaction.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/payment_authorize/models/payment_transaction.py b/addons/payment_authorize/models/payment_transaction.py index b12500d5dca..cb4fdc60cc2 100644 --- a/addons/payment_authorize/models/payment_transaction.py +++ b/addons/payment_authorize/models/payment_transaction.py @@ -132,7 +132,10 @@ class PaymentTransaction(models.Model): if self.tokenize and not self.token_id: self._authorize_tokenize() elif status_type == 'void': - self._set_canceled() + if self.operation == 'validation': # Validation txs are authorized and then voided + self._set_done() # If the refund went through, the validation tx is confirmed + else: + self._set_canceled() elif status_code == '2': # Declined self._set_canceled() elif status_code == '4': # Held for Review