diff --git a/api/views.py b/api/views.py index 25d12b6..0f48501 100644 --- a/api/views.py +++ b/api/views.py @@ -345,7 +345,7 @@ def process_refund(request, team_registration_id): payment_service = PaymentService(request) players_serializer = PlayerRegistrationSerializer(team_registration.players_sorted_by_rank, many=True) - success, message, refund = payment_service.process_refund(team_registration_id) + success, message, refund = payment_service.process_refund(team_registration_id, force_refund=True) return Response({ 'success': success, 'message': message, diff --git a/tournaments/services/payment_service.py b/tournaments/services/payment_service.py index b176c6b..2b5d51d 100644 --- a/tournaments/services/payment_service.py +++ b/tournaments/services/payment_service.py @@ -278,7 +278,7 @@ class PaymentService: team_registration.confirm_registration(payment_intent_id) return True - def process_refund(self, team_registration_id): + def process_refund(self, team_registration_id, force_refund=False): """ Process a refund for a tournament registration as part of unregistration Returns a tuple (success, message) @@ -291,7 +291,7 @@ class PaymentService: tournament = team_registration.tournament # Check if refund is possible for this tournament - if not tournament.is_refund_possible(): + if not tournament.is_refund_possible() and force_refund == False: return False, "Les remboursements ne sont plus possibles pour ce tournoi.", None # Get payment ID from player registrations diff --git a/tournaments/templates/tournaments/tournament_info.html b/tournaments/templates/tournaments/tournament_info.html index 4ac210a..72d6f94 100644 --- a/tournaments/templates/tournaments/tournament_info.html +++ b/tournaments/templates/tournaments/tournament_info.html @@ -121,11 +121,28 @@ {% endif %} + {% if tournament.enable_online_payment %} +
+ Le remboursement en ligne automatique n'est pas autorisé pour ce tournoi. +
+ {% endif %} + {% if tournament.refund_date_limit %} +Si vous vous désinscrivez, votre inscription sera remboursée automatiquement sur votre carte bancaire. +
+ {% elif tournament.is_refund_possible is False and team.is_paid %} ++ Si vous vous désinscrivez, votre inscription ne sera pas remboursée automatiquement. Veuillez contacter le juge-arbitre. {% if tournament.refund_date_limit %}