Add payment information after payment
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
1d01376703
commit
2a2786ba6d
File diff suppressed because it is too large
Load Diff
|
@ -201,6 +201,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% if user.registration.is_volunteer %}
|
||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
<div id="form-content">
|
<div id="form-content">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -208,6 +209,74 @@
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary" type="submit">{% trans "Update" %}</button>
|
<button class="btn btn-primary" type="submit">{% trans "Update" %}</button>
|
||||||
</form>
|
</form>
|
||||||
|
{% else %}
|
||||||
|
{% if payment.type == 'helloasso' %}
|
||||||
|
{% if payment.valid is True %}
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{% with order=payment.get_checkout_intent.order %}
|
||||||
|
{% trans "Your payment by credit card via Hello Asso is successfully validated." %}
|
||||||
|
{% trans "The paid amount is" %} {% widthratio order.amount.total 100 1 %} €.
|
||||||
|
{% if grouped %}
|
||||||
|
{% trans "It includes the registrations of all members of the team." %}
|
||||||
|
{% endif %}
|
||||||
|
{% trans "The payer was " %} {{ order.payer.firstName }} {{ order.payer.lastName }}.
|
||||||
|
{% trans "The payment was done on" %} {{ order.date }}.
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
|
{% elif payment.valid is None %}
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
{% trans "The payment by credit card via Hello Asso is pending validation." %}
|
||||||
|
{% trans "It should takes only few minutes. If it takes longer, please contact us." %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if payment.valid is True %}
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{% trans "Your payment is successfully validated by the organizers." %}
|
||||||
|
<ul>
|
||||||
|
<li>{% trans "Type:" %} {{ payment.get_type_display }}</li>
|
||||||
|
<li>
|
||||||
|
{% trans "Amount:" %} {{ payment.amount }} €
|
||||||
|
{% if payment.grouped %}
|
||||||
|
({% trans "It includes the registrations of all members of the team." %})
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% if payment.receipt %}
|
||||||
|
<li>
|
||||||
|
{% trans "Receipt:" %}
|
||||||
|
<a href="{{ payment.receipt.url }}"><i class="fas fa-download"></i> {% trans "Download" %}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if payment.additional_information %}
|
||||||
|
<li>{% trans "Additional information:" %} {{ payment.additional_information }}</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% elif payment.valid is None %}
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
{% trans "Your payment is pending validation from the organizers." %}
|
||||||
|
<ul>
|
||||||
|
<li>{% trans "Type:" %} {{ payment.get_type_display }}</li>
|
||||||
|
<li>
|
||||||
|
{% trans "Amount:" %} {{ payment.amount }} €
|
||||||
|
{% if payment.grouped %}
|
||||||
|
({% trans "It includes the registrations of all members of the team." %})
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% if payment.receipt %}
|
||||||
|
<li>
|
||||||
|
{% trans "Receipt:" %}
|
||||||
|
<a href="{{ payment.receipt.url }}"><i class="fas fa-download"></i> {% trans "Download" %}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if payment.additional_information %}
|
||||||
|
<li>{% trans "Additional information:" %} {{ payment.additional_information }}</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
|
|
|
@ -451,8 +451,7 @@ class PaymentUpdateView(LoginRequiredMixin, UpdateView):
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
if not self.request.user.is_authenticated or \
|
if not self.request.user.is_authenticated or \
|
||||||
not self.request.user.registration.is_admin \
|
not self.request.user.registration.is_admin \
|
||||||
and (self.request.user.registration not in self.get_object().registrations.all()
|
and self.request.user.registration not in self.get_object().registrations.all():
|
||||||
or self.get_object().valid is not False):
|
|
||||||
return self.handle_no_permission()
|
return self.handle_no_permission()
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -477,8 +476,12 @@ class PaymentUpdateView(LoginRequiredMixin, UpdateView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.instance.valid = None
|
|
||||||
old_instance = Payment.objects.get(pk=self.object.pk)
|
old_instance = Payment.objects.get(pk=self.object.pk)
|
||||||
|
if self.request.user.registration.participates:
|
||||||
|
if old_instance.valid is not False:
|
||||||
|
raise PermissionDenied(_("This payment is already valid or pending validation."))
|
||||||
|
else:
|
||||||
|
form.instance.valid = None
|
||||||
if old_instance.receipt:
|
if old_instance.receipt:
|
||||||
old_instance.receipt.delete()
|
old_instance.receipt.delete()
|
||||||
old_instance.save()
|
old_instance.save()
|
||||||
|
|
Loading…
Reference in New Issue