| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -337,7 +337,11 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        widget.pharmacyLiveCareQRCode = pharmaLiveCareQRCodeValue;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (value != null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          if (selectedPaymentMethod == "ApplePay") {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            startApplePay(appo, getERAppointmentFeesList.total!);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (projectViewModel.havePrivilege(103)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              startApplePay(appo, getERAppointmentFeesList.total);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            openPayment(value, authUser, num.parse(getERAppointmentFeesList.total!), appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          }
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -349,7 +353,7 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  void startApplePay(AppoitmentAllHistoryResultList appo, String amount) async {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    try {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo, isAddMilliseconds: false);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      print("TransactionID: $transID");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      GifLoaderDialogUtils.showMyDialog(localContext!);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -367,7 +371,8 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.clientRequestID = transID;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.clinicID = appo.clinicID;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName! + " " + projectViewModel.authenticatedUserObject.user.lastName!;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN);
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -382,7 +387,7 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.appointmentDate = appo.appointmentDate;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.appointmentNo = appo.appointmentNo;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.orderDescription = "LiveCare Payment";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.liveServiceID = "0";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.liveServiceID = selectedClinicID.toString();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.latitude = "0.0";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.longitude = "0.0";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.amount = amount;
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -404,10 +409,11 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel!.shaResponse;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      applePayInsertRequest.returnURL = "";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      service.applePayInsertRequest(applePayInsertRequest, localContext!).then((res) async {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        await localContext?.read<PayfortViewModel>().initiateApplePayWithPayfort(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              customerName: projectViewModel.authenticatedUserObject.user.firstName! + " " + projectViewModel.authenticatedUserObject.user.lastName!,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      service.applePayInsertRequest(applePayInsertRequest, localContext).then((res) async {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        await localContext.read<PayfortViewModel>().initiateApplePayWithPayfort(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              orderDescription: "LiveCare Payment",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              orderAmount: double.parse(amount),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              merchantReference: transID,
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -440,10 +446,9 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  openPayment(List<String?> paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    selectedPaymentMethod = paymentMethod[0]!;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    selectedInstallmentPlan = paymentMethod[1]!;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo, isAddMilliseconds: false);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    selectedPaymentMethod = paymentMethod[0];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    selectedInstallmentPlan = paymentMethod[1];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    this.amount = amount.toString();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    browser.openPaymentBrowser(amount, "LiveCare Payment", widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode! : transID!, "12", authenticatedUser.emailAddress!, paymentMethod[0]!,
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -487,7 +492,7 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print("onBrowserExit Called!!!!");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    try {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (selectedPaymentMethod == "TAMARA") {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        checkTamaraPaymentStatus(transID, appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        //   updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallmentPlan), appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        // } else {
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -511,7 +516,7 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, int.parse(selectedInstallmentPlan), appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        updateTamaraRequestStatus(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            "Failed", "00", Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), tamaraOrderID != null ? tamaraOrderID : "", int.parse(selectedInstallmentPlan), appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            "Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallmentPlan), appo);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }).catchError((err) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      GifLoaderDialogUtils.hideDialog(context);
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -528,7 +533,7 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        GifLoaderDialogUtils.hideDialog(context);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          addNewCallForPatientER(transID);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          AppToast.showErrorToast(message: res['Response_Message']);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          projectViewModel.analytics.liveCare.livecare_immediate_consultation_payment_failed(
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -561,7 +566,7 @@ class _clinic_listState extends State<ClinicList> {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      amount = res['Amount'].toString();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      payment_method = res['PaymentMethod'];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (paymentInfo == 'Success') {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        addNewCallForPatientER(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        addNewCallForPatientER(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : transID);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        AppToast.showErrorToast(message: res['Response_Message']);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        projectViewModel.analytics.liveCare.livecare_immediate_consultation_payment_failed(
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |