diff --git a/lib/config/config.dart b/lib/config/config.dart index 6fbcfa95..df616d52 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -344,7 +344,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 12.0; +var VERSION_ID = 12.3; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/core/model/prescriptions/prescription_report_inp.dart b/lib/core/model/prescriptions/prescription_report_inp.dart index 6bb9c032..24fd8d24 100644 --- a/lib/core/model/prescriptions/prescription_report_inp.dart +++ b/lib/core/model/prescriptions/prescription_report_inp.dart @@ -18,7 +18,7 @@ class PrescriptionReportINP { int? days; String? startDate; String? orderDate; - int? doseDailyQuantity; + num? doseDailyQuantity; int? itemID; dynamic productImage; String? sKU; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index ed37e745..027978a0 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -175,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 1400563; //4609100 + // body['PatientID'] = 1374756; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 980f0889..17477eee 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -591,9 +591,11 @@ class _AnicllaryOrdersState extends State with SingleTic selectedPaymentMethod = method; this.selectedInstallmentPlan = selectedInstallmentPlan; if (selectedPaymentMethod == "ApplePay") { - startApplePay(); - } else { - openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan); + if (projectViewModel.havePrivilege(103)) { + startApplePay(); + } else { + openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan); + } } }, patientShare: double.parse(getTotalValue()), @@ -617,7 +619,8 @@ class _AnicllaryOrdersState extends State with SingleTic applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = 0; 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); @@ -656,25 +659,26 @@ class _AnicllaryOrdersState extends State with SingleTic service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName! + " " + projectViewModel.authenticatedUserObject.user!.lastName!, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - orderDescription: "Ancillary Order Payment", - orderAmount: double.parse(getTotalValue()), - merchantReference: transID, - payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", - onFailed: (failureResult) async { - log("failureResult: ${failureResult.toString()}"); - AppToast.showErrorToast(message: failureResult.toString()); - }, - onSuccess: (successResult) async { - log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse(result: successResult); - checkPaymentStatus(AppoitmentAllHistoryResultList()); - }, - projectId: widget.projectID, - serviceTypeEnum: ServiceTypeEnum.ancillaryOrder, - ); + customerName: projectViewModel.authenticatedUserObject.user.firstName! + " " + projectViewModel.authenticatedUserObject.user!.lastName!, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", + orderDescription: "Ancillary Order Payment", + orderAmount: double.parse(getTotalValue()), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(AppoitmentAllHistoryResultList()); + }, + projectId: widget.projectID, + serviceTypeEnum: ServiceTypeEnum.ancillaryOrder, + ); }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 7466ef6f..c3e0704f 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -735,20 +735,15 @@ class _BookSuccessState extends State { selectedPaymentMethod = value[0]; if (value != null) { if (selectedPaymentMethod == "ApplePay") { - startApplePay(appo, patientShareResponse); + if (projectViewModel.havePrivilege(103)) { + startApplePay(appo, patientShareResponse); + } else { + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + } } else { - openPayment(value, projectViewModel.user, - double.parse(patientShareResponse.patientShareWithTax.toString()), - patientShareResponse, appo); + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } - openPayment(value, projectViewModel.user!, - double.parse(patientShareResponse.patientShareWithTax.toString()), - patientShareResponse, appo); - projectViewModel.analytics.appointment.payment_method( - appointment_type: 'regular', - clinic: widget.docObject.clinicName, - payment_method: value[0], - payment_type: 'appointment'); + projectViewModel.analytics.appointment.payment_method(appointment_type: 'regular', clinic: widget.docObject.clinicName, payment_method: value[0], payment_type: 'appointment'); } }); } @@ -773,19 +768,13 @@ class _BookSuccessState extends State { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = appo.clinicID; - applePayInsertRequest.currency = - projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = - projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerID = - projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.customerName = - projectViewModel.authenticatedUserObject.user.firstName! + " " + - projectViewModel.authenticatedUserObject.user.lastName!; - applePayInsertRequest.deviceToken = - await AppSharedPreferences().getString(PUSH_TOKEN); - applePayInsertRequest.voipToken = - await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + // 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); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); applePayInsertRequest.doctorID = appo.doctorID; applePayInsertRequest.projectID = appo.projectID.toString(); applePayInsertRequest.serviceID = @@ -799,7 +788,7 @@ class _BookSuccessState extends State { projectViewModel.authenticatedUserObject.user.outSA; applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; - applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.orderDescription = "Appointment Payment"; applePayInsertRequest.liveServiceID = "0"; applePayInsertRequest.latitude = "0.0"; applePayInsertRequest.longitude = "0.0"; @@ -833,31 +822,26 @@ class _BookSuccessState extends State { service.applePayInsertRequest(applePayInsertRequest, context).then(( res) async { await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName! + - " " + projectViewModel.authenticatedUserObject.user.lastName!, - customerEmail: projectViewModel.authenticatedUserObject.user - .emailAddress, - orderDescription: "Appointment Payment", - orderAmount: double.parse( - patientShareResponse.patientShareWithTax.toString()), - merchantReference: transID, - payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.authenticatedUserObject.user.outSA == 1 - ? "AED" - : "SAR", - onFailed: (failureResult) async { - log("failureResult: ${failureResult.toString()}"); - AppToast.showErrorToast(message: failureResult.toString()); - }, - onSuccess: (successResult) async { - log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse( - result: successResult); - checkPaymentStatus(appo); - }, - projectId: appo.projectID, - serviceTypeEnum: ServiceTypeEnum.appointmentPayment, - ); + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", + orderDescription: "Appointment Payment", + orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(appo); + }, + projectId: appo.projectID, + serviceTypeEnum: ServiceTypeEnum.appointmentPayment, + ); }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); @@ -1207,7 +1191,6 @@ class _BookSuccessState extends State { ); } - _getBulletPoint(bulletPoint) { return Container( margin: EdgeInsets.only(left: 20.0, right: 20.0), diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index afac872c..3ef95b0a 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -118,6 +118,7 @@ class _DentalComplaintsState extends State { return DoctorView( doctor: doctor, isLiveCareAppointment: false, + isContinueDentalPlan: hasDentalPlan, ); }).toList(), )), @@ -146,8 +147,8 @@ class _DentalComplaintsState extends State { confirmMessage: TranslationBase.of(context).continuePlan, okText: TranslationBase.of(context).yes, cancelText: TranslationBase.of(context).no, - okFunction: () => {Navigator.of(context).pop(), continueDentalPlan()}, - cancelFunction: () => {getChiefComplaintsList()}); + okFunction: () => {Navigator.of(context).pop(), continueDentalPlan(), hasDentalPlan = true}, + cancelFunction: () => {getChiefComplaintsList(), hasDentalPlan = false}); dialog.showAlertDialog(context); } else { getChiefComplaintsList(); @@ -261,8 +262,9 @@ class _DentalComplaintsState extends State { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); getLanguageID(); + hasDentalPlan = false; ClinicListService service = new ClinicListService(); - service.getChiefComplaintsList(widget.searchInfo!.ClinicID!, widget.searchInfo!.ProjectID!, languageID, context).then((res) { + service.getChiefComplaintsList(widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, languageID, false, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index e102e5a0..f1738c85 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -39,8 +39,9 @@ class DoctorProfile extends StatefulWidget { final bool isOpenAppt; bool isLiveCareAppointment; bool isDoctorNameSearch; + bool isContinueDentalPlan; - DoctorProfile({required this.doctor, required this.docProfileList, required this.isLiveCareAppointment, this.isOpenAppt = false, this.isDoctorNameSearch = false}); + DoctorProfile({required this.doctor, required this.docProfileList, required this.isLiveCareAppointment, this.isOpenAppt = false, this.isDoctorNameSearch = false, this.isContinueDentalPlan = false}); late AuthenticatedUser authUser; @@ -203,6 +204,7 @@ class _DoctorProfileState extends State with TickerProviderStateM doctor: widget.doctor, isLiveCareAppointment: widget.isLiveCareAppointment, doctorSchedule: doctorSchedule, + isContinueDentalPlan: widget.isContinueDentalPlan, ), ], controller: _tabController, diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index c280b08c..7d74702e 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -65,6 +65,7 @@ class _SearchResultsState extends State { isObGyneAppointment: widget.isObGyneAppointment, isDoctorNameSearch: widget.isDoctorNameSearch, obGyneProcedureListResponse: widget.obGyneProcedureListResponse, + isShowDate: false, onTap: () { projectViewModel.analytics.appointment.book_appointment_select_doctor(appointment_type: 'regular', doctor: doctor); }); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 97c8ab95..27f5bea4 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -27,10 +27,11 @@ class DocAvailableAppointments extends StatefulWidget { static String? selectedDate; static String? selectedTime; bool isLiveCareAppointment; + bool isContinueDentalPlan; final dynamic doctorSchedule; static int? initialSlotDuration; - DocAvailableAppointments({required this.doctor, this.doctorSchedule, required this.isLiveCareAppointment}); + DocAvailableAppointments({required this.doctor, this.doctorSchedule, required this.isLiveCareAppointment, this.isContinueDentalPlan = false}); @override _DocAvailableAppointmentsState createState() => _DocAvailableAppointmentsState(); @@ -344,20 +345,7 @@ class _DocAvailableAppointmentsState extends State wit print(DocAvailableAppointments.initialSlotDuration); GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .getDoctorFreeSlots( - int.parse( - docObject.doctorID.toString(), - ), - int.parse( - docObject.clinicID.toString(), - ), - int.parse( - docObject.projectID.toString(), - ), - context, - projectViewModel) - .then((res) { + service.getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.isContinueDentalPlan, context, projectViewModel).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 89ee4cef..c413e344 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -29,15 +29,19 @@ class DoctorView extends StatelessWidget { bool isObGyneAppointment; bool isShowFlag; bool isDoctorNameSearch; - OBGyneProcedureListResponse? obGyneProcedureListResponse; - final VoidCallback? onTap; + bool isContinueDentalPlan; + OBGyneProcedureListResponse obGyneProcedureListResponse; + final VoidCallback onTap; + bool isShowDate; DoctorView( {required this.doctor, this.isLiveCareAppointment, this.isObGyneAppointment = false, this.isDoctorNameSearch = false, + this.isContinueDentalPlan = false, this.isShowFlag = true, + this.isShowDate = true, this.onTap, this.obGyneProcedureListResponse}); @@ -55,7 +59,7 @@ class DoctorView extends StatelessWidget { // showDentalChiefComplaintsList(context); // } else if (isShowFlag) { - getDoctorsProfile(context, doctor, isAppo: true); + getDoctorsProfile(context, doctor, isAppo: true, isContinueDentalPlan: isContinueDentalPlan); } (onTap ?? () {})(); // For log analytics of doctor click from book appointment } @@ -88,15 +92,10 @@ class DoctorView extends StatelessWidget { style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), - - // doctor.date ==null ? SizedBox() : Text( - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), - - Text( - doctor.date != null ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date )) : DateUtil.getDayMonthYearDateFormatted(DateTime.now()).toString(), - + isShowDate ? Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), - ) , + ) : Container(), ], ), if (doctor.doctorTitle != null) SizedBox(height: 6), @@ -213,7 +212,7 @@ class DoctorView extends StatelessWidget { return docSpeciality; } - getDoctorsProfile(context, DoctorList docObject, {isAppo}) { + getDoctorsProfile(context, DoctorList docObject, {isAppo, bool isContinueDentalPlan = false}) { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List docProfileList = []; @@ -226,7 +225,7 @@ class DoctorView extends StatelessWidget { docProfileList.add(new DoctorProfileList.fromJson(v)); }); } else {} - navigateToDoctorProfile(context, docObject, docProfileList[0], isAppo: isAppo); + navigateToDoctorProfile(context, docObject, docProfileList[0], isAppo: isAppo, isContinueDentalPlan: isContinueDentalPlan); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -265,7 +264,7 @@ class DoctorView extends StatelessWidget { FadePage(page: ObGyneTimeSlots(projectID: doctor.projectID!, selectedClinicID: doctor.clinicID!, selectedDoctorID: doctor.doctorID!, obGyneProcedureListResponse: obGyneProcedureListResponse!))); } - Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { + Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo, bool isContinueDentalPlan = false}) async { Navigator.push( context, FadePage( @@ -275,6 +274,7 @@ class DoctorView extends StatelessWidget { docProfileList: docProfile, isOpenAppt: isAppo, isDoctorNameSearch: isDoctorNameSearch, + isContinueDentalPlan: isContinueDentalPlan, ), ), ); diff --git a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart index 500f6750..9e191f01 100644 --- a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart +++ b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart @@ -466,7 +466,7 @@ class _CovidTimeSlotsState extends State with TickerProviderSta getCovidFreeSlots(BuildContext context, int projectID) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service.getDoctorFreeSlots(widget.selectedDoctorID!, widget.selectedClinicID!, widget.projectID, context).then((res) { + service.getDoctorFreeSlots(widget.selectedDoctorID, widget.selectedClinicID, widget.projectID, false, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 24efb5c9..339edde0 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1310,8 +1310,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service - .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate!, - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, + transID, projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); getPatientAppointmentHistory(); @@ -1339,7 +1339,11 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { if (value != null) { final appType = appo.isLiveCareAppointment! ? 'livecare' : 'regular'; if (selectedPaymentMethod == "ApplePay") { - startApplePay(appo, patientShareResponse); + if (projectViewModel.havePrivilege(103)) { + startApplePay(appo, patientShareResponse); + } else { + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + } } else { openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } @@ -1364,7 +1368,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { 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); @@ -1378,7 +1383,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; - applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.orderDescription = "Appointment Payment"; applePayInsertRequest.liveServiceID = "0"; applePayInsertRequest.latitude = "0.0"; applePayInsertRequest.longitude = "0.0"; @@ -1403,8 +1408,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName! + " " + projectViewModel.authenticatedUserObject.user!.lastName!, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "Appointment Payment", orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), merchantReference: transID, diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 752383e5..ca85a18e 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -337,7 +337,11 @@ class _clinic_listState extends State { 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 { 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 { 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 { 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 { applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel!.shaResponse; applePayInsertRequest.returnURL = ""; - service.applePayInsertRequest(applePayInsertRequest, localContext!).then((res) async { - await localContext?.read().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().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 { openPayment(List 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 { 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 { 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 { 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 { 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( diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 8e85706b..6cf9a35c 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -221,7 +221,11 @@ class _ConfirmPaymentPageState extends State { () async { if (widget.advanceModel!.fileNumber == projectViewModel.user.patientID.toString()) { if (widget.selectedPaymentMethod == "ApplePay") { - startApplePay(); + if (projectViewModel.havePrivilege(103)) { + startApplePay(); + } else { + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), AppoitmentAllHistoryResultList()); + } } else { openPayment(widget.selectedPaymentMethod!, widget.authenticatedUser!, double.parse(widget.advanceModel!.amount!), AppoitmentAllHistoryResultList()); } @@ -268,7 +272,8 @@ class _ConfirmPaymentPageState extends State { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = 0; 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); @@ -307,8 +312,9 @@ class _ConfirmPaymentPageState extends State { service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName! + " " + projectViewModel.authenticatedUserObject.user.lastName!, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "Advance Payment", orderAmount: double.parse(widget.advanceModel!.amount!), merchantReference: transID, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 2bd1338b..ca424786 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -256,7 +256,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context, [ProjectViewModel? projectViewModel]) async { + Future getDoctorFreeSlots(int docID, int clinicID, int projectID, bool isContinueDentalPlan, BuildContext context, [ProjectViewModel? projectViewModel]) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -276,7 +276,8 @@ class DoctorsListService extends BaseService { "SessionID": null, "isDentalAllowedBackend": false, "LanguageID": 1, - "DeviceTypeID": 1 + "DeviceTypeID": 1, + "ContinueDentalPlan": isContinueDentalPlan, }; if (clinicID == 253) { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 0db10b3f..7581d790 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -63,98 +63,7 @@ class ClinicListService extends BaseService { return Future.value(localRes); } - Future checkIfInPatientAPI(context) async { - Map? request; - request = { - "IsActiveAppointment": false, - }; - - dynamic localRes; - - await baseAppClient.post(CHECK_IF_PATIENT_ADMITTED, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); - return Future.value(localRes); - } - - Future getGeneralInstructions(int projectID, context) async { - Map request; - request = {"ProjectID": projectID}; - - dynamic localRes; - - await baseAppClient.post(GET_GENERAL_INSTRUCTIONS, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request, isAllowAny: true); - return Future.value(localRes); - } - - Future getInPatientAdvancePaymentRequests(int projectID, int admissionNo, int admissionReqNo, context) async { - Map request; - request = {"ProjectID": projectID, "AdmissionReqNo": admissionReqNo, "AdmissionNo": admissionNo}; - - dynamic localRes; - - await baseAppClient.post(GET_INPATIENT_ADVANCE_PAYMENT_REQUESTS, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request, isAllowAny: true); - return Future.value(localRes); - } - - Future getInPatientPaymentLink(int projectID, int admissionNo, int orderID, String name, String email, num amount, String nationalID, int clinicID, int paymentRequestID, context) async { - Map request; - // request = {"ProjectID": projectID, "AdmissionReqNo": admissionReqNo, "AdmissionNo": admissionNo}; - - request = { - "ProjectID": projectID, - "ClientOrderID": orderID, - "OrderDescription": "InPatient Advance Payment", - "CustomerName": name, - "CustomerEmail": email, - "Amount": amount, - "IsPaid": 0, - "AppointmentID": admissionNo.toString(), - "PaymentOption": "0", - "PaymentReferenceNumber": admissionNo, - "SourceType": "1", - "NationalID": nationalID, - "ClinicID": clinicID, - "PaymentRequestId": paymentRequestID, - "createdBy": 102 - }; - - dynamic localRes; - - await baseAppClient.post(GET_INPATIENT_ADVANCE_PAYMENT_LINK, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request, isAllowAny: true); - return Future.value(localRes); - } - - Future getMedicalInstructions(int projectID, context) async { - Map request; - request = {"ProjectID": projectID}; - - dynamic localRes; - - await baseAppClient.post(GET_MEDICAL_INSTRUCTIONS, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request, isAllowAny: true); - return Future.value(localRes); - } - - - Future getChiefComplaintsList(int clinicID, int projectID, int languageID, BuildContext context, {doctorId}) async { + Future getChiefComplaintsList(int clinicID, int projectID, int languageID, bool isContinueDentalPlan, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); Map request; @@ -179,8 +88,8 @@ class ClinicListService extends BaseService { "SessionID": null, "isDentalAllowedBackend": true, "DeviceTypeID": 1, - "PatientID": 1, - "ContinueDentalPlan": true, + // "PatientID": 1, + "ContinueDentalPlan": isContinueDentalPlan, "IsSearchAppointmnetByClinicID": false, "DateofBirth": authUser.dateofBirth }; diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index a4733de2..4cb14dc0 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -153,8 +153,9 @@ class Utils { } } - static String getAppointmentTransID(int projectID, int clinicID, int appoNo) { - return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString() + '-' + DateTime.now().millisecondsSinceEpoch.toString(); + static String getAppointmentTransID(int projectID, int clinicID, int appoNo, {bool isAddMilliseconds = true}) { + String currentMillis = DateTime.now().millisecondsSinceEpoch.toString(); + return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString() + (isAddMilliseconds ? '-' + currentMillis.substring(currentMillis.length - 5, currentMillis.length) : ""); } static String getAdvancePaymentTransID(int projectID, int fileNumber) { diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index d886c455..1dcf441f 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -103,7 +103,7 @@ class SMSOTP { startTimer(setState); // startLister(); - if (Platform.isAndroid) checkSignature(); + if (Platform.isAndroid && type == 1) checkSignature(); } return Container(