mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Ajout d'un nouvel état dans l'automatique lorsqu'un mandat SEPA
doit être envoyé aux parent
This commit is contained in:
@ -252,6 +252,8 @@ class RegisterFormWithIdView(APIView):
|
||||
return JsonResponse(studentForm_serializer.errors, safe=False, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
if _status == RegistrationForm.RegistrationFormStatus.RF_UNDER_REVIEW:
|
||||
# Le parent a rempli le dossier d'inscription sans sélectionner "Prélèvement par Mandat SEPA"
|
||||
# L'école doit désormais valider le dossier d'inscription
|
||||
try:
|
||||
# Génération de la fiche d'inscription au format PDF
|
||||
base_dir = os.path.join(settings.MEDIA_ROOT, f"registration_files/dossier_rf_{registerForm.pk}")
|
||||
@ -304,11 +306,14 @@ class RegisterFormWithIdView(APIView):
|
||||
guardian = student.getMainGuardian()
|
||||
email = guardian.profile_role.profile.email
|
||||
errorMessage = mailer.sendMandatSEPA(email, registerForm.establishment.pk)
|
||||
if errorMessage == '':
|
||||
registerForm.last_update = util.convertToStr(util._now(), '%d-%m-%Y %H:%M')
|
||||
updateStateMachine(registerForm, 'EVENT_SEND_SEPA')
|
||||
return JsonResponse({"message": f"Le mandat SEPA a bien été envoyé à l'adresse {email}"}, safe=False)
|
||||
return JsonResponse({"errorMessage": errorMessage}, safe=False, status=status.HTTP_400_BAD_REQUEST)
|
||||
if errorMessage != '':
|
||||
return JsonResponse({"errorMessage": errorMessage}, safe=False, status=status.HTTP_400_BAD_REQUEST)
|
||||
registerForm.last_update = util.convertToStr(util._now(), '%d-%m-%Y %H:%M')
|
||||
updateStateMachine(registerForm, 'EVENT_SEND_SEPA')
|
||||
elif _status == RegistrationForm.RegistrationFormStatus.RF_SEPA_TO_SEND:
|
||||
# Le parent a rempli le dossier d'inscription en sélectionnant "Prélèvement par Mandat SEPA"
|
||||
# L'école doit désormais envoyer le mandat SEPA pour poursuivre l'inscription
|
||||
updateStateMachine(registerForm, 'EVENT_WAITING_FOR_SEPA')
|
||||
|
||||
# Retourner les données mises à jour
|
||||
return JsonResponse(studentForm_serializer.data, safe=False)
|
||||
|
||||
@ -101,7 +101,8 @@ class ChildrenListView(APIView):
|
||||
status__in=[
|
||||
RegistrationForm.RegistrationFormStatus.RF_SENT,
|
||||
RegistrationForm.RegistrationFormStatus.RF_UNDER_REVIEW,
|
||||
RegistrationForm.RegistrationFormStatus.RF_SEPA_SENT
|
||||
RegistrationForm.RegistrationFormStatus.RF_SEPA_SENT,
|
||||
RegistrationForm.RegistrationFormStatus.RF_SEPA_TO_SEND
|
||||
]
|
||||
).distinct()
|
||||
students_serializer = RegistrationFormByParentSerializer(students, many=True)
|
||||
|
||||
Reference in New Issue
Block a user