fix: corriger 5 erreurs compilation mock-complete
1. confirmerMockPaiement() placé HORS de la classe → déplacé à l'intérieur (contribution_repository.dart + transaction_epargne_repository.dart) 2. result.clientReference?.isNotEmpty → null-safe avec ?. 3. IContributionRepository n'a pas confirmerMockPaiement → cast vers ContributionRepository (implémentation) avec check is 4. Import data/repositories ajouté dans payment_dialog.dart
This commit is contained in:
@@ -368,7 +368,6 @@ class ContributionRepositoryImpl implements IContributionRepository {
|
|||||||
}
|
}
|
||||||
throw Exception('Erreur lors de la génération');
|
throw Exception('Erreur lors de la génération');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Confirme un paiement mock (mode dev) côté backend.
|
/// Confirme un paiement mock (mode dev) côté backend.
|
||||||
/// Appelle GET /api/wave-redirect/mock-complete?ref={id}
|
/// Appelle GET /api/wave-redirect/mock-complete?ref={id}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import '../../bloc/contributions_bloc.dart';
|
|||||||
import '../../bloc/contributions_event.dart';
|
import '../../bloc/contributions_event.dart';
|
||||||
import '../../data/models/contribution_model.dart';
|
import '../../data/models/contribution_model.dart';
|
||||||
import '../../domain/repositories/contribution_repository.dart';
|
import '../../domain/repositories/contribution_repository.dart';
|
||||||
|
import '../../data/repositories/contribution_repository.dart';
|
||||||
|
|
||||||
/// Dialogue de paiement de contribution
|
/// Dialogue de paiement de contribution
|
||||||
class PaymentDialog extends StatefulWidget {
|
class PaymentDialog extends StatefulWidget {
|
||||||
@@ -452,11 +453,16 @@ class _PaymentDialogState extends State<PaymentDialog> {
|
|||||||
final isMock = url.contains('mock') || url.contains('localhost') || !AppConfig.isProd;
|
final isMock = url.contains('mock') || url.contains('localhost') || !AppConfig.isProd;
|
||||||
if (isMock) {
|
if (isMock) {
|
||||||
// Confirmer côté backend pour que la cotisation soit réellement payée
|
// Confirmer côté backend pour que la cotisation soit réellement payée
|
||||||
final ref = result.clientReference.isNotEmpty ? result.clientReference : result.intentionPaiementId;
|
final ref = (result.clientReference?.isNotEmpty == true)
|
||||||
|
? result.clientReference!
|
||||||
|
: (result.intentionPaiementId ?? '');
|
||||||
if (ref.isNotEmpty) {
|
if (ref.isNotEmpty) {
|
||||||
try {
|
try {
|
||||||
final mockRepo = getIt<IContributionRepository>();
|
final repo = getIt<IContributionRepository>();
|
||||||
await mockRepo.confirmerMockPaiement(ref);
|
// Appel direct via l'implémentation (confirmerMockPaiement n'est pas dans l'interface)
|
||||||
|
if (repo is ContributionRepository) {
|
||||||
|
await repo.confirmerMockPaiement(ref);
|
||||||
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
await Future.delayed(const Duration(milliseconds: 400));
|
await Future.delayed(const Duration(milliseconds: 400));
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ class TransactionEpargneRepository {
|
|||||||
versementId: data['versementId'] as String? ?? data['clientReference'] as String? ?? '',
|
versementId: data['versementId'] as String? ?? data['clientReference'] as String? ?? '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Confirme un paiement mock (mode dev) côté backend.
|
/// Confirme un paiement mock (mode dev) côté backend.
|
||||||
/// Appelle GET /api/wave-redirect/mock-complete?ref={id}
|
/// Appelle GET /api/wave-redirect/mock-complete?ref={id}
|
||||||
|
|||||||
Reference in New Issue
Block a user