|  |  |  | @ -52,6 +52,8 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |   String transID = ""; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   bool isShowTamara = false; | 
		
	
		
			
				|  |  |  |  |   String tamaraPaymentStatus = ""; | 
		
	
		
			
				|  |  |  |  |   String tamaraOrderID = ""; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   void initState() { | 
		
	
	
		
			
				
					|  |  |  | @ -117,7 +119,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |                             Transform.flip( | 
		
	
		
			
				|  |  |  |  |                               flipX: appState.isArabic() ? true : false, | 
		
	
		
			
				|  |  |  |  |                               child: Utils.buildSvgWithAssets( | 
		
	
		
			
				|  |  |  |  |                                 icon: AppAssets.forward_arrow_icon, | 
		
	
		
			
				|  |  |  |  |                                 icon: AppAssets.forward_arrow_icon_small, | 
		
	
		
			
				|  |  |  |  |                                 iconColor: AppColors.blackColor, | 
		
	
		
			
				|  |  |  |  |                                 width: 18.h, | 
		
	
		
			
				|  |  |  |  |                                 height: 13.h, | 
		
	
	
		
			
				
					|  |  |  | @ -159,7 +161,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |                             Transform.flip( | 
		
	
		
			
				|  |  |  |  |                               flipX: appState.isArabic() ? true : false, | 
		
	
		
			
				|  |  |  |  |                               child: Utils.buildSvgWithAssets( | 
		
	
		
			
				|  |  |  |  |                                 icon: AppAssets.forward_arrow_icon, | 
		
	
		
			
				|  |  |  |  |                                 icon: AppAssets.forward_arrow_icon_small, | 
		
	
		
			
				|  |  |  |  |                                 iconColor: AppColors.blackColor, | 
		
	
		
			
				|  |  |  |  |                                 width: 18.h, | 
		
	
		
			
				|  |  |  |  |                                 height: 13.h, | 
		
	
	
		
			
				
					|  |  |  | @ -196,7 +198,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |                             Transform.flip( | 
		
	
		
			
				|  |  |  |  |                               flipX: appState.isArabic() ? true : false, | 
		
	
		
			
				|  |  |  |  |                               child: Utils.buildSvgWithAssets( | 
		
	
		
			
				|  |  |  |  |                                 icon: AppAssets.forward_arrow_icon, | 
		
	
		
			
				|  |  |  |  |                                       icon: AppAssets.forward_arrow_icon_small, | 
		
	
		
			
				|  |  |  |  |                                       iconColor: AppColors.blackColor, | 
		
	
		
			
				|  |  |  |  |                                       width: 18.h, | 
		
	
		
			
				|  |  |  |  |                                       height: 13.h, | 
		
	
	
		
			
				
					|  |  |  | @ -328,12 +330,12 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |     if (selectedPaymentMethod == "tamara") { | 
		
	
		
			
				|  |  |  |  |       if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |         Uri uri = new Uri.dataFromString(url); | 
		
	
		
			
				|  |  |  |  |         // tamaraPaymentStatus = uri.queryParameters['status']!; | 
		
	
		
			
				|  |  |  |  |         // tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!; | 
		
	
		
			
				|  |  |  |  |         tamaraPaymentStatus = uri.queryParameters['status']!; | 
		
	
		
			
				|  |  |  |  |         tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!; | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
		
			
				|  |  |  |  |         Uri uri = new Uri.dataFromString(url); | 
		
	
		
			
				|  |  |  |  |         // tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; | 
		
	
		
			
				|  |  |  |  |         // tamaraOrderID = uri.queryParameters['orderId']!; | 
		
	
		
			
				|  |  |  |  |         tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; | 
		
	
		
			
				|  |  |  |  |         tamaraOrderID = uri.queryParameters['orderId']!; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -359,22 +361,84 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   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); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void checkPaymentStatus() async { | 
		
	
		
			
				|  |  |  |  |     LoaderBottomSheet.showLoader(); | 
		
	
		
			
				|  |  |  |  |     LoaderBottomSheet.showLoader(loadingText: "Checking payment status, Please wait...".needTranslation); | 
		
	
		
			
				|  |  |  |  |     if (selectedPaymentMethod == "TAMARA") { | 
		
	
		
			
				|  |  |  |  |       await payfortViewModel.checkTamaraPaymentStatus( | 
		
	
		
			
				|  |  |  |  |           transactionID: transID, | 
		
	
		
			
				|  |  |  |  |           onSuccess: (apiResponse) async { | 
		
	
		
			
				|  |  |  |  |             if (apiResponse.data["status"].toString().toLowerCase() == "success") { | 
		
	
		
			
				|  |  |  |  |               tamaraOrderID = apiResponse.data["tamara_order_id"].toString(); | 
		
	
		
			
				|  |  |  |  |               await payfortViewModel.updateTamaraRequestStatus(responseMessage: "success", status: "14", clientRequestID: transID, tamaraOrderID: tamaraOrderID); | 
		
	
		
			
				|  |  |  |  |               await payfortViewModel.markAppointmentAsTamaraPaid( | 
		
	
		
			
				|  |  |  |  |                   projectID: widget.patientAppointmentHistoryResponseModel.projectID, appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo); | 
		
	
		
			
				|  |  |  |  |               await myAppointmentsViewModel.addAdvanceNumberRequest( | 
		
	
		
			
				|  |  |  |  |                   advanceNumber: "Tamara-Advance-0000", | 
		
	
		
			
				|  |  |  |  |                   paymentReference: tamaraOrderID, | 
		
	
		
			
				|  |  |  |  |                   appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), | 
		
	
		
			
				|  |  |  |  |                   onSuccess: (value) async { | 
		
	
		
			
				|  |  |  |  |                     if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) { | 
		
	
		
			
				|  |  |  |  |                       //TODO: Implement LiveCare Check-In API Call | 
		
	
		
			
				|  |  |  |  |                       await myAppointmentsViewModel.insertLiveCareVIDARequest( | 
		
	
		
			
				|  |  |  |  |                           clientRequestID: tamaraOrderID, | 
		
	
		
			
				|  |  |  |  |                           patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, | 
		
	
		
			
				|  |  |  |  |                           onSuccess: (apiResponse) { | 
		
	
		
			
				|  |  |  |  |                             Future.delayed(Duration(milliseconds: 500), () { | 
		
	
		
			
				|  |  |  |  |                               LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                               Navigator.pushAndRemoveUntil( | 
		
	
		
			
				|  |  |  |  |                                   context, | 
		
	
		
			
				|  |  |  |  |                                   CustomPageRoute( | 
		
	
		
			
				|  |  |  |  |                                     page: LandingNavigation(), | 
		
	
		
			
				|  |  |  |  |                                   ), | 
		
	
		
			
				|  |  |  |  |                                   (r) => false); | 
		
	
		
			
				|  |  |  |  |                             }); | 
		
	
		
			
				|  |  |  |  |                           }, | 
		
	
		
			
				|  |  |  |  |                           onError: (error) {}); | 
		
	
		
			
				|  |  |  |  |                     } 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), () { | 
		
	
		
			
				|  |  |  |  |                               LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                               Navigator.pushAndRemoveUntil( | 
		
	
		
			
				|  |  |  |  |                                   context, | 
		
	
		
			
				|  |  |  |  |                                   CustomPageRoute( | 
		
	
		
			
				|  |  |  |  |                                     page: LandingNavigation(), | 
		
	
		
			
				|  |  |  |  |                                   ), | 
		
	
		
			
				|  |  |  |  |                                   (r) => false); | 
		
	
		
			
				|  |  |  |  |                             }); | 
		
	
		
			
				|  |  |  |  |                           }); | 
		
	
		
			
				|  |  |  |  |                     } | 
		
	
		
			
				|  |  |  |  |                   }); | 
		
	
		
			
				|  |  |  |  |             } else { | 
		
	
		
			
				|  |  |  |  |               await payfortViewModel.updateTamaraRequestStatus(responseMessage: "Failed", status: "00", clientRequestID: transID, tamaraOrderID: tamaraOrderID); | 
		
	
		
			
				|  |  |  |  |               LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |               showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |                 context, | 
		
	
		
			
				|  |  |  |  |                 child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), | 
		
	
		
			
				|  |  |  |  |                 callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |                 isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |                 isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |               ); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |           }, | 
		
	
		
			
				|  |  |  |  |           onError: (err) { | 
		
	
		
			
				|  |  |  |  |             LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |             showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |               context, | 
		
	
		
			
				|  |  |  |  |               child: Utils.getErrorWidget(loadingText: err), | 
		
	
		
			
				|  |  |  |  |               callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |               isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |               isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |           }); | 
		
	
		
			
				|  |  |  |  |     } else { | 
		
	
		
			
				|  |  |  |  |       await payfortViewModel.checkPaymentStatus( | 
		
	
		
			
				|  |  |  |  |           transactionID: transID, | 
		
	
		
			
				|  |  |  |  |           onSuccess: (apiResponse) async { | 
		
	
	
		
			
				
					|  |  |  | @ -430,9 +494,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |                                           page: LandingNavigation(), | 
		
	
		
			
				|  |  |  |  |                                         ), | 
		
	
		
			
				|  |  |  |  |                                         (r) => false); | 
		
	
		
			
				|  |  |  |  |                                   // Navigator.of(context).push( | 
		
	
		
			
				|  |  |  |  |                                   //   CustomPageRoute(page: MyAppointmentsPage()), | 
		
	
		
			
				|  |  |  |  |                                   // ); | 
		
	
		
			
				|  |  |  |  |                                   }); | 
		
	
		
			
				|  |  |  |  |                                 }); | 
		
	
		
			
				|  |  |  |  |                           } | 
		
	
	
		
			
				
					|  |  |  | @ -449,6 +510,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |           }); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   openPaymentURL(String paymentMethod) { | 
		
	
		
			
				|  |  |  |  |     browser = MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart, context: context); | 
		
	
	
		
			
				
					|  |  |  | 
 |