feat(paiement): track payment manager (gestionnaire) in history
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import java.security.Principal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
@@ -34,7 +35,8 @@ public class PaiementController {
|
||||
@RequestParam Long adherentId,
|
||||
@RequestParam BigDecimal montant,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate datePaiement,
|
||||
@RequestParam Long modePaiementId) {
|
||||
@RequestParam Long modePaiementId,
|
||||
Principal principal) {
|
||||
|
||||
Licence licence = licenceRepository.findById(id)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Invalid Licence ID"));
|
||||
@@ -52,6 +54,9 @@ public class PaiementController {
|
||||
paiement.setModePaiement(mode);
|
||||
paiement.setMontant(montant);
|
||||
paiement.setDatePaiement(datePaiement);
|
||||
if (principal != null) {
|
||||
paiement.setGestionnaire(principal.getName());
|
||||
}
|
||||
paiementRepository.save(paiement);
|
||||
}
|
||||
|
||||
@@ -64,7 +69,8 @@ public class PaiementController {
|
||||
@RequestParam BigDecimal montant,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate datePaiement,
|
||||
@RequestParam Long modePaiementId,
|
||||
@RequestParam(required = false) String redirect) {
|
||||
@RequestParam(required = false) String redirect,
|
||||
Principal principal) {
|
||||
|
||||
Paiement paiement = paiementRepository.findById(id)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Invalid Paiement ID"));
|
||||
@@ -84,6 +90,9 @@ public class PaiementController {
|
||||
paiement.setModePaiement(mode);
|
||||
paiement.setMontant(montant);
|
||||
paiement.setDatePaiement(datePaiement);
|
||||
if (principal != null) {
|
||||
paiement.setGestionnaire(principal.getName());
|
||||
}
|
||||
paiementRepository.save(paiement);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user