Allow customers to choose to receive their refund as a gift card (#1626)

* Minor text adjustments

* Allow users to receive their cancellation as a gift card
This commit is contained in:
Raphael Michel
2020-03-25 11:41:40 +01:00
committed by GitHub
parent a5910016fd
commit 3eafec9d6e
10 changed files with 233 additions and 29 deletions

View File

@@ -102,10 +102,17 @@
A refund of {{ amount }} will be sent out to you soon, please be patient.
{% endblocktrans %}
{% elif r.state == "done" %}
{% blocktrans trimmed with amount=r.amount|money:request.event.currency %}
A refund of {{ amount }} has been sent to you. Depending on the payment method, please allow for up to 14 days until it shows up
on your statement.
{% endblocktrans %}
{% if r.provider == "giftcard" and "gift_card_code" in r.info_data %}
{% blocktrans trimmed with amount=r.amount|money:request.event.currency code=r.info_data.gift_card_code %}
We've issued your refund of {{ amount }} as a gift card. On your next purchase with
us, you can use the gift card code <strong>{{ code }}</strong> during payment.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with amount=r.amount|money:request.event.currency %}
A refund of {{ amount }} has been sent to you. Depending on the payment method, please allow for up to 14 days until it shows up
on your statement.
{% endblocktrans %}
{% endif %}
{% endif %}
{% if not forloop.last %}<br />{% endif %}
{% endfor %}
@@ -271,19 +278,40 @@
</div>
<div class="panel-body">
{% if order.status == "p" and order.total != 0 %}
{% if order.user_cancel_fee %}
{% if order.user_cancel_fee >= order.total %}
<p>
{% blocktrans trimmed %}
You can cancel this order, but you will not receive a refund.
{% endblocktrans %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% elif order.user_cancel_fee %}
<p>
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can cancel this order. In this case, a cancellation fee of <strong>{{ fee }}</strong>
will be kept and you will receive a refund of the remainder to your original payment method.
will be kept and you will receive a refund of the remainder.
{% endblocktrans %}
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "force" %}
{% trans "The refund will be issued in form of a gift card that you can use for further purchases." %}
{% elif request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "option" %}
{% trans "The refund can be issued to your original payment method or as a gift card." %}
{% else %}
{% trans "The refund will be issued to your original payment method." %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% else %}
<p>
{% blocktrans trimmed %}
You can cancel this order and receive a full refund to your original payment method.
You can cancel this order and receive a full refund.
{% endblocktrans %}
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "force" %}
{% trans "The refund will be issued in form of a gift card that you can use for further purchases." %}
{% elif request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "option" %}
{% trans "The refund can be issued to your original payment method or as a gift card." %}
{% else %}
{% trans "The refund will be issued to your original payment method." %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% endif %}

View File

@@ -10,12 +10,15 @@
Cancel order: {{ code }}
{% endblocktrans %}
</h2>
<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
class="">
<p>
{% blocktrans trimmed %}
Do you really want to cancel this order? You cannot revert this action.
If you cancel this order, all tickets will be invalidated and you can no longer use them. You cannot
revert this action.
{% endblocktrans %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% if request.event.settings.cancel_allow_user_paid_adjust_fees %}
@@ -57,25 +60,62 @@
{% endif %}
{% if refund_amount %}
{% if can_auto_refund %}
<p>
<strong>
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "force" %}
<strong>
{% trans "The refund will be issued in form of a gift card that you can use for further purchases." %}
</strong>
{% elif request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "option" %}
<div class="radio">
<label>
<input type="radio" name="giftcard" value="true" checked>
<strong>{% trans "I want the refund as a gift card for later purchases" %}</strong>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="giftcard" value="false" checked>
<strong>{% trans "I want the refund to be sent to my original payment method" %}</strong>
</label>
</div>
{% if can_auto_refund %}
<p class="help-block">
{% blocktrans trimmed %}
The refund 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>
</p>
{% else %}
<p class="help-block">
{% blocktrans trimmed %}
With the payment method you used, the refund 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 %}
</p>
{% endif %}
{% else %}
<p>
{% blocktrans trimmed %}
With the payment method you used, the refund 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 %}
</p>
{% if can_auto_refund %}
<p>
<strong>
{% blocktrans trimmed %}
The refund 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 %}
<p>
{% blocktrans trimmed %}
With the payment method you used, the refund 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 %}
</p>
{% endif %}
{% endif %}
{% endif %}
{% csrf_token %}

View File

@@ -759,7 +759,13 @@ class OrderCancelDo(EventViewMixin, OrderDetailMixin, AsyncAction, View):
else:
messages.error(request, _('You chose an invalid cancellation fee.'))
return redirect(self.get_order_url())
return self.do(self.order.pk, cancellation_fee=fee, try_auto_refund=True)
giftcard = (
self.request.event.settings.cancel_allow_user_paid_refund_as_giftcard == 'force' or (
self.request.event.settings.cancel_allow_user_paid_refund_as_giftcard == 'option' and
self.request.POST.get('giftcard') == 'true'
)
)
return self.do(self.order.pk, cancellation_fee=fee, try_auto_refund=True, refund_as_giftcard=giftcard)
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)