diff --git a/doc/development/api/payment.rst b/doc/development/api/payment.rst index 46af36590d..0c6a31637a 100644 --- a/doc/development/api/payment.rst +++ b/doc/development/api/payment.rst @@ -106,6 +106,8 @@ The provider class .. automethod:: payment_control_render + .. automethod:: payment_control_render_short + .. automethod:: payment_refund_supported .. automethod:: payment_partial_refund_supported diff --git a/src/pretix/base/payment.py b/src/pretix/base/payment.py index 2da96dbc82..4c4700ed20 100644 --- a/src/pretix/base/payment.py +++ b/src/pretix/base/payment.py @@ -712,6 +712,18 @@ class BasePaymentProvider: """ return '' + def payment_control_render_short(self, payment: OrderPayment) -> str: + """ + Will be called if the *event administrator* performs an action on the payment. Should + return a very short version of the payment method. Usually, this should return e.g. + a transaction ID or account identifier, but no information on status, dates, etc. + + The default implementation falls back to payment_presa_elrender. + + :param order: The order object + """ + return self.payment_presale_render(payment) + def refund_control_render(self, request: HttpRequest, refund: OrderRefund) -> str: """ Will be called if the *event administrator* views the details of a refund. diff --git a/src/pretix/control/templates/pretixcontrol/order/refund_choose.html b/src/pretix/control/templates/pretixcontrol/order/refund_choose.html index 05c91a3559..ee77a4949f 100644 --- a/src/pretix/control/templates/pretixcontrol/order/refund_choose.html +++ b/src/pretix/control/templates/pretixcontrol/order/refund_choose.html @@ -17,16 +17,23 @@
{% csrf_token %} -
+
{% trans "How should the refund be sent?" %} +

+ {% blocktrans trimmed %} + Any payments that you selected for automatical refunds will be immediately communicate the refund + request to the respective payment provider. Manual refunds will be created as pending refunds, you + can then later mark them as done once you actually transferred the money back to the customer. + {% endblocktrans %} +

+

{% trans "Refund to original payment method" %}

- - - + + @@ -34,11 +41,8 @@ {% for p in payments %} - - - + + {% endfor %} + +
#{% trans "Payment confirmation date" %}{% trans "Payment method" %}{% trans "Payment" %}{% trans "Payment details" %} {% trans "Amount not refunded" %} {% trans "Refund" %}
{{ p.full_id }}{{ p.payment_date|date:"SHORT_DATETIME_FORMAT" }} - {{ p.payment_provider.verbose_name }} - {{ p.full_id }}
{{ p.payment_date|date:"SHORT_DATETIME_FORMAT" }}
{{ p.payment_provider.verbose_name }}
{{ p.html_info|safe }} {{ p.available_amount|money:request.event.currency }} {% if p.partial_refund_possible %} @@ -46,9 +50,9 @@
@@ -68,59 +72,67 @@
+
+ +

{% trans "Refund to a different payment method" %}

+
+ + + + + + + + {% for prov, form in new_refunds %} - - - {% endfor %} - - - - - - - - -
{% trans "Payment method" %}{% trans "Refund" %}
- {{ prov.verbose_name }} + + {{ prov.verbose_name }} + {% trans "Automatically refund" context "amount_label" %}
+ placeholder="{{ 0|floatformat:2 }}" + title="" class="form-control"> {{ request.event.currency }} -

+ +
{{ form|safe }}
{% trans "Transfer to other order" %} {% trans "Transfer" context "amount_label" %}
+ title="" class="form-control" placeholder="{{ 0|floatformat:2 }}"> {{ request.event.currency }}
{% trans "to" context "order_label" %} + value="" title="" class="form-control">
{% trans "Create a new gift card" %}
{% trans "Manual refund" %} {% trans "Manually refund" context "amount_label" %}
{{ request.event.currency }} -
-
-

- {% blocktrans trimmed %} - Any payments that you selected for automatical refunds will be immediately communicate the refund - request to the respective payment provider. Manual refunds will be created as pending refunds, you - can then later mark them as done once you actually transferred the money back to the customer. - {% endblocktrans %} -

 

@@ -187,7 +189,7 @@
+ value="{{ comment|default:"" }}">
{% trans "May be shown to the end user or used e.g. as part of a payment reference." %}
diff --git a/src/pretix/control/views/orders.py b/src/pretix/control/views/orders.py index 4fb994f336..659e2327fc 100644 --- a/src/pretix/control/views/orders.py +++ b/src/pretix/control/views/orders.py @@ -1001,6 +1001,10 @@ class OrderRefundView(OrderView): (prov, form) ) + for p in payments: + if p.payment_provider: + p.html_info = (p.payment_provider.payment_control_render_short(p) or "").strip() + return render(self.request, 'pretixcontrol/order/refund_choose.html', { 'payments': payments, 'new_refunds': new_refunds, diff --git a/src/pretix/plugins/banktransfer/payment.py b/src/pretix/plugins/banktransfer/payment.py index 0b36313a01..9d03cae327 100644 --- a/src/pretix/plugins/banktransfer/payment.py +++ b/src/pretix/plugins/banktransfer/payment.py @@ -282,6 +282,19 @@ class BankTransfer(BasePaymentProvider): def payment_partial_refund_supported(self, payment: OrderPayment) -> bool: return self.payment_refund_supported(payment) + def payment_control_render_short(self, payment: OrderPayment) -> str: + pi = payment.info_data or {} + r = pi.get('payer', '') + if pi.get('iban'): + if r: + r += ' / ' + r += pi.get('iban') + if pi.get('bic'): + if r: + r += ' / ' + r += pi.get('bic') + return r + def payment_presale_render(self, payment: OrderPayment) -> str: pi = payment.info_data or {} if self.payment_refund_supported(payment): diff --git a/src/pretix/plugins/paypal/payment.py b/src/pretix/plugins/paypal/payment.py index e68368e595..877d0be402 100644 --- a/src/pretix/plugins/paypal/payment.py +++ b/src/pretix/plugins/paypal/payment.py @@ -477,6 +477,9 @@ class Paypal(BasePaymentProvider): 'payment_info': payment.info_data, 'order': payment.order, 'sale_id': sale_id} return template.render(ctx) + def payment_control_render_short(self, payment: OrderPayment) -> str: + return payment.info_data.get('payer', {}).get('payer_info', {}).get('email', '') + def payment_partial_refund_supported(self, payment: OrderPayment): # Paypal refunds are possible for 180 days after purchase: # https://www.paypal.com/lc/smarthelp/article/how-do-i-issue-a-refund-faq780#:~:text=Refund%20after%20180%20days%20of,PayPal%20balance%20of%20the%20recipient. diff --git a/src/pretix/static/pretixcontrol/scss/_forms.scss b/src/pretix/static/pretixcontrol/scss/_forms.scss index 5f42d89925..e062fd91ff 100644 --- a/src/pretix/static/pretixcontrol/scss/_forms.scss +++ b/src/pretix/static/pretixcontrol/scss/_forms.scss @@ -327,6 +327,9 @@ input[type=number].short { label.label-empty { pointer-events: none; } +label.no-bold { + font-weight: normal; +} label .optional { color: $text-muted; font-weight: normal; @@ -501,11 +504,28 @@ table td > .checkbox input[type="checkbox"] { } } -.form-order-change { +.form-order-change, .form-refund-choose { .row { padding: 5px 0; } } +.form-refund-choose { + .payment-details { + max-width: 200px; + overflow: hidden; + dt { + float: none; + text-align: left; + font-weight: normal; + width: auto; + color: $text-muted; + } + dd { + margin-left: 0px; + word-break: break-word; + } + } +} @media(max-width: $screen-xs-max) { .nameparts-form-group {