summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/controllers/main.py
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2016-08-29 15:50:53 +0200
committerDamien Bouvy <dbo@odoo.com>2016-09-01 15:58:41 +0200
commita2b9b3a6bb39aded694c30620820034f74cd0f77 (patch)
tree56ced8e7fa4882a9377880346f1c9b1b0551da9c /addons/payment_authorize/controllers/main.py
parentba87ff438d1cdf5e1f5c57563a16a17f6eea6529 (diff)
[IMP] payment_authorize: add server2server support
This commit add s2s communication to the Authorize.net payment provider, allowing the user to: - Create a payment token - Charge a payment token - Authorize/capture transactions
Diffstat (limited to 'addons/payment_authorize/controllers/main.py')
-rw-r--r--addons/payment_authorize/controllers/main.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/payment_authorize/controllers/main.py b/addons/payment_authorize/controllers/main.py
index aec2aa1f777..5fc8ba87a69 100644
--- a/addons/payment_authorize/controllers/main.py
+++ b/addons/payment_authorize/controllers/main.py
@@ -2,6 +2,7 @@
import pprint
import logging
import urlparse
+import werkzeug
from odoo import http
from odoo.http import request
@@ -30,3 +31,16 @@ class AuthorizeController(http.Controller):
return request.render('payment_authorize.payment_authorize_redirect', {
'return_url': '%s' % urlparse.urljoin(base_url, return_url)
})
+
+ @http.route(['/payment/authorize/s2s/create_json'], type='json', auth='public')
+ 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)
+
+ @http.route(['/payment/authorize/s2s/create'], type='http', auth='public')
+ def authorize_s2s_create(self, **post):
+ acquirer_id = int(post.get('acquirer_id'))
+ acquirer = request.env['payment.acquirer'].browse(acquirer_id)
+ acquirer.s2s_process(post)
+ return werkzeug.utils.redirect(post.get('return_url', '/'))