Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PC-31957)[API] feat: include booking with partial finance incident in the beneficiary's credits #14250

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

aminepass
Copy link
Contributor

But de la pull request

Prise en compte des incidents finance partiels dans le calcul du crédit des bénéficiaires

Exemple:
Un jeune ayant :

  • 1 réservation (40€) validée et remboursée à l'AC. Son status est "reimbursed"
  • 1 réservation validée (33€) et remboursée à l'AC puis totalement annulée (0€). Son status est "cancelled" donc pas incluse dans le crédit du jeune
  • 1 réservation validée (67€) et remboursée à l'AC puis partiellement annulée. On veut récupérer 40€ de l'AC, donc son nouveau prix est de 27€. Son status reste "reimbursed" pas "cancelled"

Le crédit du jeune doit être à 300€ - 40€ - 27€ = 233€

Dans le fonctionnement actuel, on ne prend en considération que les réservations complètement annulées il manquait le calcul des réservations dont on ne prend pas directement le montant depuis total_amount mais de booking.incidents[0].newTotalAmount

Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-31957

Vérifications

  • J'ai écrit les tests nécessaires
  • J'ai mis à jour le fichier des plans de tests du portail pro si nécessaire
  • J'ai mis à jour la liste des routes et des titres de pages du portail pro si j'en ai rajouté/modifié ou supprimé une.
  • J'ai relu attentivement les migrations, en particulier pour éviter les locks, et je préviens les équipes Shérif et Data
  • J'ai ajouté des screenshots pour d'éventuels changements graphiques

Copy link
Contributor

@Meewan Meewan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je ne peux pas juger pour les jeunes

Comment on lines 780 to 785
booking_finance_incidents = [
booking_finance_incident
for booking_finance_incident in booking.incidents
if booking_finance_incident.is_partial
and booking_finance_incident.incident.status == finance_models.IncidentStatus.VALIDATED
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la comprehension list sur 5 ligne, je pense qu'on gagnerait en lisibilité en la déroulant avec une boucle for standard.

Copy link
Contributor

@thconte thconte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modulo la CI

@aminepass aminepass force-pushed the pc-31957/finance-incident-domains-credit branch from 7931b76 to cad9b55 Compare September 20, 2024 10:07
@aminepass aminepass force-pushed the pc-31957/finance-incident-domains-credit branch from cad9b55 to 07361c2 Compare September 20, 2024 10:45
@aminepass aminepass merged commit c285eec into master Sep 20, 2024
23 checks passed
@aminepass aminepass deleted the pc-31957/finance-incident-domains-credit branch September 20, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants