|  |  | @ -52,6 +52,8 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |   String transID = ""; |  |  |  |   String transID = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   bool isShowTamara = false; |  |  |  |   bool isShowTamara = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   String tamaraPaymentStatus = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   String tamaraOrderID = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   void initState() { |  |  |  |   void initState() { | 
			
		
	
	
		
		
			
				
					|  |  | @ -117,7 +119,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             Transform.flip( |  |  |  |                             Transform.flip( | 
			
		
	
		
		
			
				
					
					|  |  |  |                               flipX: appState.isArabic() ? true : false, |  |  |  |                               flipX: appState.isArabic() ? true : false, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               child: Utils.buildSvgWithAssets( |  |  |  |                               child: Utils.buildSvgWithAssets( | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 icon: AppAssets.forward_arrow_icon, |  |  |  |                                 icon: AppAssets.forward_arrow_icon_small, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 iconColor: AppColors.blackColor, |  |  |  |                                 iconColor: AppColors.blackColor, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 width: 18.h, |  |  |  |                                 width: 18.h, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 height: 13.h, |  |  |  |                                 height: 13.h, | 
			
		
	
	
		
		
			
				
					|  |  | @ -159,7 +161,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             Transform.flip( |  |  |  |                             Transform.flip( | 
			
		
	
		
		
			
				
					
					|  |  |  |                               flipX: appState.isArabic() ? true : false, |  |  |  |                               flipX: appState.isArabic() ? true : false, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               child: Utils.buildSvgWithAssets( |  |  |  |                               child: Utils.buildSvgWithAssets( | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 icon: AppAssets.forward_arrow_icon, |  |  |  |                                 icon: AppAssets.forward_arrow_icon_small, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 iconColor: AppColors.blackColor, |  |  |  |                                 iconColor: AppColors.blackColor, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 width: 18.h, |  |  |  |                                 width: 18.h, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 height: 13.h, |  |  |  |                                 height: 13.h, | 
			
		
	
	
		
		
			
				
					|  |  | @ -196,18 +198,18 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             Transform.flip( |  |  |  |                             Transform.flip( | 
			
		
	
		
		
			
				
					
					|  |  |  |                               flipX: appState.isArabic() ? true : false, |  |  |  |                               flipX: appState.isArabic() ? true : false, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               child: Utils.buildSvgWithAssets( |  |  |  |                               child: Utils.buildSvgWithAssets( | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 icon: AppAssets.forward_arrow_icon, |  |  |  |                                       icon: AppAssets.forward_arrow_icon_small, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 iconColor: AppColors.blackColor, |  |  |  |                                       iconColor: AppColors.blackColor, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 width: 18.h, |  |  |  |                                       width: 18.h, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 height: 13.h, |  |  |  |                                       height: 13.h, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 fit: BoxFit.contain, |  |  |  |                                       fit: BoxFit.contain, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               ).toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), |  |  |  |                                     ).toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             ), |  |  |  |                                   ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           ], |  |  |  |                                 ], | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ).paddingSymmetrical(16.h, 16.h), |  |  |  |                               ).paddingSymmetrical(16.h, 16.h), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       ).paddingSymmetrical(24.h, 0.h).onPress(() { |  |  |  |                             ).paddingSymmetrical(24.h, 0.h).onPress(() { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         selectedPaymentMethod = "TAMARA"; |  |  |  |                               selectedPaymentMethod = "TAMARA"; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         openPaymentURL("tamara"); |  |  |  |                               openPaymentURL("tamara"); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             }) |  |  |  |                             }) | 
			
		
	
		
		
			
				
					
					|  |  |  |                           : SizedBox.shrink(), |  |  |  |                           : SizedBox.shrink(), | 
			
		
	
		
		
			
				
					
					|  |  |  |                     ], |  |  |  |                     ], | 
			
		
	
	
		
		
			
				
					|  |  | @ -328,12 +330,12 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (selectedPaymentMethod == "tamara") { |  |  |  |     if (selectedPaymentMethod == "tamara") { | 
			
		
	
		
		
			
				
					
					|  |  |  |       if (Platform.isAndroid) { |  |  |  |       if (Platform.isAndroid) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         Uri uri = new Uri.dataFromString(url); |  |  |  |         Uri uri = new Uri.dataFromString(url); | 
			
		
	
		
		
			
				
					
					|  |  |  |         // tamaraPaymentStatus = uri.queryParameters['status']!; |  |  |  |         tamaraPaymentStatus = uri.queryParameters['status']!; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         // tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!; |  |  |  |         tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       } else { |  |  |  |       } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |         Uri uri = new Uri.dataFromString(url); |  |  |  |         Uri uri = new Uri.dataFromString(url); | 
			
		
	
		
		
			
				
					
					|  |  |  |         // tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; |  |  |  |         tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         // tamaraOrderID = uri.queryParameters['orderId']!; |  |  |  |         tamaraOrderID = uri.queryParameters['orderId']!; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -359,95 +361,155 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   onBrowserExit(bool isPaymentMade) async { |  |  |  |   onBrowserExit(bool isPaymentMade) async { | 
			
		
	
		
		
			
				
					
					|  |  |  |     print("onBrowserExit Called!!!!"); |  |  |  |     checkPaymentStatus(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     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 { |  |  |  |   void checkPaymentStatus() async { | 
			
		
	
		
		
			
				
					
					|  |  |  |     LoaderBottomSheet.showLoader(); |  |  |  |     LoaderBottomSheet.showLoader(loadingText: "Checking payment status, Please wait...".needTranslation); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     await payfortViewModel.checkPaymentStatus( |  |  |  |     if (selectedPaymentMethod == "TAMARA") { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         transactionID: transID, |  |  |  |       await payfortViewModel.checkTamaraPaymentStatus( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         onSuccess: (apiResponse) async { |  |  |  |           transactionID: transID, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |           print(apiResponse.data); |  |  |  |           onSuccess: (apiResponse) async { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |           if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") { |  |  |  |             if (apiResponse.data["status"].toString().toLowerCase() == "success") { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             await myAppointmentsViewModel.createAdvancePayment( |  |  |  |               tamaraOrderID = apiResponse.data["tamara_order_id"].toString(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 paymentMethodName: selectedPaymentMethod, |  |  |  |               await payfortViewModel.updateTamaraRequestStatus(responseMessage: "success", status: "14", clientRequestID: transID, tamaraOrderID: tamaraOrderID); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 projectID: widget.patientAppointmentHistoryResponseModel.projectID, |  |  |  |               await payfortViewModel.markAppointmentAsTamaraPaid( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, |  |  |  |                   projectID: widget.patientAppointmentHistoryResponseModel.projectID, appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), |  |  |  |               await myAppointmentsViewModel.addAdvanceNumberRequest( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 payedAmount: payfortViewModel.payfortCheckPaymentStatusResponseModel!.amount!, |  |  |  |                   advanceNumber: "Tamara-Advance-0000", | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, |  |  |  |                   paymentReference: tamaraOrderID, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 patientID: appState.getAuthenticatedUser()!.patientId.toString(), |  |  |  |                   appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 patientType: appState.getAuthenticatedUser()!.patientType!, |  |  |  |                   onSuccess: (value) async { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 onSuccess: (value) async { |  |  |  |                     if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   print(value); |  |  |  |                       //TODO: Implement LiveCare Check-In API Call | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   await myAppointmentsViewModel.addAdvanceNumberRequest( |  |  |  |                       await myAppointmentsViewModel.insertLiveCareVIDARequest( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID) |  |  |  |                           clientRequestID: tamaraOrderID, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() |  |  |  |                           patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), |  |  |  |                           onSuccess: (apiResponse) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, |  |  |  |                             Future.delayed(Duration(milliseconds: 500), () { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), |  |  |  |                               LoaderBottomSheet.hideLoader(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       onSuccess: (value) async { |  |  |  |                               Navigator.pushAndRemoveUntil( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) { |  |  |  |                                   context, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           //TODO: Implement LiveCare Check-In API Call |  |  |  |                                   CustomPageRoute( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           await myAppointmentsViewModel.insertLiveCareVIDARequest( |  |  |  |                                     page: LandingNavigation(), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               clientRequestID: transID, |  |  |  |                                   ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, |  |  |  |                                   (r) => false); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               onSuccess: (apiResponse) { |  |  |  |                             }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 Future.delayed(Duration(milliseconds: 500), () { |  |  |  |                           }, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                   LoaderBottomSheet.hideLoader(); |  |  |  |                           onError: (error) {}); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                   Navigator.pushAndRemoveUntil( |  |  |  |                     } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       context, |  |  |  |                       await myAppointmentsViewModel.generateAppointmentQR( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       CustomPageRoute( |  |  |  |                           clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                         page: LandingNavigation(), |  |  |  |                           projectID: widget.patientAppointmentHistoryResponseModel.projectID, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       ), |  |  |  |                           appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       (r) => false); |  |  |  |                           isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 }); |  |  |  |                           onSuccess: (apiResponse) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               }, |  |  |  |                             Future.delayed(Duration(milliseconds: 500), () { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               onError: (error) {}); |  |  |  |                               LoaderBottomSheet.hideLoader(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } else { |  |  |  |                               Navigator.pushAndRemoveUntil( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           await myAppointmentsViewModel.generateAppointmentQR( |  |  |  |                                   context, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, |  |  |  |                                   CustomPageRoute( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               projectID: widget.patientAppointmentHistoryResponseModel.projectID, |  |  |  |                                     page: LandingNavigation(), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), |  |  |  |                                   ), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!, |  |  |  |                                   (r) => false); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               onSuccess: (apiResponse) { |  |  |  |                             }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 Future.delayed(Duration(milliseconds: 500), () { |  |  |  |                           }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                   LoaderBottomSheet.hideLoader(); |  |  |  |                     } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                   Navigator.pushAndRemoveUntil( |  |  |  |                   }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       context, |  |  |  |             } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       CustomPageRoute( |  |  |  |               await payfortViewModel.updateTamaraRequestStatus(responseMessage: "Failed", status: "00", clientRequestID: transID, tamaraOrderID: tamaraOrderID); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                         page: LandingNavigation(), |  |  |  |               LoaderBottomSheet.hideLoader(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       ), |  |  |  |               showCommonBottomSheetWithoutHeight( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                       (r) => false); |  |  |  |                 context, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                   // Navigator.of(context).push( |  |  |  |                 child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                   //   CustomPageRoute(page: MyAppointmentsPage()), |  |  |  |                 callBackFunc: () {}, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                   // ); |  |  |  |                 isFullScreen: false, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 }); |  |  |  |                 isCloseButtonVisible: true, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                               }); |  |  |  |               ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |             } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                       }); |  |  |  |           }, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 }); |  |  |  |           onError: (err) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |           } else { |  |  |  |             LoaderBottomSheet.hideLoader(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             showCommonBottomSheetWithoutHeight( |  |  |  |             showCommonBottomSheetWithoutHeight( | 
			
		
	
		
		
			
				
					
					|  |  |  |               context, |  |  |  |               context, | 
			
		
	
		
		
			
				
					
					|  |  |  |               child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), |  |  |  |               child: Utils.getErrorWidget(loadingText: err), | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |               callBackFunc: () {}, |  |  |  |               callBackFunc: () {}, | 
			
		
	
		
		
			
				
					
					|  |  |  |               isFullScreen: false, |  |  |  |               isFullScreen: false, | 
			
		
	
		
		
			
				
					
					|  |  |  |               isCloseButtonVisible: true, |  |  |  |               isCloseButtonVisible: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |             ); |  |  |  |             ); | 
			
		
	
		
		
			
				
					
					|  |  |  |           } |  |  |  |           }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         }); |  |  |  |     } else { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       await payfortViewModel.checkPaymentStatus( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           transactionID: transID, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           onSuccess: (apiResponse) async { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             print(apiResponse.data); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               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: appState.getAuthenticatedUser()!.patientId.toString(), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   patientType: appState.getAuthenticatedUser()!.patientType!, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   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 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             await myAppointmentsViewModel.insertLiveCareVIDARequest( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 clientRequestID: transID, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 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 { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               showCommonBottomSheetWithoutHeight( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 context, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 callBackFunc: () {}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 isFullScreen: false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 isCloseButtonVisible: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   openPaymentURL(String paymentMethod) { |  |  |  |   openPaymentURL(String paymentMethod) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |