|
|
|
|
@ -133,21 +133,27 @@ class MyFatoorahViewModel extends ChangeNotifier {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initApplePayPayment(num invoiceValue, MFApplePayButton mfApplePayButton) async {
|
|
|
|
|
executeApplePayPayment() {
|
|
|
|
|
MFApplepay.executeApplePayPayment(onInvoiceCreated: (invoiceID) {
|
|
|
|
|
log(
|
|
|
|
|
invoiceID.toString(),
|
|
|
|
|
);
|
|
|
|
|
}).then((value) {
|
|
|
|
|
log(
|
|
|
|
|
value.toString(),
|
|
|
|
|
);
|
|
|
|
|
}).catchError((error) {
|
|
|
|
|
log(error.message);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initApplePayPayment(num invoiceValue) async {
|
|
|
|
|
await MFSDK.init(MyFatoorahConfig.configAPIKey, ApiConsts.myFatoorahCountry, ApiConsts.myFatoorahEnvironmentType);
|
|
|
|
|
|
|
|
|
|
await MFSDK.initSession(MFInitiateSessionRequest(), MFLanguage.ENGLISH).then((value) async {
|
|
|
|
|
var executePaymentRequest = MFExecutePaymentRequest(invoiceValue: 121, displayCurrencyIso: MFCurrencyISO.KUWAIT_KWD);
|
|
|
|
|
|
|
|
|
|
await mfApplePayButton.executeApplePayButton(
|
|
|
|
|
executePaymentRequest,
|
|
|
|
|
(String invoiceId) {
|
|
|
|
|
print("Payment Success! Invoice ID: $invoiceId");
|
|
|
|
|
},
|
|
|
|
|
).catchError((error) {
|
|
|
|
|
// If initialized properly, this error won't occur
|
|
|
|
|
print("Apple Pay Error: ${error.message}");
|
|
|
|
|
});
|
|
|
|
|
var executePaymentRequest = MFExecutePaymentRequest(invoiceValue: invoiceValue, sessionId: value.sessionId, displayCurrencyIso: MFCurrencyISO.SAUDIARABIA_SAR);
|
|
|
|
|
|
|
|
|
|
MFApplepay.setupApplePay(value, executePaymentRequest, MFLanguage.ENGLISH, merchantName: "Dr Sulaiman Al Habib");
|
|
|
|
|
}).catchError((error) {
|
|
|
|
|
log(error.message);
|
|
|
|
|
});
|
|
|
|
|
|