summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/controllers
diff options
context:
space:
mode:
authortbe-odoo <tbe@odoo.com>2017-07-28 15:52:34 +0200
committerDamien Bouvy <dbo@odoo.com>2017-08-14 08:30:59 +0200
commit2df9c22d80be82b4ed7ffcd79f858e46c34e6479 (patch)
tree5f3d7d68c4fc4e461e1a3f235266b14c23d0340a /addons/payment_authorize/controllers
parentc089d39a668fa6ab1f5d7867747da19d0b75f035 (diff)
[IMP] Payments & subscriptions: Improved Payments
- 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.
Diffstat (limited to 'addons/payment_authorize/controllers')
-rw-r--r--addons/payment_authorize/controllers/main.py26
1 files changed, 25 insertions, 1 deletions
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):