Versione OK Pour l'onglet événements.
This commit is contained in:
@@ -4,6 +4,7 @@ import '../models/membre_model.dart';
|
||||
import '../models/cotisation_model.dart';
|
||||
import '../models/evenement_model.dart';
|
||||
import '../models/wave_checkout_session_model.dart';
|
||||
import '../models/payment_model.dart';
|
||||
import '../network/dio_client.dart';
|
||||
|
||||
/// Service API principal pour communiquer avec le serveur UnionFlow
|
||||
@@ -438,7 +439,7 @@ class ApiService {
|
||||
}) async {
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
'/api/evenements/a-venir',
|
||||
'/api/evenements/a-venir-public',
|
||||
queryParameters: {
|
||||
'page': page,
|
||||
'size': size,
|
||||
@@ -640,4 +641,75 @@ class ApiService {
|
||||
throw _handleDioException(e, 'Erreur lors de la récupération des statistiques');
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PAIEMENTS
|
||||
// ========================================
|
||||
|
||||
/// Initie un paiement
|
||||
Future<PaymentModel> initiatePayment(Map<String, dynamic> paymentData) async {
|
||||
try {
|
||||
final response = await _dio.post('/api/paiements/initier', data: paymentData);
|
||||
return PaymentModel.fromJson(response.data as Map<String, dynamic>);
|
||||
} on DioException catch (e) {
|
||||
throw _handleDioException(e, 'Erreur lors de l\'initiation du paiement');
|
||||
}
|
||||
}
|
||||
|
||||
/// Récupère le statut d'un paiement
|
||||
Future<PaymentModel> getPaymentStatus(String paymentId) async {
|
||||
try {
|
||||
final response = await _dio.get('/api/paiements/$paymentId/statut');
|
||||
return PaymentModel.fromJson(response.data as Map<String, dynamic>);
|
||||
} on DioException catch (e) {
|
||||
throw _handleDioException(e, 'Erreur lors de la vérification du statut');
|
||||
}
|
||||
}
|
||||
|
||||
/// Annule un paiement
|
||||
Future<bool> cancelPayment(String paymentId) async {
|
||||
try {
|
||||
final response = await _dio.post('/api/paiements/$paymentId/annuler');
|
||||
return response.statusCode == 200;
|
||||
} on DioException catch (e) {
|
||||
throw _handleDioException(e, 'Erreur lors de l\'annulation du paiement');
|
||||
}
|
||||
}
|
||||
|
||||
/// Récupère l'historique des paiements
|
||||
Future<List<PaymentModel>> getPaymentHistory(Map<String, dynamic> filters) async {
|
||||
try {
|
||||
final response = await _dio.get('/api/paiements/historique', queryParameters: filters);
|
||||
|
||||
if (response.data is List) {
|
||||
return (response.data as List)
|
||||
.map((json) => PaymentModel.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
throw Exception('Format de réponse invalide pour l\'historique des paiements');
|
||||
} on DioException catch (e) {
|
||||
throw _handleDioException(e, 'Erreur lors de la récupération de l\'historique');
|
||||
}
|
||||
}
|
||||
|
||||
/// Vérifie le statut d'un service de paiement
|
||||
Future<Map<String, dynamic>> checkServiceStatus(String serviceType) async {
|
||||
try {
|
||||
final response = await _dio.get('/api/paiements/services/$serviceType/statut');
|
||||
return response.data as Map<String, dynamic>;
|
||||
} on DioException catch (e) {
|
||||
throw _handleDioException(e, 'Erreur lors de la vérification du service');
|
||||
}
|
||||
}
|
||||
|
||||
/// Récupère les statistiques de paiement
|
||||
Future<Map<String, dynamic>> getPaymentStatistics(Map<String, dynamic> filters) async {
|
||||
try {
|
||||
final response = await _dio.get('/api/paiements/statistiques', queryParameters: filters);
|
||||
return response.data as Map<String, dynamic>;
|
||||
} on DioException catch (e) {
|
||||
throw _handleDioException(e, 'Erreur lors de la récupération des statistiques');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user