feat(paiement): plafonner la saisie des paiements en incluant les paiements non remis
AS Talange CI/CD Pipeline / Build & Run Unit Tests (push) Successful in 5m31s
AS Talange CI/CD Pipeline / Deploy to Test Environment (push) Successful in 6m18s

This commit is contained in:
2026-08-08 00:23:27 +02:00
parent be1ec1c96a
commit 1e2bc23603
5 changed files with 32 additions and 13 deletions
@@ -63,9 +63,10 @@ public class PaiementController {
log.info(">>> [PaiementController] Demande de création de paiement reçue pour Licence ID: {}, Adhérent ID: {}, Montant: {} €, Remis: {}", id, adherentId, montant, remis);
// Validation basique pour ne pas payer plus que le reste à payer
if (montant.compareTo(licence.getResteAPayer()) > 0) {
montant = licence.getResteAPayer();
// Validation pour ne pas dépasser le tarif global (tous paiements remis ou non inclus)
BigDecimal maxAutorise = licence.getSoldeRestantEngage();
if (montant.compareTo(maxAutorise) > 0) {
montant = maxAutorise;
}
if (montant.compareTo(BigDecimal.ZERO) > 0) {
@@ -128,9 +129,8 @@ public class PaiementController {
Licence licence = paiement.getLicence();
// Validation basique pour ne pas dépasser le montant total de la licence
BigDecimal currentContribution = Boolean.TRUE.equals(paiement.getRemis()) ? paiement.getMontant() : BigDecimal.ZERO;
BigDecimal maxAmount = licence.getResteAPayer().add(currentContribution);
// Validation pour ne pas dépasser le tarif global (tous paiements remis ou non inclus)
BigDecimal maxAmount = licence.getSoldeRestantEngage().add(paiement.getMontant());
if (montant.compareTo(maxAmount) > 0) {
montant = maxAmount;
}