mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
External refunds: Processing should not affect order's state if order is canceled
This commit is contained in:
@@ -25,22 +25,30 @@
|
||||
<strong>{{ pending }}</strong>. The order total is <strong>{{ total }}</strong>.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans trimmed with amount=refund.amount|money:request.event.currency method=refund.payment_provider.verbose_name %}
|
||||
What should happen to the ticket order?
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<div class="form-inline">
|
||||
<label class="radio">
|
||||
<input type="radio" name="action" value="n" {% if not propose_cancel %}checked{% endif %}>
|
||||
{% trans "Mark the order as unpaid and allow the customer to pay again with another payment method." %}
|
||||
</label>
|
||||
<br>
|
||||
<label class="radio">
|
||||
<input type="radio" name="action" value="r" {% if propose_cancel %}checked{% endif %}>
|
||||
{% trans "Cancel the order irrevocably." %}
|
||||
</label>
|
||||
</div>
|
||||
{% 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>
|
||||
{% blocktrans trimmed with amount=refund.amount|money:request.event.currency method=refund.payment_provider.verbose_name %}
|
||||
What should happen to the ticket order?
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<div class="form-inline">
|
||||
<label class="radio">
|
||||
<input type="radio" name="action" value="n" {% if not propose_cancel %}checked{% endif %}>
|
||||
{% trans "Mark the order as unpaid and allow the customer to pay again with another payment method." %}
|
||||
</label>
|
||||
<br>
|
||||
<label class="radio">
|
||||
<input type="radio" name="action" value="r" {% if propose_cancel %}checked{% endif %}>
|
||||
{% trans "Cancel the order irrevocably." %}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-group submit-group">
|
||||
<a class="btn btn-default btn-lg"
|
||||
href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}">
|
||||
|
||||
@@ -566,16 +566,17 @@ class OrderRefundProcess(OrderView):
|
||||
if self.refund.state == OrderRefund.REFUND_STATE_EXTERNAL:
|
||||
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()):
|
||||
mark_order_refunded(self.order, user=self.request.user)
|
||||
elif not (self.order.status == Order.STATUS_PAID and self.order.pending_sum <= 0):
|
||||
self.order.status = Order.STATUS_PENDING
|
||||
self.order.set_expires(
|
||||
now(),
|
||||
self.order.event.subevents.filter(
|
||||
id__in=self.order.positions.values_list('subevent_id', flat=True))
|
||||
)
|
||||
self.order.save(update_fields=['status', 'expires'])
|
||||
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)
|
||||
elif not (self.order.status == Order.STATUS_PAID and self.order.pending_sum <= 0):
|
||||
self.order.status = Order.STATUS_PENDING
|
||||
self.order.set_expires(
|
||||
now(),
|
||||
self.order.event.subevents.filter(
|
||||
id__in=self.order.positions.values_list('subevent_id', flat=True))
|
||||
)
|
||||
self.order.save(update_fields=['status', 'expires'])
|
||||
|
||||
messages.success(self.request, _('The refund has been processed.'))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user