|  |  |  | @ -98,7 +98,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> { | 
		
	
		
			
				|  |  |  |  |                       ).paddingSymmetrical(16.h, 16.h), | 
		
	
		
			
				|  |  |  |  |                     ).paddingSymmetrical(24.h, 0.h).onPress(() { | 
		
	
		
			
				|  |  |  |  |                       selectedPaymentMethod = "MADA"; | 
		
	
		
			
				|  |  |  |  |                       // openPaymentURL("mada"); | 
		
	
		
			
				|  |  |  |  |                       openPaymentURL("mada"); | 
		
	
		
			
				|  |  |  |  |                     }), | 
		
	
		
			
				|  |  |  |  |                     SizedBox(height: 16.h), | 
		
	
		
			
				|  |  |  |  |                     Container( | 
		
	
	
		
			
				
					|  |  |  | @ -137,7 +137,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> { | 
		
	
		
			
				|  |  |  |  |                       ).paddingSymmetrical(16.h, 16.h), | 
		
	
		
			
				|  |  |  |  |                     ).paddingSymmetrical(24.h, 0.h).onPress(() { | 
		
	
		
			
				|  |  |  |  |                       selectedPaymentMethod = "VISA"; | 
		
	
		
			
				|  |  |  |  |                       // openPaymentURL("visa"); | 
		
	
		
			
				|  |  |  |  |                       openPaymentURL("visa"); | 
		
	
		
			
				|  |  |  |  |                     }), | 
		
	
		
			
				|  |  |  |  |                   ], | 
		
	
		
			
				|  |  |  |  |                 ), | 
		
	
	
		
			
				
					|  |  |  | @ -188,7 +188,9 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> { | 
		
	
		
			
				|  |  |  |  |                       ).paddingSymmetrical(24.h, 0.h).onPress(() { | 
		
	
		
			
				|  |  |  |  |                         if (Utils.havePrivilege(103)) { | 
		
	
		
			
				|  |  |  |  |                           startApplePay(); | 
		
	
		
			
				|  |  |  |  |                         } else {} | 
		
	
		
			
				|  |  |  |  |                         } else { | 
		
	
		
			
				|  |  |  |  |                           openPaymentURL("applepay"); | 
		
	
		
			
				|  |  |  |  |                         } | 
		
	
		
			
				|  |  |  |  |                       }) | 
		
	
		
			
				|  |  |  |  |                     : SizedBox(height: 12.h), | 
		
	
		
			
				|  |  |  |  |                 SizedBox(height: 32.h), | 
		
	
	
		
			
				
					|  |  |  | @ -285,101 +287,137 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> { | 
		
	
		
			
				|  |  |  |  |   void checkPaymentStatus() async { | 
		
	
		
			
				|  |  |  |  |     LoaderBottomSheet.showLoader(); | 
		
	
		
			
				|  |  |  |  |     await payfortViewModel.checkPaymentStatus( | 
		
	
		
			
				|  |  |  |  |         transactionID: transID, | 
		
	
		
			
				|  |  |  |  |         onSuccess: (apiResponse) async { | 
		
	
		
			
				|  |  |  |  |           print(apiResponse.data); | 
		
	
		
			
				|  |  |  |  |           if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") { | 
		
	
		
			
				|  |  |  |  |             await habibWalletVM.HISCreateAdvancePayment( | 
		
	
		
			
				|  |  |  |  |                 paymentMethodName: selectedPaymentMethod, | 
		
	
		
			
				|  |  |  |  |                 paidAmount: habibWalletVM.walletRechargeAmount, | 
		
	
		
			
				|  |  |  |  |                 paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, | 
		
	
		
			
				|  |  |  |  |                 patientID: habibWalletVM.fileNumber, | 
		
	
		
			
				|  |  |  |  |                 projectID: habibWalletVM.selectedHospital!.iD!, | 
		
	
		
			
				|  |  |  |  |                 depositorName: habibWalletVM.depositorName, | 
		
	
		
			
				|  |  |  |  |                 onSuccess: (value) async { | 
		
	
		
			
				|  |  |  |  |                   await habibWalletVM.addAdvanceNumberRequest( | 
		
	
		
			
				|  |  |  |  |                       advanceNumber: Utils.isVidaPlusProject(habibWalletVM.selectedHospital!.iD) | 
		
	
		
			
				|  |  |  |  |                           ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() | 
		
	
		
			
				|  |  |  |  |                           : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), | 
		
	
		
			
				|  |  |  |  |                       paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, | 
		
	
		
			
				|  |  |  |  |                       onSuccess: (value) { | 
		
	
		
			
				|  |  |  |  |                         LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                         showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |                           context, | 
		
	
		
			
				|  |  |  |  |                           child: Utils.getSuccessWidget(loadingText: "Payment Successful!".needTranslation), | 
		
	
		
			
				|  |  |  |  |                           callBackFunc: () { | 
		
	
		
			
				|  |  |  |  |                             Navigator.of(context).pop(); | 
		
	
		
			
				|  |  |  |  |                             Navigator.of(context).pop(); | 
		
	
		
			
				|  |  |  |  |                           }, | 
		
	
		
			
				|  |  |  |  |                           isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |                           isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |                         ); | 
		
	
		
			
				|  |  |  |  |                       }, | 
		
	
		
			
				|  |  |  |  |                       onError: (err) { | 
		
	
		
			
				|  |  |  |  |                         LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                         showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |                           context, | 
		
	
		
			
				|  |  |  |  |                           child: Utils.getErrorWidget(loadingText: "Payment Failed - ${err}".needTranslation), | 
		
	
		
			
				|  |  |  |  |                           callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |                           isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |                           isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |                         ); | 
		
	
		
			
				|  |  |  |  |                       }); | 
		
	
		
			
				|  |  |  |  |                 }, | 
		
	
		
			
				|  |  |  |  |                 onError: (err) {}); | 
		
	
		
			
				|  |  |  |  |       transactionID: transID, | 
		
	
		
			
				|  |  |  |  |       onSuccess: (apiResponse) async { | 
		
	
		
			
				|  |  |  |  |         print(apiResponse.data); | 
		
	
		
			
				|  |  |  |  |         if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") { | 
		
	
		
			
				|  |  |  |  |           await habibWalletVM.HISCreateAdvancePayment( | 
		
	
		
			
				|  |  |  |  |               paymentMethodName: selectedPaymentMethod, | 
		
	
		
			
				|  |  |  |  |               paidAmount: habibWalletVM.walletRechargeAmount, | 
		
	
		
			
				|  |  |  |  |               paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, | 
		
	
		
			
				|  |  |  |  |               patientID: habibWalletVM.fileNumber, | 
		
	
		
			
				|  |  |  |  |               projectID: habibWalletVM.selectedHospital!.iD!, | 
		
	
		
			
				|  |  |  |  |               depositorName: habibWalletVM.depositorName, | 
		
	
		
			
				|  |  |  |  |               onSuccess: (value) async { | 
		
	
		
			
				|  |  |  |  |                 await habibWalletVM.addAdvanceNumberRequest( | 
		
	
		
			
				|  |  |  |  |                     advanceNumber: Utils.isVidaPlusProject(habibWalletVM.selectedHospital!.iD) | 
		
	
		
			
				|  |  |  |  |                         ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() | 
		
	
		
			
				|  |  |  |  |                         : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), | 
		
	
		
			
				|  |  |  |  |                     paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, | 
		
	
		
			
				|  |  |  |  |                     onSuccess: (value) { | 
		
	
		
			
				|  |  |  |  |                       LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                       showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |                         context, | 
		
	
		
			
				|  |  |  |  |                         child: Utils.getSuccessWidget(loadingText: "Payment Successful!".needTranslation), | 
		
	
		
			
				|  |  |  |  |                         callBackFunc: () { | 
		
	
		
			
				|  |  |  |  |                           Navigator.of(context).pop(); | 
		
	
		
			
				|  |  |  |  |                           Navigator.of(context).pop(); | 
		
	
		
			
				|  |  |  |  |                         }, | 
		
	
		
			
				|  |  |  |  |                         isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |                         isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |                       ); | 
		
	
		
			
				|  |  |  |  |                     }, | 
		
	
		
			
				|  |  |  |  |                     onError: (err) { | 
		
	
		
			
				|  |  |  |  |                       LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                       showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |                         context, | 
		
	
		
			
				|  |  |  |  |                         child: Utils.getErrorWidget(loadingText: "Payment Failed - ${err}".needTranslation), | 
		
	
		
			
				|  |  |  |  |                         callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |                         isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |                         isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |                       ); | 
		
	
		
			
				|  |  |  |  |                     }); | 
		
	
		
			
				|  |  |  |  |               }, | 
		
	
		
			
				|  |  |  |  |               onError: (err) {}); | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |           showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |             context, | 
		
	
		
			
				|  |  |  |  |             child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), | 
		
	
		
			
				|  |  |  |  |             callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |             isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |             isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       }, | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   onBrowserLoadStart(String url) { | 
		
	
		
			
				|  |  |  |  |     print("onBrowserLoadStart"); | 
		
	
		
			
				|  |  |  |  |     print(url); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (selectedPaymentMethod == "tamara") { | 
		
	
		
			
				|  |  |  |  |       if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |         Uri uri = new Uri.dataFromString(url); | 
		
	
		
			
				|  |  |  |  |         // tamaraPaymentStatus = uri.queryParameters['status']!; | 
		
	
		
			
				|  |  |  |  |         // tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!; | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
		
			
				|  |  |  |  |         Uri uri = new Uri.dataFromString(url); | 
		
	
		
			
				|  |  |  |  |         // tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; | 
		
	
		
			
				|  |  |  |  |         // tamaraOrderID = uri.queryParameters['orderId']!; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // if(selectedPaymentMethod != "TAMARA") { | 
		
	
		
			
				|  |  |  |  |     MyInAppBrowser.successURLS.forEach((element) { | 
		
	
		
			
				|  |  |  |  |       if (url.contains(element)) { | 
		
	
		
			
				|  |  |  |  |         browser?.close(); | 
		
	
		
			
				|  |  |  |  |         MyInAppBrowser.isPaymentDone = true; | 
		
	
		
			
				|  |  |  |  |         return; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  |     // } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // if(selectedPaymentMethod != "TAMARA") { | 
		
	
		
			
				|  |  |  |  |     MyInAppBrowser.errorURLS.forEach((element) { | 
		
	
		
			
				|  |  |  |  |       if (url.contains(element)) { | 
		
	
		
			
				|  |  |  |  |         browser?.close(); | 
		
	
		
			
				|  |  |  |  |         MyInAppBrowser.isPaymentDone = false; | 
		
	
		
			
				|  |  |  |  |         return; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  |     // } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   onBrowserExit(bool isPaymentMade) async { | 
		
	
		
			
				|  |  |  |  |     print("onBrowserExit Called!!!!"); | 
		
	
		
			
				|  |  |  |  |     if (selectedPaymentMethod == "TAMARA") { | 
		
	
		
			
				|  |  |  |  |       // checkTamaraPaymentStatus(transID!, appo); | 
		
	
		
			
				|  |  |  |  |       // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { | 
		
	
		
			
				|  |  |  |  |       //   updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); | 
		
	
		
			
				|  |  |  |  |       // } else { | 
		
	
		
			
				|  |  |  |  |       //   updateTamaraRequestStatus("Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); | 
		
	
		
			
				|  |  |  |  |       // } | 
		
	
		
			
				|  |  |  |  |     } else { | 
		
	
		
			
				|  |  |  |  |       checkPaymentStatus(); | 
		
	
		
			
				|  |  |  |  |       // checkPaymentStatus(appo); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   openPaymentURL(String paymentMethod) { | 
		
	
		
			
				|  |  |  |  |     browser = MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart, context: context); | 
		
	
		
			
				|  |  |  |  |     transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             // await myAppointmentsViewModel.createAdvancePayment( | 
		
	
		
			
				|  |  |  |  |             //     paymentMethodName: selectedPaymentMethod, | 
		
	
		
			
				|  |  |  |  |             //     projectID: widget.patientAppointmentHistoryResponseModel.projectID, | 
		
	
		
			
				|  |  |  |  |             //     clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, | 
		
	
		
			
				|  |  |  |  |             //     appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), | 
		
	
		
			
				|  |  |  |  |             //     payedAmount: payfortViewModel.payfortCheckPaymentStatusResponseModel!.amount!, | 
		
	
		
			
				|  |  |  |  |             //     paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, | 
		
	
		
			
				|  |  |  |  |             //     patientID: "4767477", | 
		
	
		
			
				|  |  |  |  |             //     patientType: 1, | 
		
	
		
			
				|  |  |  |  |             //     onSuccess: (value) async { | 
		
	
		
			
				|  |  |  |  |             //       print(value); | 
		
	
		
			
				|  |  |  |  |             //       await myAppointmentsViewModel.addAdvanceNumberRequest( | 
		
	
		
			
				|  |  |  |  |             //           advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID) | 
		
	
		
			
				|  |  |  |  |             //               ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() | 
		
	
		
			
				|  |  |  |  |             //               : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), | 
		
	
		
			
				|  |  |  |  |             //           paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, | 
		
	
		
			
				|  |  |  |  |             //           appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), | 
		
	
		
			
				|  |  |  |  |             //           onSuccess: (value) async { | 
		
	
		
			
				|  |  |  |  |             //             if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) { | 
		
	
		
			
				|  |  |  |  |             //               //TODO: Implement LiveCare Check-In API Call | 
		
	
		
			
				|  |  |  |  |             //             } else { | 
		
	
		
			
				|  |  |  |  |             //               await myAppointmentsViewModel.generateAppointmentQR( | 
		
	
		
			
				|  |  |  |  |             //                   clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, | 
		
	
		
			
				|  |  |  |  |             //                   projectID: widget.patientAppointmentHistoryResponseModel.projectID, | 
		
	
		
			
				|  |  |  |  |             //                   appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), | 
		
	
		
			
				|  |  |  |  |             //                   isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!, | 
		
	
		
			
				|  |  |  |  |             //                   onSuccess: (apiResponse) { | 
		
	
		
			
				|  |  |  |  |             //                     Future.delayed(Duration(milliseconds: 500), () { | 
		
	
		
			
				|  |  |  |  |             //                       Navigator.of(context).pop(); | 
		
	
		
			
				|  |  |  |  |             //                       Navigator.pushAndRemoveUntil( | 
		
	
		
			
				|  |  |  |  |             //                           context, | 
		
	
		
			
				|  |  |  |  |             //                           CustomPageRoute( | 
		
	
		
			
				|  |  |  |  |             //                             page: LandingNavigation(), | 
		
	
		
			
				|  |  |  |  |             //                           ), | 
		
	
		
			
				|  |  |  |  |             //                               (r) => false); | 
		
	
		
			
				|  |  |  |  |             //                       Navigator.of(context).push( | 
		
	
		
			
				|  |  |  |  |             //                         CustomPageRoute(page: MyAppointmentsPage()), | 
		
	
		
			
				|  |  |  |  |             //                       ); | 
		
	
		
			
				|  |  |  |  |             //                     }); | 
		
	
		
			
				|  |  |  |  |             //                   }); | 
		
	
		
			
				|  |  |  |  |             //             } | 
		
	
		
			
				|  |  |  |  |             //           }); | 
		
	
		
			
				|  |  |  |  |             //     }); | 
		
	
		
			
				|  |  |  |  |           } else { | 
		
	
		
			
				|  |  |  |  |             showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |               context, | 
		
	
		
			
				|  |  |  |  |               child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), | 
		
	
		
			
				|  |  |  |  |               callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |               isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |               isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         }); | 
		
	
		
			
				|  |  |  |  |     browser?.openPaymentBrowser( | 
		
	
		
			
				|  |  |  |  |         habibWalletVM.walletRechargeAmount, | 
		
	
		
			
				|  |  |  |  |         "Advance Payment", | 
		
	
		
			
				|  |  |  |  |         transID, | 
		
	
		
			
				|  |  |  |  |         habibWalletVM.selectedHospital!.iD!.toString(), | 
		
	
		
			
				|  |  |  |  |         "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com", | 
		
	
		
			
				|  |  |  |  |         selectedPaymentMethod, | 
		
	
		
			
				|  |  |  |  |         appState.getAuthenticatedUser()!.patientType.toString(), | 
		
	
		
			
				|  |  |  |  |         "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}", | 
		
	
		
			
				|  |  |  |  |         appState.getAuthenticatedUser()!.patientId.toString(), | 
		
	
		
			
				|  |  |  |  |         appState.getAuthenticatedUser()!, | 
		
	
		
			
				|  |  |  |  |         browser!, | 
		
	
		
			
				|  |  |  |  |         false, | 
		
	
		
			
				|  |  |  |  |         "3", | 
		
	
		
			
				|  |  |  |  |         "0", | 
		
	
		
			
				|  |  |  |  |         context, | 
		
	
		
			
				|  |  |  |  |         "", | 
		
	
		
			
				|  |  |  |  |         "", | 
		
	
		
			
				|  |  |  |  |         "", | 
		
	
		
			
				|  |  |  |  |         "", | 
		
	
		
			
				|  |  |  |  |         "3"); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |