feat: add pay information to licence

This commit is contained in:
2025-08-13 22:05:19 +02:00
parent 09f6cd7463
commit 0563c7c8de
12 changed files with 114 additions and 71 deletions

View File

@@ -78,6 +78,7 @@ public class LicenceService {
model.setSaison(form.getSaison());
model.setCertificate(form.getCertificate());
model.setValidate(form.isValidate());
model.setPay(form.isPay());
return Panache.withTransaction(() -> repository.persist(model)
.call(m -> m.isValidate() ? Uni.createFrom().item(membreModel)
.call(genLicenceNumberAndAccountIfNeed())
@@ -88,6 +89,7 @@ public class LicenceService {
return repository.findById(form.getId()).chain(model -> {
model.setCertificate(form.getCertificate());
model.setValidate(form.isValidate());
model.setPay(form.isPay());
return Panache.withTransaction(() -> repository.persist(model)
.call(m -> m.isValidate() ? Mutiny.fetch(m.getMembre())
.call(genLicenceNumberAndAccountIfNeed())
@@ -143,6 +145,8 @@ public class LicenceService {
.invoke(Unchecked.consumer(licenceModel -> {
if (licenceModel.isValidate())
throw new DBadRequestException("Impossible de supprimer une licence déjà validée");
if (licenceModel.isPay())
throw new DBadRequestException("Impossible de supprimer une licence déjà payée");
}))
.chain(__ -> Panache.withTransaction(() -> repository.deleteById(id)));
}