mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-23 03:58:25 +02:00
Create Hello Asso checkout intents
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -506,6 +506,7 @@ class PaymentUpdateGroupView(LoginRequiredMixin, DetailView):
|
||||
payment.grouped = False
|
||||
tournament = first_reg.team.participation.tournament if not payment.final else Tournament.final_tournament()
|
||||
payment.amount = tournament.price
|
||||
payment.checkout_intent_id = None
|
||||
payment.save()
|
||||
for registration in registrations[1:]:
|
||||
p = Payment.objects.create(type=payment.type,
|
||||
@ -525,11 +526,30 @@ class PaymentUpdateGroupView(LoginRequiredMixin, DetailView):
|
||||
payment.registrations.add(student)
|
||||
payment.amount = tournament.price * reg.team.students.count()
|
||||
payment.grouped = True
|
||||
payment.checkout_intent_id = None
|
||||
payment.save()
|
||||
|
||||
return redirect(reverse_lazy("registration:update_payment", args=(payment.pk,)))
|
||||
|
||||
|
||||
class PaymenRedirectHelloAssoView(LoginRequiredMixin, DetailView):
|
||||
model = Payment
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if not self.request.user.is_authenticated or \
|
||||
not self.request.user.registration.is_admin \
|
||||
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 super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
payment = self.get_object()
|
||||
checkout_intent = payment.create_checkout_intent()
|
||||
|
||||
return redirect(checkout_intent["redirectUrl"])
|
||||
|
||||
|
||||
class PhotoAuthorizationView(LoginRequiredMixin, View):
|
||||
"""
|
||||
Display the sent photo authorization.
|
||||
|
Reference in New Issue
Block a user