Intégration fonctionnalites V1
This commit is contained in:
@@ -4,6 +4,7 @@ import '../../../core/api/api_client.dart';
|
||||
import '../../../core/api/api_endpoints.dart';
|
||||
import '../../../core/api/api_response.dart';
|
||||
import '../../../core/auth/auth_provider.dart';
|
||||
import '../domain/payment.dart';
|
||||
import '../domain/wallet.dart';
|
||||
|
||||
/// Dépôt de données pour le portefeuille électronique.
|
||||
@@ -26,6 +27,31 @@ class WalletRepository {
|
||||
.map((json) => WalletTransaction.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<PaymentTransaction> initiateTopUp({
|
||||
required double amount,
|
||||
required String idempotencyKey,
|
||||
}) async {
|
||||
final response = await _apiClient.post(
|
||||
ApiEndpoints.walletTopUpInitiate,
|
||||
data: {
|
||||
'amount': amount,
|
||||
'idempotency_key': idempotencyKey,
|
||||
},
|
||||
);
|
||||
|
||||
final json = ApiResponse.object(response.data, 'payment');
|
||||
return PaymentTransaction.fromJson(json);
|
||||
}
|
||||
|
||||
Future<TopUpResult> confirmTopUp({required String paymentUuid}) async {
|
||||
final response = await _apiClient.post(
|
||||
ApiEndpoints.walletTopUpConfirm,
|
||||
data: {'payment_uuid': paymentUuid},
|
||||
);
|
||||
|
||||
return TopUpResult.fromJson(ApiResponse.payload(response.data));
|
||||
}
|
||||
}
|
||||
|
||||
final walletRepositoryProvider = Provider<WalletRepository>((ref) {
|
||||
|
||||
Reference in New Issue
Block a user