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
@@ -160,6 +160,22 @@ public class Licence {
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
@Transient
public BigDecimal getSoldeRestantEngage() {
BigDecimal prixTotal = getPrixTotal();
if (paiements == null || paiements.isEmpty()) {
return prixTotal;
}
BigDecimal totalTousPaiements = paiements.stream()
.map(Paiement::getMontant)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal reste = prixTotal.subtract(totalTousPaiements);
return reste.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : reste;
}
// Getters and Setters
public Long getId() { return id; }