From c2c7e58fd64ec3c8d9f043eac61227ef74b98d7f Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 15 Feb 2023 11:58:44 +0100 Subject: [PATCH] Add BasePaymentProvider.refund_matching_id --- doc/development/api/payment.rst | 2 ++ src/pretix/base/payment.py | 10 ++++++++++ src/pretix/plugins/stripe/payment.py | 3 +++ 3 files changed, 15 insertions(+) diff --git a/doc/development/api/payment.rst b/doc/development/api/payment.rst index 65da00d3bd..0dfe43540c 100644 --- a/doc/development/api/payment.rst +++ b/doc/development/api/payment.rst @@ -132,6 +132,8 @@ The provider class .. automethod:: matching_id + .. automethod:: refund_matching_id + .. automethod:: shred_payment_info .. automethod:: cancel_payment diff --git a/src/pretix/base/payment.py b/src/pretix/base/payment.py index d335256aad..bb589d9f37 100644 --- a/src/pretix/base/payment.py +++ b/src/pretix/base/payment.py @@ -957,6 +957,16 @@ class BasePaymentProvider: """ return None + def refund_matching_id(self, refund: OrderRefund): + """ + Will be called to get an ID for matching this refund when comparing pretix records with records of an external + source. This should return the main transaction ID for your API. + + :param refund: The refund in question. + :return: A string or None + """ + return None + class PaymentException(Exception): pass diff --git a/src/pretix/plugins/stripe/payment.py b/src/pretix/plugins/stripe/payment.py index 49f3ddd2b5..baba09c44a 100644 --- a/src/pretix/plugins/stripe/payment.py +++ b/src/pretix/plugins/stripe/payment.py @@ -557,6 +557,9 @@ class StripeMethod(BasePaymentProvider): def matching_id(self, payment: OrderPayment): return payment.info_data.get("id", None) + def refund_matching_id(self, refund: OrderRefund): + return refund.info_data.get('id', None) + def api_payment_details(self, payment: OrderPayment): return { "id": payment.info_data.get("id", None),