From c284bda4b0e48577998f67ed93ea0c61e1cfabf1 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Tue, 13 Aug 2019 12:31:32 +0000 Subject: [PATCH] [IMP] payment: handle pending tx in /pay let the landing page handle the message to display instead of intercepting the state in the controller. --- addons/payment/controllers/portal.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index 773eb111201..9551dad8ea9 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -259,15 +259,11 @@ class WebsitePayment(http.Controller): PaymentProcessing.add_payment_transaction(tx) try: - res = tx.s2s_do_transaction() - if tx.state == 'done': - tx.return_url = return_url or '/website_payment/confirm?tx_id=%d' % tx.id - valid_state = 'authorized' if tx.acquirer_id.capture_manually else 'done' - if not res or tx.state != valid_state: - tx.return_url = '/website_payment/pay?error_msg=%s' % _('Payment transaction failed.') - return request.redirect('/payment/process') + tx.s2s_do_transaction() + tx.return_url = return_url or '/website_payment/confirm?tx_id=%d' % tx.id except Exception as e: - return request.redirect('/payment/process') + _logger.exception(e) + return request.redirect('/payment/process') @http.route(['/website_payment/confirm'], type='http', auth='public', website=True, sitemap=False) def confirm(self, **kw):