LiveCare NPHIES eligibility check implemented

merge-update-with-lab-changes
haroon amjad 1 year ago
parent f83d538472
commit 21c29e6355

@ -24,6 +24,8 @@ class GetERAppointmentFeesList {
String? companyName;
bool? isInsured;
bool? isShowInsuranceUpdateModule;
bool? isCash;
bool? isEligible;
String? tax;
String? total;
String? currency;
@ -41,6 +43,8 @@ class GetERAppointmentFeesList {
amount = json['Amount'];
companyName = json['CompanyName'];
isInsured = json['IsInsured'];
isCash = json['IsCash'];
isEligible = json['IsEligible'];
isShowInsuranceUpdateModule = json['IsShowInsuranceUpdateModule'];
tax = json['Tax'];
total = json['Total'];

@ -2,6 +2,8 @@ import 'dart:io';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
@ -13,6 +15,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/covid_consent_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:permission_handler/permission_handler.dart';
@ -282,53 +285,87 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
Container(
padding: EdgeInsets.all(12),
color: Colors.white,
child: Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).cancel,
() {
if (widget.isPharmaLiveCare) cancelAPI();
Navigator.pop(context, false);
},
),
),
mWidth(12),
Expanded(
child: DefaultButton(
TranslationBase.of(context).next,
() {
if (_selected == 0) {
AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms);
} else {
if (widget.isPharmaLiveCare) {
Navigator.pop(context, true);
} else {
askVideoCallPermission().then((value) async {
if (value == true) {
locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context);
locationUtils.getCurrentLocation(callBack: (value) {
print(value);
});
if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) {
await drawOverAppsMessageDialog(context).then((value) {
return false;
});
} else {
Navigator.pop(context, true);
projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName);
}
child: Column(
children: [
Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).cancel,
() {
if (widget.isPharmaLiveCare) cancelAPI();
Navigator.pop(context, false);
},
),
),
mWidth(12),
Expanded(
child: DefaultButton(
TranslationBase.of(context).next,
() {
if (_selected == 0) {
AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms);
} else {
if (widget.isPharmaLiveCare) {
Navigator.pop(context, true);
} else {
openPermissionsDialog();
askVideoCallPermission().then((value) async {
if (value == true) {
locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context);
locationUtils.getCurrentLocation(callBack: (value) {
print(value);
});
if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) {
await drawOverAppsMessageDialog(context).then((value) {
return false;
});
} else {
Navigator.pop(context, true);
projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName);
}
} else {
openPermissionsDialog();
}
});
}
});
}
}
},
color: CustomColors.green,
),
}
},
color: CustomColors.green,
),
),
],
),
widget.getERAppointmentFeesList.isCash!
? Column(
children: [
mHeight(10.0),
Text(
TranslationBase.of(context).cashAmountUpdateInsurance,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
),
),
mHeight(5.0),
DefaultButton(
TranslationBase.of(context).updateInsuranceText,
() {
Navigator.pop(context, null);
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
);
Navigator.push(context, FadePage(page: InsuranceUpdate()));
},
color: Color(0xffEAA118),
textColor: Colors.white,
),
],
)
: Container(),
],
),
),

@ -171,7 +171,7 @@ class _LiveCareHomeState extends State<LiveCareHome> with SingleTickerProviderSt
});
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
AppToast.showErrorToast(message: err, localContext: context);
print(err);
});
}

@ -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");

Loading…
Cancel
Save