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:
dahoud
2026-04-21 12:40:55 +00:00
parent 9a53ce4077
commit 31330d95e9
170 changed files with 23425 additions and 873 deletions

View File

@@ -88,6 +88,9 @@ public class SouscriptionService {
@Inject
MembreKeycloakSyncService keycloakSyncService;
@Inject
EmailTemplateService emailTemplateService;
// ── Catalogue ─────────────────────────────────────────────────────────────
/**
@@ -302,6 +305,9 @@ public class SouscriptionService {
} catch (Exception e) {
LOG.errorf("Activation compte échouée après paiement souscription=%s: %s — la souscription reste VALIDEE", souscriptionId, e.getMessage());
}
// Email de confirmation de souscription (non bloquant)
envoyerEmailSouscriptionActive(souscription, dateDebut, dateFin);
}
// ── Validation SuperAdmin ──────────────────────────────────────────────────
@@ -399,6 +405,9 @@ public class SouscriptionService {
// Activer le membre admin de l'organisation
activerAdminOrganisation(souscription.getOrganisation().getId());
// Email de confirmation de souscription (non bloquant)
envoyerEmailSouscriptionActive(souscription, dateDebut, dateFin);
LOG.infof("Souscription %s approuvée — compte actif jusqu'au %s", souscriptionId, dateFin);
}
@@ -615,6 +624,34 @@ public class SouscriptionService {
}
}
// ── Email notifications ───────────────────────────────────────────────────
private void envoyerEmailSouscriptionActive(SouscriptionOrganisation s,
LocalDate dateDebut, LocalDate dateFin) {
try {
String email = securiteHelper.resolveEmail();
if (email == null) return;
Membre admin = membreRepository.findByEmail(email).orElse(null);
if (admin == null || admin.getEmail() == null) return;
FormuleAbonnement f = s.getFormule();
emailTemplateService.envoyerConfirmationSouscription(
admin.getEmail(),
(admin.getPrenom() != null ? admin.getPrenom() : "") + " " + (admin.getNom() != null ? admin.getNom() : ""),
s.getOrganisation() != null ? s.getOrganisation().getNom() : "",
f != null && f.getLibelle() != null ? f.getLibelle() : "",
s.getMontantTotal() != null ? s.getMontantTotal() : BigDecimal.ZERO,
s.getTypePeriode() != null ? s.getTypePeriode().name() : "MENSUEL",
dateDebut, dateFin,
f != null ? f.getMaxMembres() : null,
f != null ? f.getMaxStockageMo() : null,
f != null && Boolean.TRUE.equals(f.getApiAccess()),
f != null && Boolean.TRUE.equals(f.getSupportPrioritaire()));
} catch (Exception e) {
LOG.warnf("Email souscription ignoré (non bloquant) : %s", e.getMessage());
}
}
// ── Matrice tarifaire de référence ────────────────────────────────────────
/**