diff --git a/doc/development/api/payment.rst b/doc/development/api/payment.rst index 5f097e25d..92d358501 100644 --- a/doc/development/api/payment.rst +++ b/doc/development/api/payment.rst @@ -110,6 +110,8 @@ The provider class .. automethod:: execute_refund + .. automethod:: refund_control_render + .. automethod:: api_payment_details .. automethod:: shred_payment_info diff --git a/src/pretix/base/payment.py b/src/pretix/base/payment.py index f5ebc82a3..0f229c1d8 100644 --- a/src/pretix/base/payment.py +++ b/src/pretix/base/payment.py @@ -651,6 +651,19 @@ class BasePaymentProvider: """ return '' + def refund_control_render(self, request: HttpRequest, refund: OrderRefund) -> str: + """ + Will be called if the *event administrator* views the details of a refund. + + It should return HTML code containing information regarding the current refund + status and, if applicable, next steps. + + The default implementation returns an empty string. + + :param order: The order object + """ + return '' + def payment_refund_supported(self, payment: OrderPayment) -> bool: """ Will be called to check if the provider supports automatic refunding for this @@ -965,6 +978,20 @@ class GiftCardPayment(BasePaymentProvider): def checkout_confirm_render(self, request) -> str: return get_template('pretixcontrol/giftcards/checkout_confirm.html').render({}) + def refund_control_render(self, request, refund) -> str: + from .models import GiftCard + + if 'gift_card' in refund.info_data: + gc = GiftCard.objects.get(pk=refund.info_data.get('gift_card')) + template = get_template('pretixcontrol/giftcards/payment.html') + + ctx = { + 'request': request, + 'event': self.event, + 'gc': gc, + } + return template.render(ctx) + def payment_control_render(self, request, payment) -> str: from .models import GiftCard diff --git a/src/pretix/control/templates/pretixcontrol/order/index.html b/src/pretix/control/templates/pretixcontrol/order/index.html index e20200eb1..6bf7fea6c 100644 --- a/src/pretix/control/templates/pretixcontrol/order/index.html +++ b/src/pretix/control/templates/pretixcontrol/order/index.html @@ -645,12 +645,28 @@ {% endif %} - {% if staff_session %} + {% if r.html_info %} +