makePayment method
Implementation
Future<Map<String, dynamic>> makePayment(
BuildContext context,
int amount,
bool sandbox,
String storeName,
String color,
String logoUrl, {
String? callbackUrl,
}) async {
if (amount <= 0) {
return {'success': false, 'error': 'Le montant doit être supérieur à 0'};
}
if (publicKey.isEmpty) {
return {'success': false, 'error': 'La clé publique est requise'};
}
try {
final result = await Navigator.of(context).push<Map<String, dynamic>>(
MaterialPageRoute(
fullscreenDialog: true,
builder: (context) => IntramWebViewPayment(
publicKey: publicKey,
amount: amount,
sandbox: sandbox,
companyName: storeName,
color: color,
logoUrl: logoUrl,
callbackUrl: callbackUrl,
onPaymentComplete: (result) {},
),
),
);
return result ?? {'success': false, 'cancelled': true};
} catch (e) {
return {'success': false, 'error': 'Erreur lors de l\'ouverture du paiement: $e'};
}
}