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:
@ -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
|
||||
|
Reference in New Issue
Block a user