Files
odoo_source/addons/payment_test/controllers/main.py
T
Aurélien Warnon e7c4761464 [ADD] payment_test: add a payment acquirer to be used for testing only
PURPOSE

Test frontend and UI tools of eLearning.

SPECIFICATIONS

This new module implements a simple test payment acquirer in order to allow
testing successful payments behaviors, notably on eCommerce. Its usage is
prevented in other state then test to avoid any potential misuse.

LINKS

Task ID 1937768
2019-08-28 13:27:59 +00:00

27 lines
990 B
Python

# -*- 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,
}