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:
@@ -0,0 +1,170 @@
|
||||
package dev.lions.unionflow.server.entity;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@DisplayName("MembreSuivi entity")
|
||||
class MembreSuiviTest {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// No-args constructor
|
||||
// -------------------------------------------------------------------------
|
||||
@Test
|
||||
@DisplayName("no-args constructor creates instance with null UUIDs")
|
||||
void noArgsConstructor_createsInstanceWithNullFields() {
|
||||
MembreSuivi suivi = new MembreSuivi();
|
||||
|
||||
assertThat(suivi).isNotNull();
|
||||
assertThat(suivi.getFollowerUtilisateurId()).isNull();
|
||||
assertThat(suivi.getSuiviUtilisateurId()).isNull();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// All-args constructor
|
||||
// -------------------------------------------------------------------------
|
||||
@Test
|
||||
@DisplayName("all-args constructor sets all fields")
|
||||
void allArgsConstructor_setsAllFields() {
|
||||
UUID followerId = UUID.randomUUID();
|
||||
UUID suiviId = UUID.randomUUID();
|
||||
|
||||
MembreSuivi suivi = new MembreSuivi(followerId, suiviId);
|
||||
|
||||
assertThat(suivi.getFollowerUtilisateurId()).isEqualTo(followerId);
|
||||
assertThat(suivi.getSuiviUtilisateurId()).isEqualTo(suiviId);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Builder
|
||||
// -------------------------------------------------------------------------
|
||||
@Nested
|
||||
@DisplayName("Builder")
|
||||
class BuilderTests {
|
||||
|
||||
@Test
|
||||
@DisplayName("builder sets followerUtilisateurId")
|
||||
void builder_setsFollowerUtilisateurId() {
|
||||
UUID id = UUID.randomUUID();
|
||||
MembreSuivi suivi = MembreSuivi.builder()
|
||||
.followerUtilisateurId(id)
|
||||
.build();
|
||||
|
||||
assertThat(suivi.getFollowerUtilisateurId()).isEqualTo(id);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("builder sets suiviUtilisateurId")
|
||||
void builder_setsSuiviUtilisateurId() {
|
||||
UUID id = UUID.randomUUID();
|
||||
MembreSuivi suivi = MembreSuivi.builder()
|
||||
.suiviUtilisateurId(id)
|
||||
.build();
|
||||
|
||||
assertThat(suivi.getSuiviUtilisateurId()).isEqualTo(id);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("builder sets both UUID fields")
|
||||
void builder_setsBothUuidFields() {
|
||||
UUID followerId = UUID.fromString("11111111-1111-1111-1111-111111111111");
|
||||
UUID suiviId = UUID.fromString("22222222-2222-2222-2222-222222222222");
|
||||
|
||||
MembreSuivi suivi = MembreSuivi.builder()
|
||||
.followerUtilisateurId(followerId)
|
||||
.suiviUtilisateurId(suiviId)
|
||||
.build();
|
||||
|
||||
assertThat(suivi.getFollowerUtilisateurId()).isEqualTo(followerId);
|
||||
assertThat(suivi.getSuiviUtilisateurId()).isEqualTo(suiviId);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Getters / Setters
|
||||
// -------------------------------------------------------------------------
|
||||
@Nested
|
||||
@DisplayName("Getters and Setters")
|
||||
class GettersSettersTests {
|
||||
|
||||
@Test
|
||||
@DisplayName("setFollowerUtilisateurId / getFollowerUtilisateurId round-trips")
|
||||
void followerUtilisateurId_roundTrips() {
|
||||
UUID id = UUID.randomUUID();
|
||||
MembreSuivi suivi = new MembreSuivi();
|
||||
suivi.setFollowerUtilisateurId(id);
|
||||
assertThat(suivi.getFollowerUtilisateurId()).isEqualTo(id);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("setSuiviUtilisateurId / getSuiviUtilisateurId round-trips")
|
||||
void suiviUtilisateurId_roundTrips() {
|
||||
UUID id = UUID.randomUUID();
|
||||
MembreSuivi suivi = new MembreSuivi();
|
||||
suivi.setSuiviUtilisateurId(id);
|
||||
assertThat(suivi.getSuiviUtilisateurId()).isEqualTo(id);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("follower and suivi IDs can be different")
|
||||
void followerAndSuivi_canBeDifferent() {
|
||||
UUID followerId = UUID.randomUUID();
|
||||
UUID suiviId = UUID.randomUUID();
|
||||
MembreSuivi suivi = new MembreSuivi();
|
||||
suivi.setFollowerUtilisateurId(followerId);
|
||||
suivi.setSuiviUtilisateurId(suiviId);
|
||||
|
||||
assertThat(suivi.getFollowerUtilisateurId()).isNotEqualTo(suivi.getSuiviUtilisateurId());
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// UUID id (inherited from BaseEntity)
|
||||
// -------------------------------------------------------------------------
|
||||
@Test
|
||||
@DisplayName("UUID id field is settable and gettable")
|
||||
void uuidId_settableAndGettable() {
|
||||
UUID id = UUID.randomUUID();
|
||||
MembreSuivi suivi = new MembreSuivi();
|
||||
suivi.setId(id);
|
||||
assertThat(suivi.getId()).isEqualTo(id);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// equals / hashCode
|
||||
// -------------------------------------------------------------------------
|
||||
@Test
|
||||
@DisplayName("two instances with the same field values are equal")
|
||||
void equals_sameValues_areEqual() {
|
||||
UUID followerId = UUID.randomUUID();
|
||||
UUID suiviId = UUID.randomUUID();
|
||||
|
||||
MembreSuivi a = new MembreSuivi(followerId, suiviId);
|
||||
MembreSuivi b = new MembreSuivi(followerId, suiviId);
|
||||
|
||||
assertThat(a).isEqualTo(b);
|
||||
assertThat(a.hashCode()).isEqualTo(b.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("two instances with different follower IDs are not equal")
|
||||
void equals_differentFollowerId_notEqual() {
|
||||
UUID suiviId = UUID.randomUUID();
|
||||
MembreSuivi a = new MembreSuivi(UUID.randomUUID(), suiviId);
|
||||
MembreSuivi b = new MembreSuivi(UUID.randomUUID(), suiviId);
|
||||
|
||||
assertThat(a).isNotEqualTo(b);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("toString contains field values")
|
||||
void toString_containsFields() {
|
||||
UUID followerId = UUID.fromString("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa");
|
||||
MembreSuivi suivi = MembreSuivi.builder().followerUtilisateurId(followerId).build();
|
||||
assertThat(suivi.toString()).contains("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user