[IMP] payment: handle pending tx in /pay

let the landing page handle the message to display instead of
intercepting the state in the controller.
This commit is contained in:
Damien Bouvy
2019-08-16 15:52:40 +00:00
parent 45c2e06095
commit c284bda4b0
+4 -8
View File
@@ -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):