Being able to first authorize then capture a payment has several advantages: - Confirm a quotation when the payment is authorized and capture it when the order is shipped. - Review orders before capturing the payment. - Prevent credit card fees in the case of a refund This commit implements this feature for the payment acquirer Adyen. task-2507304 closes odoo/odoo#70591 Related: odoo/upgrade#3088 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
20 lines
700 B
Python
20 lines
700 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import logging
|
|
|
|
from odoo import http
|
|
from odoo.http import request
|
|
from odoo.addons.payment_adyen.controllers.main import AdyenController
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class PosRestaurantAdyenController(AdyenController):
|
|
|
|
@http.route()
|
|
def adyen_webhook(self, **post):
|
|
if post.get('eventCode') in ['CAPTURE', 'AUTHORISATION_ADJUSTMENT'] and post.get('success') != 'true':
|
|
_logger.warning('%s for transaction_id %s failed', post.get('eventCode'), post.get('originalReference'))
|
|
return super(PosRestaurantAdyenController, self).adyen_webhook(**post)
|