Before this commit, it was not possible to refund a payment from Odoo. Users had to go through the payment acquirer's backend and update the payment accordingly in Odoo. With this commit, refunds are made available in Odoo directly from the payment form, for acquirers that support them. Acquirer can either only support full refunds or also support partial refunds. As of now, the only acquirer allowing refunds is Adyen, with partial refund support. task-2527891 closes odoo/odoo#70881 Related: odoo/upgrade#2689 Related: odoo/enterprise#19829 Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
# Endpoints of the API.
|
|
# See https://docs.adyen.com/api-explorer/#/CheckoutService/v53/overview for Checkout API
|
|
# See https://docs.adyen.com/api-explorer/#/Recurring/v49/overview for Recurring API
|
|
API_ENDPOINT_VERSIONS = {
|
|
'/disable': 49, # Recurring API
|
|
'/originKeys': 53, # Checkout API
|
|
'/payments': 53, # Checkout API
|
|
'/payments/details': 53, # Checkout API
|
|
'/payments/{}/refunds': 67, # Checkout API
|
|
'/paymentMethods': 53, # Checkout API
|
|
}
|
|
|
|
# Adyen-specific mapping of currency codes in ISO 4217 format to the number of decimals.
|
|
# Only currencies for which Adyen does not follow the ISO 4217 norm are listed here.
|
|
# See https://docs.adyen.com/development-resources/currency-codes
|
|
CURRENCY_DECIMALS = {
|
|
'CLP': 2,
|
|
'CVE': 0,
|
|
'IDR': 0,
|
|
'ISK': 2,
|
|
}
|
|
|
|
# Mapping of transaction states to Adyen result codes.
|
|
# See https://docs.adyen.com/checkout/payment-result-codes for the exhaustive list of result codes.
|
|
RESULT_CODES_MAPPING = {
|
|
'pending': (
|
|
'ChallengeShopper', 'IdentifyShopper', 'Pending', 'PresentToShopper', 'Received',
|
|
'RedirectShopper'
|
|
),
|
|
'done': ('Authorised',),
|
|
'cancel': ('Cancelled',),
|
|
'error': ('Error',),
|
|
'refused': ('Refused',),
|
|
}
|