External refunds: Processing should not affect order's state if order is canceled

This commit is contained in:
Raphael Michel
2020-11-02 17:08:53 +01:00
parent 031ee647ab
commit e07cca9148
2 changed files with 35 additions and 26 deletions

View File

@@ -25,6 +25,13 @@
<strong>{{ pending }}</strong>. The order total is <strong>{{ total }}</strong>. <strong>{{ pending }}</strong>. The order total is <strong>{{ total }}</strong>.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
{% if order.status != "c" and order.positions.count > 0 %}
<p>
{% blocktrans trimmed %}
Since the order is already canceled, this will not affect its state.
{% endblocktrans %}
</p>
{% else %}
<p> <p>
{% blocktrans trimmed with amount=refund.amount|money:request.event.currency method=refund.payment_provider.verbose_name %} {% blocktrans trimmed with amount=refund.amount|money:request.event.currency method=refund.payment_provider.verbose_name %}
What should happen to the ticket order? What should happen to the ticket order?
@@ -41,6 +48,7 @@
{% trans "Cancel the order irrevocably." %} {% trans "Cancel the order irrevocably." %}
</label> </label>
</div> </div>
{% endif %}
<div class="form-group submit-group"> <div class="form-group submit-group">
<a class="btn btn-default btn-lg" <a class="btn btn-default btn-lg"
href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}"> href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}">

View File

@@ -566,7 +566,8 @@ class OrderRefundProcess(OrderView):
if self.refund.state == OrderRefund.REFUND_STATE_EXTERNAL: if self.refund.state == OrderRefund.REFUND_STATE_EXTERNAL:
self.refund.done(user=self.request.user) self.refund.done(user=self.request.user)
if self.request.POST.get("action") == "r" and (self.order.status != Order.STATUS_CANCELED and self.order.positions.exists()): if self.order.status != Order.STATUS_CANCELED and self.order.positions.exists():
if self.request.POST.get("action") == "r":
mark_order_refunded(self.order, user=self.request.user) mark_order_refunded(self.order, user=self.request.user)
elif not (self.order.status == Order.STATUS_PAID and self.order.pending_sum <= 0): elif not (self.order.status == Order.STATUS_PAID and self.order.pending_sum <= 0):
self.order.status = Order.STATUS_PENDING self.order.status = Order.STATUS_PENDING