summaryrefslogtreecommitdiff
path: root/addons/payment_test/controllers/main.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/payment_test/controllers/main.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/payment_test/controllers/main.py')
-rw-r--r--addons/payment_test/controllers/main.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/payment_test/controllers/main.py b/addons/payment_test/controllers/main.py
new file mode 100644
index 00000000..72ec4a04
--- /dev/null
+++ b/addons/payment_test/controllers/main.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import http, _
+from odoo.http import request
+from odoo.exceptions import UserError
+
+
+class PaymentTestController(http.Controller):
+
+ @http.route(['/payment/test/s2s/create_json_3ds'], type='json', auth='public', csrf=False)
+ def payment_test_s2s_create_json_3ds(self, verify_validity=False, **kwargs):
+ if not kwargs.get('partner_id'):
+ kwargs = dict(kwargs, partner_id=request.env.user.partner_id.id)
+ acquirer = request.env['payment.acquirer'].browse(int(kwargs.get('acquirer_id')))
+ if acquirer.state != 'test':
+ raise UserError(_("Please do not use this acquirer for a production environment!"))
+ token = acquirer.s2s_process(kwargs)
+
+ return {
+ 'result': True,
+ 'id': token.id,
+ 'short_name': 'short_name',
+ '3d_secure': False,
+ 'verified': True,
+ }