fix(paiement): envoi de l'email de confirmation uniquement si le paiement est remis
This commit is contained in:
@@ -124,6 +124,7 @@ public class PaiementController {
|
||||
|
||||
BigDecimal ancienMontant = paiement.getMontant();
|
||||
String ancienMode = paiement.getModePaiement().getNom();
|
||||
Boolean ancienRemis = paiement.getRemis();
|
||||
|
||||
Licence licence = paiement.getLicence();
|
||||
|
||||
@@ -154,6 +155,16 @@ public class PaiementController {
|
||||
auditLog.setAdherentNomComplet(licence.getAdherent().getNom() + " " + licence.getAdherent().getPrenom());
|
||||
auditLog.setDetails("Modification du paiement: montant " + ancienMontant + "€ -> " + montant + "€, mode " + ancienMode + " -> " + mode.getNom() + ", remis -> " + (Boolean.TRUE.equals(remis) ? "Oui" : "Non"));
|
||||
auditLogPaiementRepository.save(auditLog);
|
||||
|
||||
// Si le paiement passe de non remis (ex: Chèque Sport mairie) à remis (Oui), envoyer l'email de confirmation
|
||||
if (Boolean.FALSE.equals(ancienRemis) && Boolean.TRUE.equals(remis)) {
|
||||
try {
|
||||
log.info("Appel de sendPaiementConfirmation depuis updatePaiement (passage de remis=false à remis=true) pour le paiement ID: {}", paiement.getId());
|
||||
paiementEmailService.sendPaiementConfirmation(paiement);
|
||||
} catch (Exception e) {
|
||||
log.error("Erreur lors de l'envoi de l'e-mail de confirmation après la remise du paiement ID {}: ", id, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (redirect != null && !redirect.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user