Allow to charge a cancellation fee on unpaid orders (#2845)

This commit is contained in:
Raphael Michel
2022-11-10 09:11:43 +01:00
committed by GitHub
parent bb718375e9
commit 4630c1fe8b
17 changed files with 224 additions and 65 deletions

View File

@@ -459,17 +459,24 @@
</p>
{% else %}
<p>
{% blocktrans trimmed %}
You can cancel this order using the following button.
{% endblocktrans %}
{% if order.total != 0 and order.user_cancel_fee %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can cancel this order. As per our cancellation policy, you will still be required
to pay a cancellation fee of <strong>{{ fee }}</strong>.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
You can cancel this order using the following button.
{% endblocktrans %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
<p>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove" aria-hidden="true"></span>
{% trans "Cancel order" %}
</a>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove" aria-hidden="true"></span>
{% trans "Cancel order" %}
</a>
</p>
{% endif %}
</li>

View File

@@ -50,7 +50,12 @@
</p>
{% endif %}
{% if not request.event.settings.cancel_allow_user_paid_require_approval or not request.event.settings.cancel_allow_user_paid_require_approval_fee_unknown %}
{% if order.status == "n" and order.total != 0 and order.user_cancel_fee %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can cancel this order. As per our cancellation policy, you will still be required
to pay a cancellation fee of <strong>{{ fee }}</strong>.
{% endblocktrans %}
{% elif not request.event.settings.cancel_allow_user_paid_require_approval or not request.event.settings.cancel_allow_user_paid_require_approval_fee_unknown %}
{% if request.event.settings.cancel_allow_user_paid_adjust_fees and order.status == "p" and order.total != 0 %}
<p>
{% if cancel_fee %}
@@ -98,7 +103,7 @@
{% endif %}
{% endif %}
{% if refund_amount %}
{% if refund_amount > 0 %}
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "manually" %}
<strong>
{% trans "The organizer will get in touch with you to clarify the details of your refund." %}

View File

@@ -917,7 +917,10 @@ class OrderCancelDo(EventViewMixin, OrderDetailMixin, AsyncAction, View):
auto_refund = self.request.event.settings.cancel_allow_user_paid_refund_as_giftcard != "manually"
if self.order.total == Decimal('0.00'):
fee = Decimal('0.00')
elif 'cancel_fee' in request.POST and self.request.event.settings.cancel_allow_user_paid_adjust_fees:
elif self.order.status == Order.STATUS_PENDING:
auto_refund = False
fee = self.order.user_cancel_fee
elif 'cancel_fee' in request.POST and self.order.status == Order.STATUS_PAID and self.request.event.settings.cancel_allow_user_paid_adjust_fees:
fee = fee or Decimal('0.00')
fee_in = re.sub('[^0-9.,]', '', request.POST.get('cancel_fee'))
try: