mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Add BasePaymentProvider.refund_control_render
This commit is contained in:
@@ -110,6 +110,8 @@ The provider class
|
|||||||
|
|
||||||
.. automethod:: execute_refund
|
.. automethod:: execute_refund
|
||||||
|
|
||||||
|
.. automethod:: refund_control_render
|
||||||
|
|
||||||
.. automethod:: api_payment_details
|
.. automethod:: api_payment_details
|
||||||
|
|
||||||
.. automethod:: shred_payment_info
|
.. automethod:: shred_payment_info
|
||||||
|
|||||||
@@ -651,6 +651,19 @@ class BasePaymentProvider:
|
|||||||
"""
|
"""
|
||||||
return ''
|
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:
|
def payment_refund_supported(self, payment: OrderPayment) -> bool:
|
||||||
"""
|
"""
|
||||||
Will be called to check if the provider supports automatic refunding for this
|
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:
|
def checkout_confirm_render(self, request) -> str:
|
||||||
return get_template('pretixcontrol/giftcards/checkout_confirm.html').render({})
|
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:
|
def payment_control_render(self, request, payment) -> str:
|
||||||
from .models import GiftCard
|
from .models import GiftCard
|
||||||
|
|
||||||
|
|||||||
@@ -645,12 +645,28 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if staff_session %}
|
{% if r.html_info %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="1"></td>
|
||||||
|
<td colspan="7">
|
||||||
|
{{ r.html_info|safe }}
|
||||||
|
{% if staff_session %}
|
||||||
|
<p>
|
||||||
|
<a href="" class="btn btn-default btn-xs" data-expandrefund
|
||||||
|
data-id="{{ r.pk }}">
|
||||||
|
<span class="fa-eye fa fa-fw"></span>
|
||||||
|
{% trans "Inspect" %}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% elif staff_session %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1"></td>
|
<td colspan="1"></td>
|
||||||
<td colspan="7">
|
<td colspan="7">
|
||||||
<a href="" class="btn btn-default btn-xs" data-expandrefund
|
<a href="" class="btn btn-default btn-xs" data-expandrefund
|
||||||
data-id="{{ r.pk }}">
|
data-id="{{ r.pk }}">
|
||||||
<span class="fa-eye fa fa-fw"></span>
|
<span class="fa-eye fa fa-fw"></span>
|
||||||
{% trans "Inspect" %}
|
{% trans "Inspect" %}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -203,6 +203,9 @@ class OrderDetail(OrderView):
|
|||||||
for p in ctx['payments']:
|
for p in ctx['payments']:
|
||||||
if p.payment_provider:
|
if p.payment_provider:
|
||||||
p.html_info = (p.payment_provider.payment_control_render(self.request, p) or "").strip()
|
p.html_info = (p.payment_provider.payment_control_render(self.request, p) or "").strip()
|
||||||
|
for r in ctx['refunds']:
|
||||||
|
if r.payment_provider:
|
||||||
|
r.html_info = (r.payment_provider.refund_control_render(self.request, r) or "").strip()
|
||||||
ctx['invoices'] = list(self.order.invoices.all().select_related('event'))
|
ctx['invoices'] = list(self.order.invoices.all().select_related('event'))
|
||||||
ctx['comment_form'] = CommentForm(initial={
|
ctx['comment_form'] = CommentForm(initial={
|
||||||
'comment': self.order.comment,
|
'comment': self.order.comment,
|
||||||
|
|||||||
Reference in New Issue
Block a user