diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-09-17 17:49:09 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-09-17 17:49:09 +0200 |
| commit | 080f8b1f96dec30fd9568a81342b5d20cc9d521a (patch) | |
| tree | 14cecabb2c6502e73d93178bd322722e2e62f07d /addons/payment | |
| parent | c12bd7125a1c64339e02ae0563f667b8de931b3b (diff) | |
| parent | d8ce75466e4a6728cccfc7696a65a399e9cf23f1 (diff) | |
[MERGE] forward port branch saas-12.3 up to d8ce75466e4
Diffstat (limited to 'addons/payment')
| -rw-r--r-- | addons/payment/controllers/portal.py | 12 | ||||
| -rw-r--r-- | addons/payment/models/payment_acquirer.py | 4 | ||||
| -rw-r--r-- | addons/payment/static/src/js/payment_processing.js | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index db9aec543a6..f2b21f20a3c 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -79,7 +79,7 @@ class PaymentProcessing(http.Controller): # populate the returned dictionnary with the transactions data for tx in payment_transaction_ids: message_to_display = tx.acquirer_id[tx.state + '_msg'] if tx.state in ['done', 'pending', 'cancel', 'error'] else None - result['transactions'].append({ + tx_info = { 'reference': tx.reference, 'state': tx.state, 'return_url': tx.return_url, @@ -89,7 +89,9 @@ class PaymentProcessing(http.Controller): 'amount': tx.amount, 'currency': tx.currency_id.name, 'acquirer_provider': tx.acquirer_id.provider, - }) + } + tx_info.update(tx._get_processing_info()) + result['transactions'].append(tx_info) tx_to_process = payment_transaction_ids.filtered(lambda x: x.state == 'done' and x.is_processed is False) try: @@ -258,11 +260,7 @@ class WebsitePayment(http.Controller): 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.') + tx.return_url = return_url or '/website_payment/confirm?tx_id=%d' % tx.id return request.redirect('/payment/process') except Exception as e: return request.redirect('/payment/process') diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 7b747de0ce6..62d35059978 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -661,6 +661,10 @@ class PaymentTransaction(models.Model): transactions = self.filtered(lambda t: t.state != 'draft') return transactions and transactions[0] or transactions + def _get_processing_info(self): + """ Extensible method for providers if they need specific fields/info regarding a tx in the payment processing page. """ + return dict() + @api.multi def _get_payment_transaction_sent_message(self): self.ensure_one() diff --git a/addons/payment/static/src/js/payment_processing.js b/addons/payment/static/src/js/payment_processing.js index ec1028188ec..0424614fe14 100644 --- a/addons/payment/static/src/js/payment_processing.js +++ b/addons/payment/static/src/js/payment_processing.js @@ -94,7 +94,7 @@ odoo.define('payment.processing', function (require) { return nbTx; } // if there's only one tx to manage - if(countTxInState(['tx_done', 'tx_error']) === 1) { + if(countTxInState(['tx_done', 'tx_error', 'tx_pending']) === 1) { var tx = render_values['tx_done'][0] || render_values['tx_error'][0]; if (tx) { window.location = tx.return_url; |
