diff --git a/participation/templates/participation/team_detail.html b/participation/templates/participation/team_detail.html
index b89e9d5..36524f5 100644
--- a/participation/templates/participation/team_detail.html
+++ b/participation/templates/participation/team_detail.html
@@ -134,7 +134,7 @@
Valide : {{ payment.valid|yesno }}
- {% if payment.valid is False %}
+ {% if payment.valid is False or user.registration.is_volunteer %}
{% if user.registration in payment.registrations.all or user.registration.is_coach or user.registration.is_volunteer %}
{% trans "Update payment" %}
diff --git a/registration/models.py b/registration/models.py
index 56422f2..bd869e3 100644
--- a/registration/models.py
+++ b/registration/models.py
@@ -611,7 +611,7 @@ class Payment(models.Model):
base_site = "https://" + Site.objects.first().domain
checkout_intent = helloasso.create_checkout_intent(
amount=100 * self.amount,
- name=f"Participation au TFJM² {year} - {tournament.name}",
+ name=f"Participation au TFJM² {year} - {tournament.name} - {self.team.trigram}",
back_url=base_site + reverse('registration:update_payment', args=(self.id,)),
error_url=f"{base_site}{reverse('registration:payment_hello_asso_return', args=(self.id,))}?type=error",
return_url=f"{base_site}{reverse('registration:payment_hello_asso_return', args=(self.id,))}?type=return",
diff --git a/registration/templates/registration/payment_form.html b/registration/templates/registration/payment_form.html
index 7fb33b6..f865187 100644
--- a/registration/templates/registration/payment_form.html
+++ b/registration/templates/registration/payment_form.html
@@ -198,6 +198,14 @@
+ {% else %}
+
{% endif %}
{% endblock content %}
diff --git a/registration/templates/registration/user_detail.html b/registration/templates/registration/user_detail.html
index 05cec5a..a5f1c72 100644
--- a/registration/templates/registration/user_detail.html
+++ b/registration/templates/registration/user_detail.html
@@ -158,7 +158,7 @@
{% else %}
{{ payment.get_type_display }}, {% trans "valid:" %} {{ payment.valid|yesno:yesnodefault }}
{% endif %}
- {% if user.registration.is_admin or payment.valid is False %}
+ {% if user.registration.is_volunteer or payment.valid is False %}
{% trans "Update payment" %}
diff --git a/registration/views.py b/registration/views.py
index 141e1d9..787680a 100644
--- a/registration/views.py
+++ b/registration/views.py
@@ -1,6 +1,6 @@
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
-
+import json
import os
import subprocess
from tempfile import mkdtemp
@@ -482,7 +482,7 @@ class PaymentUpdateView(LoginRequiredMixin, UpdateView):
return super().form_valid(form)
def get_success_url(self):
- return reverse_lazy("registration:user_detail", args=(self.object.registrations.first().user.pk,))
+ return reverse_lazy("participation:team_detail", args=(self.object.registrations.first().team.pk,))
class PaymentUpdateGroupView(LoginRequiredMixin, DetailView):
@@ -594,7 +594,7 @@ class PaymentHelloAssoReturnView(DetailView):
or (request.user.registration.is_coach and request.user.registration.team == team))
if right_to_see:
- error_response = redirect("registration:update_payment", args=(payment.pk,))
+ error_response = redirect("registration:update_payment", pk=payment.pk)
else:
error_response = redirect("index")
@@ -617,11 +617,14 @@ class PaymentHelloAssoReturnView(DetailView):
checkout_intent = payment.get_checkout_intent()
if 'order' in checkout_intent:
+ payment.type = "helloasso"
payment.valid = True
+ payment.additional_information = json.dumps(checkout_intent['order'])
payment.save()
messages.success(request, _("The payment has been successfully validated! "
"Your registration is now complete."))
else:
+ payment.type = "helloasso"
payment.valid = None
payment.save()
messages.success(request, _("Your payment is done! "
@@ -629,14 +632,10 @@ class PaymentHelloAssoReturnView(DetailView):
"and will be automatically done. "
"If it is not the case, please contact us."))
- if not request.user.is_anonymous and request.user.registration in payment.registrations.all():
- success_response = redirect("registration:user_detail", args=(request.user.pk,))
- elif right_to_see:
- success_response = redirect("participation:team_detail", args=(team.pk,))
+ if right_to_see:
+ return redirect("participation:team_detail", pk=team.pk)
else:
- success_response = redirect("index")
-
- return success_response
+ return redirect("index")
class PhotoAuthorizationView(LoginRequiredMixin, View):