Before this commit, it was not possible for a Buckaroo acquirer to accept asynchronous notifications for payment updates. This is important because, without them, an acquirer can only rely on synchronous notifications (i.e. redirect requests from the provider's checkout page) which can be unreliable and do not allow receiving status updates, should payments take a bit longer to be confirmed by the provider. This commit adds a webhook controller whose route can be configured in Buckaroo Plaza (backend) to send asynchronous notifications. task-2687586 closes odoo/odoo#82922 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com> Co-authored-by: Lucie Van Nieuwenhuyze <luvn@odoo.com>
46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.payment.tests.common import PaymentCommon
|
|
|
|
|
|
class BuckarooCommon(PaymentCommon):
|
|
|
|
SYNC_NOTIFICATION_DATA = {
|
|
'brq_payment': 'ABCDEF0123456789ABCDEF0123456789',
|
|
'brq_payment_method': 'paypal',
|
|
'brq_statuscode': '190', # confirmed
|
|
'brq_statusmessage': 'Transaction successfully processed',
|
|
'brq_invoicenumber': 'Test Transaction', # Shamefully copy-pasted from payment
|
|
'brq_amount': '1111.11',
|
|
'brq_currency': 'USD',
|
|
'brq_timestamp': '2022-01-01 12:00:00',
|
|
'brq_transactions': '0123456789ABCDEF0123456789ABCDEF',
|
|
'brq_signature': '5d389aa4f563cd99666a2e6bef79da3d4a32eb50',
|
|
}
|
|
|
|
ASYNC_NOTIFICATION_DATA = {
|
|
'brq_transactions': '0123456789ABCDEF0123456789ABCDEF',
|
|
'brq_transaction_method': 'paypal',
|
|
'brq_statuscode': '190', # confirmed
|
|
'brq_statusmessage': 'Transaction successfully processed',
|
|
'brq_invoicenumber': 'Test Transaction', # Shamefully copy-pasted from payment
|
|
'brq_amount': '1111.11',
|
|
'brq_currency': 'USD',
|
|
'brq_timestamp': '2022-01-01 12:00:00',
|
|
'brq_transaction_type': 'V010',
|
|
'brq_signature': '9ba976c3a6a3d2d1b5b58d3aa8c2c6fe269a9c27',
|
|
}
|
|
|
|
@classmethod
|
|
def setUpClass(cls, chart_template_ref=None):
|
|
super().setUpClass(chart_template_ref=chart_template_ref)
|
|
|
|
cls.buckaroo = cls._prepare_acquirer('buckaroo', update_values={
|
|
'buckaroo_website_key': 'dummy',
|
|
'buckaroo_secret_key': 'test_key_123',
|
|
})
|
|
|
|
# Override defaults
|
|
cls.acquirer = cls.buckaroo
|
|
cls.currency = cls.currency_euro
|