## 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>
112 lines
4.1 KiB
Java
112 lines
4.1 KiB
Java
package dev.lions.unionflow.server.resource;
|
|
|
|
import dev.lions.unionflow.server.api.dto.kyc.KycDossierRequest;
|
|
import dev.lions.unionflow.server.api.dto.kyc.KycDossierResponse;
|
|
import dev.lions.unionflow.server.service.KycAmlService;
|
|
import io.quarkus.security.identity.SecurityIdentity;
|
|
import jakarta.annotation.security.RolesAllowed;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.validation.Valid;
|
|
import jakarta.ws.rs.*;
|
|
import jakarta.ws.rs.core.MediaType;
|
|
import jakarta.ws.rs.core.Response;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
|
|
/**
|
|
* Endpoints KYC/AML — gestion des dossiers d'identification et évaluation risque LCB-FT.
|
|
*/
|
|
@Path("/api/kyc")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
public class KycResource {
|
|
|
|
@Inject
|
|
KycAmlService kycAmlService;
|
|
|
|
@Inject
|
|
SecurityIdentity identity;
|
|
|
|
/** Soumet ou met à jour un dossier KYC pour un membre. */
|
|
@POST
|
|
@Path("/dossiers")
|
|
@RolesAllowed({"ADMIN_ORGANISATION", "TRESORIER", "SUPER_ADMIN"})
|
|
public Response soumettre(@Valid KycDossierRequest request) {
|
|
KycDossierResponse response = kycAmlService.soumettreOuMettreAJour(request, identity.getPrincipal().getName());
|
|
return Response.status(Response.Status.CREATED).entity(response).build();
|
|
}
|
|
|
|
/** Récupère le dossier KYC actif d'un membre. */
|
|
@GET
|
|
@Path("/membres/{membreId}")
|
|
@RolesAllowed({"ADMIN_ORGANISATION", "TRESORIER", "SUPER_ADMIN"})
|
|
public Response getDossierActif(@PathParam("membreId") UUID membreId) {
|
|
return kycAmlService.getDossierActif(membreId)
|
|
.map(d -> Response.ok(d).build())
|
|
.orElse(Response.status(Response.Status.NOT_FOUND)
|
|
.entity(Map.of("error", "Aucun dossier KYC actif pour ce membre."))
|
|
.build());
|
|
}
|
|
|
|
/** Évalue le score de risque LCB-FT du membre. */
|
|
@POST
|
|
@Path("/membres/{membreId}/evaluer-risque")
|
|
@RolesAllowed({"ADMIN_ORGANISATION", "TRESORIER", "SUPER_ADMIN"})
|
|
public Response evaluerRisque(@PathParam("membreId") UUID membreId) {
|
|
KycDossierResponse response = kycAmlService.evaluerRisque(membreId);
|
|
return Response.ok(response).build();
|
|
}
|
|
|
|
/** Valide manuellement un dossier KYC (agent habilité). */
|
|
@POST
|
|
@Path("/dossiers/{dossierId}/valider")
|
|
@RolesAllowed({"SUPER_ADMIN", "ADMIN_ORGANISATION"})
|
|
public Response valider(
|
|
@PathParam("dossierId") UUID dossierId,
|
|
@QueryParam("validateurId") UUID validateurId,
|
|
@QueryParam("notes") String notes) {
|
|
KycDossierResponse response = kycAmlService.valider(
|
|
dossierId, validateurId, notes, identity.getPrincipal().getName());
|
|
return Response.ok(response).build();
|
|
}
|
|
|
|
/** Refuse un dossier KYC avec motif. */
|
|
@POST
|
|
@Path("/dossiers/{dossierId}/refuser")
|
|
@RolesAllowed({"SUPER_ADMIN", "ADMIN_ORGANISATION"})
|
|
public Response refuser(
|
|
@PathParam("dossierId") UUID dossierId,
|
|
@QueryParam("validateurId") UUID validateurId,
|
|
@QueryParam("motif") String motif) {
|
|
KycDossierResponse response = kycAmlService.refuser(
|
|
dossierId, validateurId, motif, identity.getPrincipal().getName());
|
|
return Response.ok(response).build();
|
|
}
|
|
|
|
/** Liste les dossiers KYC en attente de validation. */
|
|
@GET
|
|
@Path("/dossiers/en-attente")
|
|
@RolesAllowed({"SUPER_ADMIN", "ADMIN_ORGANISATION"})
|
|
public List<KycDossierResponse> getDossiersEnAttente() {
|
|
return kycAmlService.getDossiersEnAttente();
|
|
}
|
|
|
|
/** Liste les membres PEP (Personnes Exposées Politiquement). */
|
|
@GET
|
|
@Path("/pep")
|
|
@RolesAllowed({"SUPER_ADMIN"})
|
|
public List<KycDossierResponse> getPep() {
|
|
return kycAmlService.getDossiersPep();
|
|
}
|
|
|
|
/** Pièces d'identité expirant dans les 30 jours. */
|
|
@GET
|
|
@Path("/pieces-expirant-bientot")
|
|
@RolesAllowed({"SUPER_ADMIN", "ADMIN_ORGANISATION", "TRESORIER"})
|
|
public List<KycDossierResponse> getPiecesExpirant() {
|
|
return kycAmlService.getPiecesExpirantDansLes30Jours();
|
|
}
|
|
}
|