|
|
|
|
@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse
|
|
|
|
|
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart';
|
|
|
|
|
@ -196,11 +197,39 @@ class _clinic_listState extends State<ClinicList> {
|
|
|
|
|
|
|
|
|
|
getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) {
|
|
|
|
|
int languageID = projectViewModel.isArabic ? 1 : 2;
|
|
|
|
|
String errorMsg = "";
|
|
|
|
|
LiveCareService service = new LiveCareService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.getERAppointmentTime(selectedClinicID, widget.isPharmacyLiveCare, languageID, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']);
|
|
|
|
|
|
|
|
|
|
// getERAppointmentFeesList.isCash = false;
|
|
|
|
|
// getERAppointmentFeesList.isInsured = true;
|
|
|
|
|
// getERAppointmentFeesList.isEligible = false;
|
|
|
|
|
|
|
|
|
|
if (getERAppointmentFeesList.isCash!) {
|
|
|
|
|
showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']);
|
|
|
|
|
} else {
|
|
|
|
|
if (getERAppointmentFeesList.isInsured! && getERAppointmentFeesList.isEligible!) {
|
|
|
|
|
showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']);
|
|
|
|
|
} else {
|
|
|
|
|
if (getERAppointmentFeesList.isInsured! && !getERAppointmentFeesList.isEligible!) {
|
|
|
|
|
errorMsg = TranslationBase.of(context).invalidEligibility;
|
|
|
|
|
} else {
|
|
|
|
|
errorMsg = TranslationBase.of(context).invalidInsurance;
|
|
|
|
|
}
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
isDissmissable: false,
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage: errorMsg,
|
|
|
|
|
okText: TranslationBase.of(context).updateInsuranceText,
|
|
|
|
|
cancelText: TranslationBase.of(context).continueCash,
|
|
|
|
|
okFunction: () => {openUpdateInsurance()},
|
|
|
|
|
cancelFunction: () => {continueAsCash()});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
@ -208,6 +237,27 @@ class _clinic_listState extends State<ClinicList> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void continueAsCash() {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.convertPatientToCash(BASE_URL.contains("uat.") ? 15 : 12).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res["MessageStatus"] == 1) {
|
|
|
|
|
startLiveCare();
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res["ErrorEndUserMessage"]);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void openUpdateInsurance() {
|
|
|
|
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
|
|
|
|
|
Navigator.push(context, FadePage(page: InsuranceUpdate()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showLiveCarePaymentDialog(GetERAppointmentFeesList getERAppointmentFeesList, int waitingTime) {
|
|
|
|
|
navigateTo(
|
|
|
|
|
context,
|
|
|
|
|
@ -413,28 +463,28 @@ class _clinic_listState extends State<ClinicList> {
|
|
|
|
|
service.applePayInsertRequest(applePayInsertRequest, localContext!).then((res) async {
|
|
|
|
|
if (res["MessageStatus"] == 1) {
|
|
|
|
|
await localContext!.read<PayfortViewModel>().initiateApplePayWithPayfort(
|
|
|
|
|
customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!,
|
|
|
|
|
// customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
|
|
|
|
|
customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com",
|
|
|
|
|
orderDescription: "LiveCare Payment",
|
|
|
|
|
orderAmount: double.parse(amount),
|
|
|
|
|
merchantReference: transID,
|
|
|
|
|
payfortProjectDetailsRespModel: payfortProjectDetailsRespModel,
|
|
|
|
|
currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR",
|
|
|
|
|
onFailed: (failureResult) async {
|
|
|
|
|
log("failureResult: ${failureResult.toString()}");
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(localContext!);
|
|
|
|
|
AppToast.showErrorToast(message: failureResult.toString());
|
|
|
|
|
},
|
|
|
|
|
onSuccess: (successResult) async {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(localContext!);
|
|
|
|
|
log("Payfort: ${successResult.responseMessage}");
|
|
|
|
|
await localContext!.read<PayfortViewModel>().addPayfortApplePayResponse(projectViewModel.user.patientID!, result: successResult);
|
|
|
|
|
checkPaymentStatus(appo);
|
|
|
|
|
},
|
|
|
|
|
projectId: appo.projectID,
|
|
|
|
|
serviceTypeEnum: ServiceTypeEnum.appointmentPayment,
|
|
|
|
|
);
|
|
|
|
|
customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!,
|
|
|
|
|
// customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
|
|
|
|
|
customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com",
|
|
|
|
|
orderDescription: "LiveCare Payment",
|
|
|
|
|
orderAmount: double.parse(amount),
|
|
|
|
|
merchantReference: transID,
|
|
|
|
|
payfortProjectDetailsRespModel: payfortProjectDetailsRespModel,
|
|
|
|
|
currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR",
|
|
|
|
|
onFailed: (failureResult) async {
|
|
|
|
|
log("failureResult: ${failureResult.toString()}");
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(localContext!);
|
|
|
|
|
AppToast.showErrorToast(message: failureResult.toString());
|
|
|
|
|
},
|
|
|
|
|
onSuccess: (successResult) async {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(localContext!);
|
|
|
|
|
log("Payfort: ${successResult.responseMessage}");
|
|
|
|
|
await localContext!.read<PayfortViewModel>().addPayfortApplePayResponse(projectViewModel.user.patientID!, result: successResult);
|
|
|
|
|
checkPaymentStatus(appo);
|
|
|
|
|
},
|
|
|
|
|
projectId: appo.projectID,
|
|
|
|
|
serviceTypeEnum: ServiceTypeEnum.appointmentPayment,
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: "An error occurred while processing your request");
|
|
|
|
|
|