fix(wave-mock): appeler mock-complete backend pour créditer réellement les comptes
Le mock simulait seulement l'UI mais n'appelait pas le backend pour
confirmer le paiement → le solde restait à 0 après dépôt simulé.
Fix : en mode mock, après la simulation UI, appeler
GET /api/wave-redirect/mock-complete?ref={id} qui :
- Marque l'intention de paiement comme complétée
- Crédite le compte épargne (pour les dépôts)
- Enregistre le paiement de cotisation (pour les cotisations)
Changements :
- depot_epargne_dialog : appelle confirmerMockPaiement(versementId)
- payment_dialog : appelle confirmerMockPaiement(clientReference)
- transaction_epargne_repository : nouvelle méthode confirmerMockPaiement()
+ versementId ajouté à DepotWaveResult
- contribution_repository : nouvelle méthode confirmerMockPaiement()
+ intentionPaiementId ajouté à WavePaiementInitResult
This commit is contained in:
@@ -292,6 +292,7 @@ class ContributionRepositoryImpl implements IContributionRepository {
|
||||
waveLaunchUrl: data['waveLaunchUrl'] as String? ?? data['redirectUrl'] as String? ?? '',
|
||||
waveCheckoutSessionId: data['waveCheckoutSessionId'] as String?,
|
||||
clientReference: data['clientReference'] as String?,
|
||||
intentionPaiementId: data['intentionPaiementId'] as String? ?? data['clientReference'] as String?,
|
||||
message: data['message'] as String? ?? 'Ouvrez Wave pour confirmer le paiement.',
|
||||
);
|
||||
}
|
||||
@@ -369,12 +370,20 @@ class ContributionRepositoryImpl implements IContributionRepository {
|
||||
}
|
||||
}
|
||||
|
||||
/// Confirme un paiement mock (mode dev) côté backend.
|
||||
/// Appelle GET /api/wave-redirect/mock-complete?ref={id}
|
||||
Future<void> confirmerMockPaiement(String ref) async {
|
||||
await _apiClient.get('/api/wave-redirect/mock-complete', queryParameters: {'ref': ref});
|
||||
}
|
||||
}
|
||||
|
||||
/// Résultat de l'initiation d'un paiement Wave (redirection vers l'app Wave).
|
||||
class WavePaiementInitResult {
|
||||
final String redirectUrl;
|
||||
final String waveLaunchUrl;
|
||||
final String? waveCheckoutSessionId;
|
||||
final String? clientReference;
|
||||
final String? intentionPaiementId;
|
||||
final String message;
|
||||
|
||||
const WavePaiementInitResult({
|
||||
@@ -382,6 +391,7 @@ class WavePaiementInitResult {
|
||||
required this.waveLaunchUrl,
|
||||
this.waveCheckoutSessionId,
|
||||
this.clientReference,
|
||||
this.intentionPaiementId,
|
||||
required this.message,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user