mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-23 06:36:35 +02:00
Restore payment edit form for volunteers
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -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):
|
||||
|
Reference in New Issue
Block a user