|
|
|
|
@ -13,6 +13,7 @@ import 'package:hmg_patient_app_new/core/dependencies.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/enums.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/myfatoorah/myfatoorah_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
|
@ -33,6 +34,7 @@ import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/in_app_browser/InAppBrowser.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
|
|
|
|
import 'package:myfatoorah_flutter/MFEnums.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:smooth_corner/smooth_corner.dart';
|
|
|
|
|
|
|
|
|
|
@ -49,6 +51,7 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
|
|
|
|
|
late MyAppointmentsViewModel myAppointmentsViewModel;
|
|
|
|
|
late AppState appState;
|
|
|
|
|
late PayTabsViewModel paytabsViewModel;
|
|
|
|
|
late MyFatoorahViewModel myFatoorahViewModel;
|
|
|
|
|
|
|
|
|
|
MyInAppBrowser? browser;
|
|
|
|
|
String selectedPaymentMethod = "";
|
|
|
|
|
@ -85,6 +88,7 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
|
|
|
|
|
immediateLiveCareViewModel = Provider.of<ImmediateLiveCareViewModel>(context, listen: false);
|
|
|
|
|
payfortViewModel = Provider.of<PayfortViewModel>(context, listen: false);
|
|
|
|
|
paytabsViewModel = Provider.of<PayTabsViewModel>(context, listen: false);
|
|
|
|
|
myFatoorahViewModel = Provider.of<MyFatoorahViewModel>(context, listen: false);
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
|
|
|
body: Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
|
|
|
|
|
@ -298,7 +302,26 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
|
|
|
|
|
).paddingSymmetrical(16.h, 16.h),
|
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() async {
|
|
|
|
|
selectedPaymentMethod = "VISA";
|
|
|
|
|
if (appState.isPaytabsEnabled) {
|
|
|
|
|
if (appState.isMyFatoorahEnabled) {
|
|
|
|
|
myFatoorahViewModel.initiateCardPayment(
|
|
|
|
|
amount: num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
|
|
|
|
|
paymentDescription: "LiveCare Payment",
|
|
|
|
|
displayCurrencyIso: appState.getAuthenticatedUser()!.outSa == 0
|
|
|
|
|
? ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat
|
|
|
|
|
? MFCurrencyISO.KUWAIT_KWD
|
|
|
|
|
: MFCurrencyISO.SAUDIARABIA_SAR
|
|
|
|
|
: MFCurrencyISO.UAE_AED,
|
|
|
|
|
onSuccess: (response) {},
|
|
|
|
|
onError: (errMessage) {
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: errMessage.toString()),
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
} else if (appState.isPaytabsEnabled) {
|
|
|
|
|
transID = Utils.getAppointmentTransID(
|
|
|
|
|
immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID!,
|
|
|
|
|
ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12,
|
|
|
|
|
|