summaryrefslogtreecommitdiff
path: root/addons/payment_sips/controllers/main.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2016-07-05 14:20:32 +0200
committerThibault Delavallée <tde@openerp.com>2016-07-06 15:10:48 +0200
commit28ca53c70e67d446bca3f0864fa90365b4d92300 (patch)
tree93043cba6e167de5d02cbc37af1d213d42e20f39 /addons/payment_sips/controllers/main.py
parentd70d6c3ceef41ed616e0088ecea1d4de3ce1aa7d (diff)
[CLN] payment_sips: cleaning and guidelines
As this module is already in new API only small linting is performed.
Diffstat (limited to 'addons/payment_sips/controllers/main.py')
-rw-r--r--addons/payment_sips/controllers/main.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/addons/payment_sips/controllers/main.py b/addons/payment_sips/controllers/main.py
index 0bf4a5f52b3..41ad8508210 100644
--- a/addons/payment_sips/controllers/main.py
+++ b/addons/payment_sips/controllers/main.py
@@ -4,8 +4,8 @@ import json
import logging
import werkzeug
-from openerp import http
-from openerp.http import request
+from odoo import http
+from odoo.http import request
_logger = logging.getLogger(__name__)
@@ -18,27 +18,20 @@ class SipsController(http.Controller):
""" Extract the return URL from the data coming from sips. """
return_url = post.pop('return_url', '')
if not return_url:
- tx_obj = request.registry['payment.transaction']
- data = tx_obj._sips_data_to_object(post.get('Data'))
+ 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):
- res = False
- env = request.env
- tx_obj = env['payment.transaction']
- acquirer_obj = env['payment.acquirer']
-
- sips = acquirer_obj.search([('provider', '=', 'sips')], limit=1)
-
+ sips = request.env['payment.acquirer'].search([('provider', '=', 'sips')], limit=1)
security = sips._sips_generate_shasign(post)
if security == post['Seal']:
_logger.debug('Sips: validated data')
- res = tx_obj.sudo().form_feedback(post, 'sips')
- else:
- _logger.warning('Sips: data are corrupted')
- return res
+ return request.env['payment.transaction'].sudo().form_feedback(post, 'sips')
+ _logger.warning('Sips: data are corrupted')
+ return False
@http.route([
'/payment/sips/ipn/'],