Before this commit, most acquirers needed to run several successive searches for the transaction whose reference was received by a controller in notification data. This is because the security checks run on the notification data require access to the acquirer through the transaction record which was immediately discarded. Starting with this commit, all `*_feedback_data` method are no longer decorated with `api.model` and can use the transaction record they're called on if provided. They are also renamed to `*_notification_data`. task-2737144 closes odoo/odoo#83850 Related: odoo/enterprise#23938 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
24 lines
783 B
Python
24 lines
783 B
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import http
|
|
from odoo.http import request
|
|
|
|
|
|
class PaymentTestController(http.Controller):
|
|
|
|
@http.route('/payment/test/simulate_payment', type='json', auth='public')
|
|
def test_simulate_payment(self, reference, customer_input):
|
|
""" Simulate the response of a payment request.
|
|
|
|
:param str reference: The reference of the transaction
|
|
:param str customer_input: The payment method details
|
|
:return: None
|
|
"""
|
|
fake_api_response = {
|
|
'reference': reference,
|
|
'cc_summary': customer_input[-4:],
|
|
}
|
|
request.env['payment.transaction'].sudo()._handle_notification_data(
|
|
'test', fake_api_response
|
|
)
|