diff options
| author | Toufik Benjaa <tbe@odoo.com> | 2018-07-11 17:47:29 +0200 |
|---|---|---|
| committer | Toufik Benjaa <tbe@odoo.com> | 2018-09-19 18:25:32 +0200 |
| commit | 6ed44181d081b3cfd8875dc82e4e155970cc07f5 (patch) | |
| tree | 5449ac99ea4191b9b747918d0d1d8702ebad3cc5 /addons/payment_sips/controllers/main.py | |
| parent | 46dc8ceef90ec5472b1aa4b45509f23d6c3e2624 (diff) | |
[IMP] payment_*: payment acquirers error handling
This commit aims to improve the user experience when using payment acquirers. There currently are no error feedback with some acquirers, which leaves the user wondering what is going on and what is the real status of its payment.
In some cases, the user is currently being redirected to the home page even though the payment has failed. We want to make it more obvious to the user that something unexpected has happened by redirecting to an intermediate page that will provide good feedback on payments status.
Another goal of this commit is to order acquirers by sequence instead of by flow and to select the first acquirer by default. This feature was already implmented in commit fe294fd43e521bd2d339e962f43acf46c3d4cb97, some UI adaptations were needed though.
Related to task #36680
Closes #26958
Diffstat (limited to 'addons/payment_sips/controllers/main.py')
| -rw-r--r-- | addons/payment_sips/controllers/main.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/addons/payment_sips/controllers/main.py b/addons/payment_sips/controllers/main.py index 3af8e2c7b3e..de3e90810ee 100644 --- a/addons/payment_sips/controllers/main.py +++ b/addons/payment_sips/controllers/main.py @@ -16,16 +16,6 @@ class SipsController(http.Controller): _notify_url = '/payment/sips/ipn/' _return_url = '/payment/sips/dpn/' - def _get_return_url(self, **post): - """ Extract the return URL from the data coming from sips. """ - return_url = post.pop('return_url', '') - if not return_url: - Tx = request.env['payment.transaction'] - data = Tx._sips_data_to_object(post.get('Data')) - custom = json.loads(data.pop('returnContext', False) or '{}') - return_url = custom.get('return_url', '/') - return return_url - def sips_validate_data(self, **post): sips = request.env['payment.acquirer'].search([('provider', '=', 'sips')], limit=1) security = sips.sudo()._sips_generate_shasign(post) @@ -47,6 +37,8 @@ class SipsController(http.Controller): '/payment/sips/dpn'], type='http', auth="none", methods=['POST'], csrf=False) def sips_dpn(self, **post): """ Sips DPN """ - return_url = self._get_return_url(**post) - self.sips_validate_data(**post) - return werkzeug.utils.redirect(return_url) + try: + self.sips_validate_data(**post) + except: + pass + return werkzeug.utils.redirect('/payment/process') |
