From 2df9c22d80be82b4ed7ffcd79f858e46c34e6479 Mon Sep 17 00:00:00 2001 From: tbe-odoo Date: Fri, 28 Jul 2017 15:52:34 +0200 Subject: [IMP] Payments & subscriptions: Improved Payments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - When registering a payment token, validating it using a payment of a small amount (~1.50€) followed by a refund allows ensuring that the payment method is valid (i.e. checksumming the card number simple ensure the number is valid but not that the card exists). This commit introduces a generic approach that must be implemented for each acquirer that has tokenization support. This commit also introduces a generic payment token registration/usage template that can be adapted according to one's need. - Introducing a new payment form that handles payment, deletion and adding payment method (only for server2server for the moment). - On /my/payment_method, changed strings 'Payment Acquirers' to 'Payment Methods' which is more clear. - Stripe can now be used to pay subscriptions. --- addons/payment_authorize/controllers/main.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'addons/payment_authorize/controllers') diff --git a/addons/payment_authorize/controllers/main.py b/addons/payment_authorize/controllers/main.py index b42efe817bb..6b0aae9bf6a 100644 --- a/addons/payment_authorize/controllers/main.py +++ b/addons/payment_authorize/controllers/main.py @@ -35,7 +35,31 @@ class AuthorizeController(http.Controller): def authorize_s2s_create_json(self, **kwargs): acquirer_id = int(kwargs.get('acquirer_id')) acquirer = request.env['payment.acquirer'].browse(acquirer_id) - return acquirer.s2s_process(kwargs) + return acquirer.s2s_process(kwargs).id + + @http.route(['/payment/authorize/s2s/create_json_3ds'], type='json', auth='public', csrf=False) + def authorize_s2s_create_json_3ds(self, verify_validity=False, **kwargs): + token = request.env['payment.acquirer'].browse(int(kwargs.get('acquirer_id'))).s2s_process(kwargs) + + if not token: + res = { + 'result': False, + } + return res + + res = { + 'result': True, + 'id': token.id, + 'short_name': token.short_name, + '3d_secure': False, + 'verified': False, + } + + if verify_validity != False: + token.validate() + res['verified'] = token.verified + + return res @http.route(['/payment/authorize/s2s/create'], type='http', auth='public') def authorize_s2s_create(self, **post): -- cgit v1.2.3