fix refund service

sync_v2
Razmig Sarkissian 5 months ago
parent 09f4944f4d
commit 0e7d746352
  1. 2
      api/views.py
  2. 4
      tournaments/services/payment_service.py
  3. 17
      tournaments/templates/tournaments/tournament_info.html

@ -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,

@ -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

@ -121,11 +121,28 @@
</div>
{% endif %}
{% if tournament.enable_online_payment %}
<div class="topmargin20">
{% if tournament.enable_online_payment_refund is False %}
<p class="minor info">
Le remboursement en ligne automatique n'est pas autorisé pour ce tournoi.
</p>
{% endif %}
{% if tournament.refund_date_limit %}
<div>Remboursement en ligne automatique possible jusqu'au {{ tournament.refund_date_limit|date:"d/m/Y à H:i" }}</div>
{% endif %}
</div>
{% endif %}
{% if tournament.is_unregistration_possible and team.is_unregistration_possible %}
<div class="topmargin20">
{% if tournament.is_refund_possible and team.is_paid %}
<p class="minor info">
Si vous vous désinscrivez, votre inscription sera remboursée automatiquement sur votre carte bancaire.
</p>
{% elif tournament.is_refund_possible is False and team.is_paid %}
<p class="minor info">
Si vous vous désinscrivez, votre inscription ne sera pas remboursée automatiquement. Veuillez contacter le juge-arbitre.
{% if tournament.refund_date_limit %}
<div>Remboursement possible jusqu'au {{ tournament.refund_date_limit|date:"d/m/Y à H:i" }}</div>
{% endif %}

Loading…
Cancel
Save