Cancellation: Do not display refund notices if not required

This commit is contained in:
Raphael Michel
2019-04-04 09:57:44 +02:00
parent 243e4ac4c8
commit 4c0e8f69ea
2 changed files with 17 additions and 15 deletions

View File

@@ -15,22 +15,24 @@
{% endblocktrans %} {% endblocktrans %}
{% trans "This will invalidate all of your tickets." %} {% trans "This will invalidate all of your tickets." %}
</p> </p>
{% if can_auto_refund %} {% if refund_amount %}
<p> {% if can_auto_refund %}
<strong> <p>
<strong>
{% blocktrans trimmed with amount=refund_amount|money:request.event.currency %}
The refund amount of {{ amount }} will automatically be sent back to your original payment method. Depending on the payment method,
please allow for up to two weeks before this appears on your statement.
{% endblocktrans %}
</strong>
</p>
{% else %}
<div class="alert alert-warning">
{% blocktrans trimmed with amount=refund_amount|money:request.event.currency %} {% blocktrans trimmed with amount=refund_amount|money:request.event.currency %}
The refund amount of {{ amount }} will automatically be sent back to your original payment method. Depending on the payment method, With to the payment method you used, the refund amount of {{ amount }} <strong>can not be sent back to you automatically</strong>. Instead, the
please allow for up to two weeks before this appears on your statement. event organizer will need to initiate the transfer manually. Please be patient as this might take a bit longer.
{% endblocktrans %} {% endblocktrans %}
</strong> </div>
</p> {% endif %}
{% else %}
<div class="alert alert-warning">
{% blocktrans trimmed with amount=refund_amount|money:request.event.currency %}
With to the payment method you used, the refund amount of {{ amount }} <strong>can not be sent back to you automatically</strong>. Instead, the
event organizer will need to initiate the transfer manually. Please be patient as this might take a bit longer.
{% endblocktrans %}
</div>
{% endif %} {% endif %}
<form method="post" action="{% eventurl request.event "presale:event.order.cancel.do" secret=order.secret order=order.code %}" data-asynctask> <form method="post" action="{% eventurl request.event "presale:event.order.cancel.do" secret=order.secret order=order.code %}" data-asynctask>

View File

@@ -583,7 +583,7 @@ class OrderCancel(EventViewMixin, OrderDetailMixin, TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs) ctx = super().get_context_data(**kwargs)
ctx['order'] = self.order ctx['order'] = self.order
refund_amount = self.order.total - self.order.user_cancel_fee refund_amount = self.order.payment_refund_sum - self.order.user_cancel_fee
proposals = self.order.propose_auto_refunds(refund_amount) proposals = self.order.propose_auto_refunds(refund_amount)
ctx['refund_amount'] = refund_amount ctx['refund_amount'] = refund_amount
ctx['can_auto_refund'] = sum(proposals.values()) == refund_amount ctx['can_auto_refund'] = sum(proposals.values()) == refund_amount