Self-service refund form (#1135)

* Auto-refund

* Add missing template

* Notification for requested refund

* Model-level tests

* Add front-end tests

* Default to notify
This commit is contained in:
Raphael Michel
2019-01-18 17:24:42 +01:00
committed by GitHub
parent 80b5750756
commit 06eddb2c6d
24 changed files with 857 additions and 95 deletions

View File

@@ -168,7 +168,7 @@
{% for i in invoices %}
<li>
<a href="{% eventurl event "presale:event.invoice.download" invoice=i.pk secret=order.secret order=order.code %}">
{% if i.is_cancellation %}{% trans "Cancellation" %}{% else %}{% trans "Invoice" %}{% endif %}
{% if i.is_cancellation %}{% trans "Cancellation" context "invoice" %}{% else %}{% trans "Invoice" %}{% endif %}
{{ i.number }}</a> ({{ i.date|date:"SHORT_DATE_FORMAT" }})
</li>
{% endfor %}
@@ -245,16 +245,57 @@
{% endif %}
<div class="clearfix"></div>
</div>
{% if order.can_user_cancel %}
<div class="row">
<div class="col-md-12 text-right">
<p>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
{% if order.cancel_allowed %}
<div class="panel panel-primary cart">
<div class="panel-heading">
<h3 class="panel-title">
{% trans "Cancellation" context "action" %}
</h3>
</div>
<div class="panel-body">
{% if order.user_cancel_allowed %}
{% if order.status == "p" and order.total != 0 %}
{% if 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.
{% endblocktrans %}
{% trans "This will invalidate all of your tickets." %}
</p>
{% else %}
<p>
{% blocktrans trimmed %}
You can cancel this order and receive a full refund to your original payment method.
{% endblocktrans %}
{% trans "This will invalidate all of your tickets." %}
</p>
{% endif %}
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>
{% else %}
<p>
{% blocktrans trimmed %}
You can cancel this order using the following button.
{% endblocktrans %}
{% trans "This will invalidate all of your tickets." %}
</p>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>
</p>
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>
{% endif %}
{% else %}
<p>
{% blocktrans trimmed %}
You can not cancel this order yourself. Please contact the event organizer for more information.
{% endblocktrans %}
</p>
{% endif %}
</div>
</div>
{% endif %}

View File

@@ -1,5 +1,6 @@
{% extends "pretixpresale/event/base.html" %}
{% load i18n %}
{% load money %}
{% load eventurl %}
{% block title %}{% trans "Cancel order" %}{% endblock %}
{% block content %}
@@ -8,9 +9,29 @@
Cancel order: {{ code }}
{% endblocktrans %}
</h2>
<p>{% blocktrans trimmed %}
Do you really want to cancel this order? You cannot revert this action.
{% endblocktrans %}</p>
<p>
{% blocktrans trimmed %}
Do you really want to cancel this order? You cannot revert this action.
{% endblocktrans %}
{% trans "This will invalidate all of your tickets." %}
</p>
{% if can_auto_refund %}
<p>
<strong>
{% blocktrans trimmed with amount=refund_amount|money:request.event.currency %}
The refund amount of {{ 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 %}
<div class="alert alert-warning">
{% blocktrans trimmed with amount=refund_amount|money:request.event.currency %}
With to the payment method you used, the refund amount of {{ 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 %}
</div>
{% endif %}
<form method="post" action="{% eventurl request.event "presale:event.order.cancel.do" secret=order.secret order=order.code %}" data-asynctask>
{% csrf_token %}