1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-23 05:18:24 +02:00

Add payment interface tests

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-02-24 23:05:21 +01:00
parent 2a2786ba6d
commit 207af441a0
5 changed files with 380 additions and 7 deletions

View File

@ -41,3 +41,13 @@ def create_admin_registration(instance, **_):
"""
if instance.is_superuser:
VolunteerRegistration.objects.get_or_create(user=instance, admin=True)
def update_payment_amount(instance, **_):
"""
When a payment got created, ensure that the amount is set.
"""
if instance.type == 'free' or instance.type == 'scholarship':
instance.amount = 0
elif instance.pk:
instance.amount = instance.registrations.count() * instance.tournament.price