Show refund status to customer on order page

This commit is contained in:
Raphael Michel
2019-01-12 22:33:09 +01:00
parent e8b9f0a3ae
commit e7730333c2
2 changed files with 25 additions and 1 deletions

View File

@@ -84,6 +84,25 @@
</div>
</div>
{% endif %}
{% if order.status == "p" or order.status == "c" %}
{% if refunds %}
<div class="alert alert-info">
{% for r in refunds %}
{% if r.state == "created" or r.state == "transit" %}
{% blocktrans trimmed with amount=r.amount|money:request.event.currency %}
A refund of {{ amount }} will be sent out to you soon, please be patient.
{% endblocktrans %}
{% elif r.state == "done" %}
{% blocktrans trimmed with amount=r.amount|money:request.event.currency %}
A refund of {{ amount }} has been sent to you. Depending on the payment method, please allow for up to 14 days until it shows up
on your statement.
{% endblocktrans %}
{% endif %}
{% if not forloop.last %}<br />{% endif %}
{% endfor %}
</div>
{% endif %}
{% endif %}
{% if can_download and download_buttons and order.count_positions %}
<div class="alert alert-info">
{% blocktrans trimmed %}

View File

@@ -18,7 +18,7 @@ from django.views.generic import TemplateView, View
from pretix.base.models import CachedTicket, Invoice, Order, OrderPosition
from pretix.base.models.orders import (
CachedCombinedTicket, OrderFee, OrderPayment, QuestionAnswer,
CachedCombinedTicket, OrderFee, OrderPayment, OrderRefund, QuestionAnswer,
)
from pretix.base.payment import PaymentException
from pretix.base.services.invoices import (
@@ -145,6 +145,11 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TemplateView):
elif self.order.status == Order.STATUS_PAID:
ctx['can_pay'] = False
ctx['refunds'] = self.order.refunds.filter(
state__in=(OrderRefund.REFUND_STATE_DONE, OrderRefund.REFUND_STATE_TRANSIT, OrderRefund.REFUND_STATE_CREATED)
)
return ctx