mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 01:18:22 +02:00
Send payment confirmation mail after payment, and send weekly reminders for people that have not paid
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
25
registration/management/commands/check_hello_asso.py
Normal file
25
registration/management/commands/check_hello_asso.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (C) 2024 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import json
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
|
||||
from registration.models import Payment
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
This command checks if the initiated Hello Asso payments are validated or not.
|
||||
"""
|
||||
help = "Vérifie si les paiements Hello Asso initiés sont validés ou non. Si oui, valide les inscriptions."
|
||||
|
||||
def handle(self, *args, **options):
|
||||
for payment in Payment.objects.exclude(valid=True).filter(checkout_intent_id__isnull=False).all():
|
||||
checkout_intent = payment.get_checkout_intent()
|
||||
if checkout_intent is not None and 'order' in checkout_intent:
|
||||
payment.type = 'helloasso'
|
||||
payment.valid = True
|
||||
payment.additional_information = json.dumps(checkout_intent['order'])
|
||||
payment.save()
|
||||
payment.send_helloasso_payment_confirmation_mail()
|
17
registration/management/commands/remind_payments.py
Normal file
17
registration/management/commands/remind_payments.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (C) 2024 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
|
||||
from registration.models import Payment
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
This command sends a mail to each participant who has not yet paid.
|
||||
"""
|
||||
help = "Envoie un mail de rappel à toustes les participant⋅es qui n'ont pas encore payé ou déclaré de paiement."
|
||||
|
||||
def handle(self, *args, **options):
|
||||
for payment in Payment.objects.filter(valid=False).filter(registrations__team__participation__valid=True).all():
|
||||
payment.send_remind_mail()
|
Reference in New Issue
Block a user