diff --git a/lib/features/myfatoorah/myfatoorah_view_model.dart b/lib/features/myfatoorah/myfatoorah_view_model.dart index fb7a23fa..b76b251e 100644 --- a/lib/features/myfatoorah/myfatoorah_view_model.dart +++ b/lib/features/myfatoorah/myfatoorah_view_model.dart @@ -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); }); diff --git a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart index 40a79370..2147cbd6 100644 --- a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart +++ b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart @@ -71,6 +71,11 @@ class _ImmediateLiveCarePaymentPageState extends State= myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel!.minLimit!.amount! && @@ -755,7 +760,7 @@ class _ImmediateLiveCarePaymentPageState extends State