feat: accumulated work — PI-SPI, KYC, RLS, mutuelle parts, comptabilité PDF + startup fixes
## PI-SPI BCEAO (P0.3 — deadline 30/06/2026)
- package payment/pispi/ complet : PispiAuth (OAuth2), PispiClient (HTTP brut),
PispiIso20022Mapper (pacs.008/002), PispiSignatureVerifier (HMAC-SHA256),
PispiWebhookResource (/api/pispi/webhook), DTOs ISO 20022
- PaymentOrchestrator + PaymentProviderRegistry pour l'orchestration multi-provider
- Mode mock automatique si credentials absents (dev)
## KYC AML
- entity/KycDossier, KycResource, KycAmlService + tests
- Migration V38 (create_kyc_dossier_table)
## RLS (PostgreSQL Row-Level Security) — isolation multi-tenant
- RlsConnectionInitializer, RlsContextInterceptor, @RlsEnabled annotation
- Migration V39 (PostgreSQL RLS Tenant Isolation) + V42 (app DB roles)
- Tests unitaires RlsConnectionInitializerTest, RlsContextInterceptorTest
- Tests d'intégration RlsCrossTenantIsolationTest (@QuarkusTest + IntegrationTestProfile)
## Mutuelle — Parts sociales
- entity/mutuelle/parts/ComptePartsSociales, TransactionPartsSociales
- Service, resource, mapper, repository + tests
- InteretsEpargneService + ReleveComptePdfService
## Comptabilité PDF
- ComptabilitePdfService (OpenPDF), ComptabilitePdfResource
- Tests ComptabilitePdfServiceTest, ComptabilitePdfResourceTest
## Migrations Flyway (SYSCOHADA + Keycloak Orgs)
- V36 SYSCOHADA Plan Comptable Complet : seeds comptes standards UEMOA,
trigger init_plan_comptable_organisation, alignement schéma V1 → entités
- V37 keycloak_org_id sur organisations (P0.2 migration KC 26)
- V40 provider_defaut sur FormuleAbonnement
- V41 fcm_token sur utilisateurs (FCM notifications push)
## Fixes startup (SmallRye Config 3.20 + schéma)
- 8× @ConfigProperty(defaultValue = "") → Optional<String>
(firebase, pispi.*, mtnmomo, orange) — empty default rejetés par SmallRye 3.20
- application.properties : mappings secrets env var sous %prod. uniquement
- V36 : drop colonne obsolète 'numero' de V1 quand Hibernate a créé 'numero_compte'
- V36 : remplacement UNIQUE global sur journaux_comptables.code par composite
(organisation_id, code) pour autoriser plusieurs orgs avec code 'ACH'/'VTE'/etc
- V39 : escape placeholder ${VAR} → <VAR> dans lignes commentées
(Flyway parser évalue les placeholders même dans les commentaires)
- V41 : table 'membres' → 'utilisateurs' (nom correct selon entité Membre)
- JournalComptable entity : @UniqueConstraint composite au lieu de unique=true
- MembreResource : example @Schema JSON valide (['...'] → [])
- IntegrationTestProfile : auto-détection Docker via `docker info`, fallback
vers PostgreSQL local sans DevServices
## Dev config
- application-dev.properties : quarkus.devservices.enabled=false +
quarkus.kafka.devservices.enabled=false (pas besoin de Docker pour dev)
- quarkus.flyway.placeholder-replacement=false
- Secrets dev (wave.*, firebase, pispi) en mode mock automatique
## Phase 8 tests (complète)
- 170 fichiers modifiés/ajoutés, 23425+ insertions
- Tests RBAC (@QuarkusTest) pour MembreResource lifecycle
- Tests OrganisationContextFilter multi-org
- Tests SouscriptionQuotaOptionC, KycAmlService, EmailTemplate, etc.
Résultat : Backend démarre en 64s sur port 8085 avec 36 features installées.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,9 @@ public class NotificationService {
|
||||
@Inject
|
||||
KeycloakService keycloakService;
|
||||
|
||||
@Inject
|
||||
FirebasePushService firebasePushService;
|
||||
|
||||
/**
|
||||
* Crée un nouveau template de notification
|
||||
*
|
||||
@@ -91,14 +94,19 @@ public class NotificationService {
|
||||
notificationRepository.persist(notification);
|
||||
LOG.infof("Notification créée avec succès: ID=%s", notification.getId());
|
||||
|
||||
// Envoi immédiat si type EMAIL
|
||||
// Envoi immédiat selon le canal
|
||||
if ("EMAIL".equals(notification.getTypeNotification())) {
|
||||
try {
|
||||
envoyerEmail(notification);
|
||||
} catch (Exception e) {
|
||||
LOG.errorf("Erreur lors de l'envoi de l'email pour la notification %s: %s", notification.getId(),
|
||||
e.getMessage());
|
||||
// On ne relance pas l'exception pour ne pas bloquer la transaction de création
|
||||
}
|
||||
} else if ("PUSH".equals(notification.getTypeNotification())) {
|
||||
try {
|
||||
envoyerPush(notification);
|
||||
} catch (Exception e) {
|
||||
LOG.warnf("Erreur push notification %s (non bloquant): %s", notification.getId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,6 +389,38 @@ public class NotificationService {
|
||||
return notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie une notification push FCM pour une notification.
|
||||
*/
|
||||
private void envoyerPush(Notification notification) {
|
||||
if (notification.getMembre() == null) {
|
||||
LOG.warnf("Impossible d'envoyer le push pour la notification %s : pas de membre", notification.getId());
|
||||
notification.setStatut("ECHEC_ENVOI");
|
||||
notification.setMessageErreur("Pas de membre défini");
|
||||
return;
|
||||
}
|
||||
String fcmToken = notification.getMembre().getFcmToken();
|
||||
if (fcmToken == null || fcmToken.isBlank()) {
|
||||
LOG.debugf("Membre %s sans token FCM — push ignoré", notification.getMembre().getId());
|
||||
notification.setStatut("IGNOREE");
|
||||
notification.setMessageErreur("Pas de token FCM");
|
||||
return;
|
||||
}
|
||||
boolean ok = firebasePushService.envoyerNotification(
|
||||
fcmToken,
|
||||
notification.getSujet(),
|
||||
notification.getCorps(),
|
||||
java.util.Map.of("notificationId", notification.getId().toString()));
|
||||
if (ok) {
|
||||
notification.setStatut("ENVOYEE");
|
||||
notification.setDateEnvoi(java.time.LocalDateTime.now());
|
||||
} else {
|
||||
notification.setStatut("ECHEC_ENVOI");
|
||||
notification.setMessageErreur("FCM: envoi échoué");
|
||||
}
|
||||
notificationRepository.persist(notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie un email pour une notification
|
||||
*/
|
||||
@@ -394,9 +434,12 @@ public class NotificationService {
|
||||
|
||||
try {
|
||||
LOG.infof("Envoi de l'email à %s", notification.getMembre().getEmail());
|
||||
mailer.send(Mail.withText(notification.getMembre().getEmail(),
|
||||
notification.getSujet(),
|
||||
notification.getCorps())); // TODO: Support HTML body if needed
|
||||
String corps = notification.getCorps();
|
||||
boolean isHtml = corps != null && (corps.startsWith("<html") || corps.startsWith("<!DOCTYPE") || corps.startsWith("<HTML"));
|
||||
Mail mail = isHtml
|
||||
? Mail.withHtml(notification.getMembre().getEmail(), notification.getSujet(), corps)
|
||||
: Mail.withText(notification.getMembre().getEmail(), notification.getSujet(), corps);
|
||||
mailer.send(mail);
|
||||
|
||||
notification.setStatut("ENVOYEE");
|
||||
notification.setDateEnvoi(LocalDateTime.now());
|
||||
|
||||
Reference in New Issue
Block a user