Self-service cancellation: Do not allow to adjust fee on free orders

This commit is contained in:
Raphael Michel
2021-08-16 14:40:06 +02:00
parent bb7fd9423b
commit e191988b81
3 changed files with 33 additions and 3 deletions

View File

@@ -21,7 +21,7 @@
action="{% eventurl request.event "presale:event.order.cancel.do" secret=order.secret order=order.code %}"
data-asynctask
class="">
{% if request.event.settings.cancel_allow_user_paid_require_approval %}
{% if request.event.settings.cancel_allow_user_paid_require_approval and order.status == "p" and order.total != 0 %}
<p>
{% blocktrans trimmed %}
You can request the cancellation of your order on this page. The event organizer will then decide
@@ -37,7 +37,7 @@
</p>
{% endif %}
{% if request.event.settings.cancel_allow_user_paid_adjust_fees %}
{% if request.event.settings.cancel_allow_user_paid_adjust_fees and order.status == "p" and order.total != 0 %}
<p>
{% if cancel_fee %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}

View File

@@ -878,7 +878,9 @@ class OrderCancelDo(EventViewMixin, OrderDetailMixin, AsyncAction, View):
require_approval = self.request.event.settings.cancel_allow_user_paid_require_approval
fee = self.order.user_cancel_fee
auto_refund = True
if 'cancel_fee' in request.POST and self.request.event.settings.cancel_allow_user_paid_adjust_fees:
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:
fee = fee or Decimal('0.00')
fee_in = re.sub('[^0-9.,]', '', request.POST.get('cancel_fee'))
try: