From ace3c1e53c4edbc0f8ea3ca6e7619863d781e5af Mon Sep 17 00:00:00 2001 From: Laura Schauer Date: Thu, 30 Jun 2022 06:49:29 +0000 Subject: [PATCH] [FIX] payment: Standardize validation transaction reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the reference of a validation transaction followed this format: “validation-20220222072710”, which did not match the standard format for refund transactions (”R-S000001”). Moreover, some providers limit the length of transaction references which forced us to truncate the quite long reference. With this commit, future validation transactions will have a reference of the format: “V-20220222072710”. task-2830826 closes odoo/odoo#94921 Related: odoo/enterprise#29076 Signed-off-by: Antoine Vandevenne (anv) --- addons/payment/controllers/portal.py | 2 +- addons/payment/tests/test_flows.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index 1f9d0d4fc39..e6a6277355c 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -206,7 +206,7 @@ class PaymentPortal(portal.CustomerPortal): rendering_context = { 'acquirers': acquirers_sudo, 'tokens': tokens_sudo, - 'reference_prefix': payment_utils.singularize_reference_prefix(prefix='validation'), + 'reference_prefix': payment_utils.singularize_reference_prefix(prefix='V'), 'partner_id': partner_sudo.id, 'access_token': access_token, 'transaction_route': '/payment/transaction', diff --git a/addons/payment/tests/test_flows.py b/addons/payment/tests/test_flows.py index d1da3048da6..095bff4ec33 100644 --- a/addons/payment/tests/test_flows.py +++ b/addons/payment/tests/test_flows.py @@ -158,7 +158,7 @@ class TestFlows(PaymentHttpCommon): @freeze_time("2011-11-02 12:00:21") def _test_validation(self, flow): # Fixed with freezegun - expected_reference = 'validation-20111102120021' + expected_reference = 'V-20111102120021' validation_amount = self.acquirer._get_validation_amount() validation_currency = self.acquirer._get_validation_currency()