From 3bb0a8b85bc0d0c9858c0a1b2d39ab877c2b85e6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Sep 2021 17:47:13 +0300 Subject: [PATCH] Apple Pay finalized, Translation issues fixed, other updates --- lib/config/config.dart | 6 +- lib/config/localized_values.dart | 12 + .../LiveCare/ApplePayInsertRequest.dart | 152 +++++++++++ lib/pages/Blood/confirm_payment_page.dart | 8 +- lib/pages/BookAppointment/BookSuccess.dart | 51 ++-- .../covid-payment-summary.dart | 119 +++------ lib/pages/ToDoList/ToDo.dart | 4 +- lib/pages/ToDoList/payment_method_select.dart | 6 +- .../fragments/home_page_fragment2.dart | 2 +- lib/pages/landing/home_page.dart | 6 - .../landing/widgets/logged_slider_view.dart | 8 +- lib/pages/livecare/livecare_home.dart | 2 +- .../livecare/widgets/ClinicTimingsDialog.dart | 7 +- .../widgets/LiveCarePaymentDialog.dart | 25 +- lib/pages/livecare/widgets/clinic_list.dart | 19 +- .../medical/balance/advance_payment_page.dart | 2 +- .../medical/balance/confirm_payment_page.dart | 87 ++----- .../medical/labs/passport_update_page.dart | 50 ++-- .../prescriptions_home_page.dart | 7 +- .../medical/reports/monthly_reports.dart | 5 +- .../medical/reports/report_home_page.dart | 7 +- .../livecare_services/livecare_provider.dart | 114 ++++----- lib/uitl/translations_delegate_base.dart | 6 + lib/widgets/in_app_browser/InAppBrowser.dart | 241 ++++++++---------- 24 files changed, 488 insertions(+), 458 deletions(-) create mode 100644 lib/models/LiveCare/ApplePayInsertRequest.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index dd9711b3..329f0314 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -257,6 +257,8 @@ const GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtu const CANCEL_LIVECARE_REQUEST = 'Services/ER_VirtualCall.svc/REST/DeleteErRequest'; const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; +const APPLE_PAY_INSERT_REQUEST = 'Services/PayFort_Serv.svc/REST/PayFort_ApplePayRequestData_Insert'; + const GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions'; const UPDATE_HEALTH_TERMS = 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 03e966ff..f3005811 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1461,4 +1461,16 @@ const Map localizedValues = { "en": "This service is available to doctors visited during the past 15 days", "ar": "هذه الخدمة متاحة للاطباء الذين تمت زيارتهم خلال ال 15 يوم الماضية" }, + "online-clinics": { + "en": "Online Clinics: ", + "ar": "​العيادات المفتوحة: " + }, + "offline-clinics": { + "en": "Offline Clinics: ", + "ar": "العيادات المغلقة: " + }, + "clinic-schedule": { + "en": "Clinic Schedule", + "ar": "جدول العيادة" + }, }; diff --git a/lib/models/LiveCare/ApplePayInsertRequest.dart b/lib/models/LiveCare/ApplePayInsertRequest.dart new file mode 100644 index 00000000..ab1bd2cc --- /dev/null +++ b/lib/models/LiveCare/ApplePayInsertRequest.dart @@ -0,0 +1,152 @@ +class ApplePayInsertRequest { + String clientRequestID; + int clinicID; + String currency; + String customerEmail; + int customerID; + String customerName; + String deviceToken; + int doctorID; + String projectID; + String serviceID; + int channelID; + int patientID; + int patientTypeID; + int patientOutSA; + dynamic appointmentDate; + int appointmentNo; + String orderDescription; + String liveServiceID; + String latitude; + String longitude; + String amount; + String isSchedule; + String language; + int userName; + String responseContinueURL; + String backClickUrl; + String paymentOption; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + ApplePayInsertRequest( + {this.clientRequestID, + this.clinicID, + this.currency, + this.customerEmail, + this.customerID, + this.customerName, + this.deviceToken, + this.doctorID, + this.projectID, + this.serviceID, + this.channelID, + this.patientID, + this.patientTypeID, + this.patientOutSA, + this.appointmentDate, + this.appointmentNo, + this.orderDescription, + this.liveServiceID, + this.latitude, + this.longitude, + this.amount, + this.isSchedule, + this.language, + this.userName, + this.responseContinueURL, + this.backClickUrl, + this.paymentOption, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + ApplePayInsertRequest.fromJson(Map json) { + clientRequestID = json['ClientRequestID']; + clinicID = json['ClinicID']; + currency = json['Currency']; + customerEmail = json['CustomerEmail']; + customerID = json['CustomerID']; + customerName = json['CustomerName']; + deviceToken = json['DeviceToken']; + doctorID = json['DoctorID']; + projectID = json['ProjectID']; + serviceID = json['Service_ID']; + channelID = json['Channel_ID']; + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + patientOutSA = json['PatientOutSA']; + appointmentDate = json['AppointmentDate']; + appointmentNo = json['AppointmentNo']; + orderDescription = json['OrderDescription']; + liveServiceID = json['Live_ServiceID']; + latitude = json['Latitude']; + longitude = json['Longitude']; + amount = json['Amount']; + isSchedule = json['IsSchedule']; + language = json['Language']; + userName = json['userName']; + responseContinueURL = json['ResponseContinueURL']; + backClickUrl = json['BackClickUrl']; + paymentOption = json['PaymentOption']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['ClientRequestID'] = this.clientRequestID; + data['ClinicID'] = this.clinicID; + data['Currency'] = this.currency; + data['CustomerEmail'] = this.customerEmail; + data['CustomerID'] = this.customerID; + data['CustomerName'] = this.customerName; + data['DeviceToken'] = this.deviceToken; + data['DoctorID'] = this.doctorID; + data['ProjectID'] = this.projectID; + data['Service_ID'] = this.serviceID; + data['Channel_ID'] = this.channelID; + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientOutSA'] = this.patientOutSA; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentNo'] = this.appointmentNo; + data['OrderDescription'] = this.orderDescription; + data['Live_ServiceID'] = this.liveServiceID; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['Amount'] = this.amount; + data['IsSchedule'] = this.isSchedule; + data['Language'] = this.language; + data['userName'] = this.userName; + data['ResponseContinueURL'] = this.responseContinueURL; + data['BackClickUrl'] = this.backClickUrl; + data['PaymentOption'] = this.paymentOption; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index f3f7bffb..5c70c181 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'dialogs/ConfirmSMSDialog.dart'; import 'new_text_Field.dart'; @@ -86,7 +87,7 @@ class ConfirmPaymentPage extends StatelessWidget { height: 100.0, padding: EdgeInsets.all(7.0), width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset(getImagePath(selectedPaymentMethod)), + child: selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(selectedPaymentMethod)) : Image.asset(getImagePath(selectedPaymentMethod)), ), Texts( '${advanceModel.amount} SAR', @@ -193,6 +194,9 @@ class ConfirmPaymentPage extends StatelessWidget { case "Installment": return 'assets/images/new-design/installment.png'; break; + case "ApplePay": + return 'assets/images/new-design/applepay.svg'; + break; } return 'assets/images/new-design/mada.png'; @@ -219,7 +223,7 @@ class ConfirmPaymentPage extends StatelessWidget { authenticatedUser, browser, false, - null, + "3", null); } diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index c70932ee..b2cfe74c 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -20,7 +20,6 @@ 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_inappwebview/flutter_inappwebview.dart'; -import 'package:intl/intl.dart'; import 'QRCode.dart'; @@ -489,33 +488,28 @@ class _BookSuccessState extends State { } openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { - if (paymentMethod == "ApplePay") { - await widget.chromeBrowser.open( - url: "https://applepay-datatrans-sample.herokuapp.com/", - options: ChromeSafariBrowserClassOptions(android: AndroidChromeCustomTabsOptions(addDefaultShareMenuItem: false), ios: IOSSafariOptions(barCollapsingEnabled: true))); - } else { - widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); - - widget.browser.openPaymentBrowser( - amount, - "Appointment check in", - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), - appo.projectID.toString(), - authenticatedUser.emailAddress, - paymentMethod, - authenticatedUser.patientType, - authenticatedUser.firstName, - authenticatedUser.patientID, - authenticatedUser, - widget.browser, - widget.patientShareResponse.isLiveCareAppointment, - null, - null, - widget.patientShareResponse.appointmentDate, - widget.patientShareResponse.appointmentNo, - widget.patientShareResponse.clinicID, - widget.patientShareResponse.doctorID); - } + widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); + + widget.browser.openPaymentBrowser( + amount, + "Appointment check in", + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), + appo.projectID.toString(), + authenticatedUser.emailAddress, + paymentMethod, + authenticatedUser.patientType, + authenticatedUser.firstName, + authenticatedUser.patientID, + authenticatedUser, + widget.browser, + widget.patientShareResponse.isLiveCareAppointment, + "2", + null, + widget.patientShareResponse.appointmentDate, + widget.patientShareResponse.appointmentNo, + widget.patientShareResponse.clinicID, + widget.patientShareResponse.doctorID); + // } } onBrowserLoadStart(String url) { @@ -546,7 +540,6 @@ class _BookSuccessState extends State { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { - String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { createAdvancePayment(res, appo); diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index c3c70578..fa39cdb0 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:provider/provider.dart'; class CovidPaymentSummary extends StatefulWidget { @@ -27,8 +28,7 @@ class CovidPaymentSummary extends StatefulWidget { AppSharedPreferences sharedPref = AppSharedPreferences(); String transID = ""; - CovidPaymentSummary( - {@required this.patientShareResponse, this.selectedPaymentMethod}); + CovidPaymentSummary({@required this.patientShareResponse, this.selectedPaymentMethod}); @override _CovidPaymentSummaryState createState() => _CovidPaymentSummaryState(); @@ -64,12 +64,10 @@ class _CovidPaymentSummaryState extends State { height: 100.0, padding: EdgeInsets.all(7.0), width: MediaQuery.of(context).size.width * 0.45, - child: - Image.asset(getImagePath(widget.selectedPaymentMethod)), + child: widget.selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(widget.selectedPaymentMethod)) : Image.asset(getImagePath(widget.selectedPaymentMethod)), ), Texts( - '${widget.patientShareResponse.patientShareWithTax} ' + - TranslationBase.of(context).sar, + '${widget.patientShareResponse.patientShareWithTax} ' + TranslationBase.of(context).sar, fontSize: 26, bold: true, ) @@ -85,8 +83,7 @@ class _CovidPaymentSummaryState extends State { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).fileNumber, - initialValue: - projectViewModel.user.patientID.toString(), + initialValue: projectViewModel.user.patientID.toString(), isEnabled: false, ), ), @@ -116,11 +113,7 @@ class _CovidPaymentSummaryState extends State { ), NewTextFields( hintText: TranslationBase.of(context).depositorName, - initialValue: projectViewModel.user.firstName + - " " + - projectViewModel.user.middleName + - " " + - projectViewModel.user.lastName, + initialValue: projectViewModel.user.firstName + " " + projectViewModel.user.middleName + " " + projectViewModel.user.lastName, isEnabled: false, ), ], @@ -149,55 +142,31 @@ class _CovidPaymentSummaryState extends State { appo.clinicID = widget.patientShareResponse.clinicID; appo.appointmentNo = widget.patientShareResponse.appointmentNo; - openPayment( - widget.selectedPaymentMethod, - authenticatedUser, - double.parse( - widget.patientShareResponse.patientShareWithTax.toString()), - widget.patientShareResponse, - appo); + openPayment(widget.selectedPaymentMethod, authenticatedUser, double.parse(widget.patientShareResponse.patientShareWithTax.toString()), widget.patientShareResponse, appo); } - openPayment( - String paymentMethod, - AuthenticatedUser authenticatedUser, - double amount, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) async { - if (paymentMethod == "ApplePay") { - // await widget.chromeBrowser.open( - // url: "https://applepay-datatrans-sample.herokuapp.com/", - // options: ChromeSafariBrowserClassOptions( - // android: AndroidChromeCustomTabsOptions( - // addDefaultShareMenuItem: false), - // ios: IOSSafariOptions(barCollapsingEnabled: true))); - } else { - widget.browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { + widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - widget.browser.openPaymentBrowser( - amount, - "Appointment check in", - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - appo.projectID.toString(), - authenticatedUser.emailAddress, - paymentMethod, - authenticatedUser.patientType, - authenticatedUser.firstName, - authenticatedUser.patientID, - authenticatedUser, - widget.browser, - widget.patientShareResponse.isLiveCareAppointment, - null, - null, - widget.patientShareResponse.appointmentDate, - widget.patientShareResponse.appointmentNo, - widget.patientShareResponse.clinicID, - widget.patientShareResponse.doctorID); - } + widget.browser.openPaymentBrowser( + amount, + "Appointment check in", + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), + appo.projectID.toString(), + authenticatedUser.emailAddress, + paymentMethod, + authenticatedUser.patientType, + authenticatedUser.firstName, + authenticatedUser.patientID, + authenticatedUser, + widget.browser, + widget.patientShareResponse.isLiveCareAppointment, + "2", + null, + widget.patientShareResponse.appointmentDate, + widget.patientShareResponse.appointmentNo, + widget.patientShareResponse.clinicID, + widget.patientShareResponse.doctorID); } onBrowserLoadStart(String url) { @@ -229,12 +198,7 @@ class _CovidPaymentSummaryState extends State { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - context) - .then((res) { + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; @@ -254,15 +218,9 @@ class _CovidPaymentSummaryState extends State { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], - res['Fort_id'], res['PaymentMethod'], context) - .then((res) { + service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - appo.appointmentNo.toString()); + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString()); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); @@ -270,13 +228,9 @@ class _CovidPaymentSummaryState extends State { }); } - addAdvancedNumberRequest( - String advanceNumber, String paymentReference, String appointmentID) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID) { DoctorsListService service = new DoctorsListService(); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) { print(res); getAppoQR(context); }).catchError((err) { @@ -288,9 +242,7 @@ class _CovidPaymentSummaryState extends State { getAppoQR(context) { DoctorsListService service = new DoctorsListService(); - service - .generateAppointmentQR(widget.patientShareResponse, context) - .then((res) { + service.generateAppointmentQR(widget.patientShareResponse, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); navigateToQR(context, res['AppointmentQR']); @@ -328,6 +280,9 @@ class _CovidPaymentSummaryState extends State { case "Installment": return 'assets/images/new-design/installment.png'; break; + case "ApplePay": + return 'assets/images/new-design/applepay.svg'; + break; } return 'assets/images/new-design/mada.png'; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index e9c096cf..749ff667 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -597,7 +597,7 @@ class _ToDoState extends State { } openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { - widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); + widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); widget.browser.openPaymentBrowser( amount, @@ -612,7 +612,7 @@ class _ToDoState extends State { authenticatedUser, widget.browser, appo.isLiveCareAppointment, - null, + "2", null, appo.appointmentDate, appo.appointmentNo, diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index 9a22eada..f22628f9 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -163,7 +165,7 @@ class _PaymentMethodState extends State { ], ), ), - Container( + Platform.isIOS ? Container( margin: EdgeInsets.only(top: 25.0), child: Flex( direction: Axis.horizontal, @@ -201,7 +203,7 @@ class _PaymentMethodState extends State { ), ], ), - ), + ) : Container(), SizedBox( height: 150.0, ), diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 68bf2ffe..3bb22f75 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -509,7 +509,7 @@ class _HomePageFragment2State extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - TranslationBase.of(context).HMGPharmacy, + TranslationBase.of(context).onlinePharmacy, style: TextStyle( color: Colors.black, fontSize: 14, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 80dcaa88..65bad5dd 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -524,12 +524,6 @@ class _HomePageState extends State { ) : Column( children: [ - // if (projectViewModel.user != null && model.isLogin && model.user.outSA == 1) - // Image.asset( - // 'assets/images/lock_icon.png', - // width: 50, - // height: 50, - // ), Image.asset( 'assets/images/pharmacy_logo.png', width: 40, diff --git a/lib/pages/landing/widgets/logged_slider_view.dart b/lib/pages/landing/widgets/logged_slider_view.dart index 958135d0..26879420 100644 --- a/lib/pages/landing/widgets/logged_slider_view.dart +++ b/lib/pages/landing/widgets/logged_slider_view.dart @@ -155,9 +155,6 @@ class LoggedSliderView extends StatelessWidget { ], ), ), - SizedBox( - width: 3, - ), Expanded( child: Row( children: [ @@ -171,9 +168,6 @@ class LoggedSliderView extends StatelessWidget { ], ), ), - SizedBox( - width: 3, - ), Expanded( child: Row( children: [ @@ -183,7 +177,7 @@ class LoggedSliderView extends StatelessWidget { height: 12, ), mWidth(6), - Texts('${TranslationBase.of(context).bloodD}: ${model.booldType}', color: Colors.white, fontSize: 10) + Texts('${TranslationBase.of(context).bloodType}: ${model.booldType}', color: Colors.white, fontSize: 10) ], ), ), diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index 31275239..fa0c1b75 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -50,7 +50,7 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: "LiveCare", + appBarTitle: TranslationBase.of(context).livecare, isShowAppBar: true, imagesInfo: imagesInfo, description: TranslationBase.of(context).erConsultation, diff --git a/lib/pages/livecare/widgets/ClinicTimingsDialog.dart b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart index d5fce79e..df0a5286 100644 --- a/lib/pages/livecare/widgets/ClinicTimingsDialog.dart +++ b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class ClinicTimingsDialog extends StatefulWidget { @@ -31,7 +32,7 @@ class _ClinicTimingsDialogState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( - height: MediaQuery.of(context).size.height * 0.68, + height: 580.0, margin: EdgeInsets.all(20.0), width: 450.0, child: Column( @@ -41,7 +42,7 @@ class _ClinicTimingsDialogState extends State { Container( alignment: Alignment.center, margin: EdgeInsets.only(bottom: 10.0), - child: Text("Clinic Schedule", + child: Text(TranslationBase.of(context).clinicSchedule, textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), @@ -98,7 +99,7 @@ class _ClinicTimingsDialogState extends State { Navigator.pop(context); }, child: Container( - child: Text("OK", + child: Text(TranslationBase.of(context).ok, textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, diff --git a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart index c06c9464..4f203db2 100644 --- a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart +++ b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart @@ -1,7 +1,9 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class LiveCarePaymentDialog extends StatefulWidget { GetERAppointmentFeesList getERAppointmentFeesList; @@ -20,11 +22,14 @@ class LiveCarePaymentDialog extends StatefulWidget { class _LiveCarePaymentDialogState extends State { int _selected = 0; + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; final double itemWidth = size.width / 2; + projectViewModel = Provider.of(context); return Container( child: Dialog( @@ -66,7 +71,7 @@ class _LiveCarePaymentDialogState extends State { ), ), Expanded( - child: Text(widget.waitingTime.toString() + " Minutes", + child: Text(widget.waitingTime.toString() + " " + TranslationBase.of(context).minute, textAlign: TextAlign.start, style: TextStyle( fontSize: 16.0, @@ -156,7 +161,7 @@ class _LiveCarePaymentDialogState extends State { children: [ Image.asset("assets/images/new-design/alert-triangle.png"), Container( - margin: EdgeInsets.only(left: 10.0), + margin: EdgeInsets.only(left: 10.0, right: 10.0), width: MediaQuery.of(context).size.width * 0.55, child: Text(TranslationBase.of(context).insuredPatient, style: TextStyle(fontSize: 13.0)), @@ -181,14 +186,6 @@ class _LiveCarePaymentDialogState extends State { style: new TextStyle(fontSize: 14.0), ), ), -// Container( -//// alignment: Alignment.centerRight, -// child: new Text( -// 'Click Here', -// textAlign: TextAlign.end, -// style: new TextStyle(fontSize: 16.0), -// ), -// ), ], ), ), @@ -228,7 +225,7 @@ class _LiveCarePaymentDialogState extends State { Navigator.pop(context, false); }, child: Container( - child: Text("Cancel", + child: Text(TranslationBase.of(context).cancel, textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, color: Colors.red[700])), @@ -247,7 +244,7 @@ class _LiveCarePaymentDialogState extends State { } }, child: Container( - child: Text("Ok", + child: Text(TranslationBase.of(context).ok, textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, @@ -278,7 +275,7 @@ class _LiveCarePaymentDialogState extends State { textAlign: TextAlign.end, style: TextStyle( fontSize: 14, - fontFamily: 'Open-Sans', + // fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: 0.5, color: Colors.black)), ); @@ -291,7 +288,7 @@ class _LiveCarePaymentDialogState extends State { textAlign: TextAlign.end, style: TextStyle( fontSize: 14, - fontFamily: 'Open-Sans', + // fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: 0.5, fontWeight: FontWeight.bold, color: Colors.black)), diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 94bce343..a310f4fd 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -157,7 +157,6 @@ class _clinic_listState extends State { GifLoaderDialogUtils.showMyDialog(context); service.getERAppointmentTime(selectedClinicID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res); showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -236,6 +235,7 @@ class _clinic_listState extends State { appo.clinicID = selectedClinicID; appo.appointmentNo = DateTime.now().millisecondsSinceEpoch; + appo.projectID = 12; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -253,9 +253,9 @@ class _clinic_listState extends State { } openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { - browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(12, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod, + browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod, authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "4", selectedClinicID.toString()); } @@ -368,7 +368,6 @@ class _clinic_listState extends State { if (res['MessageStatus'] == 1) { setState(() { liveCareScheduleClinicsListResponse = LiveCareScheduleClinicsListResponse.fromJson(res); - print(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length); selectedClinicID = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[0].serviceID; selectedClinicName = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[0].clinicDesc; isDataLoaded = true; @@ -432,12 +431,6 @@ class _clinic_listState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ -// Container( -// margin: EdgeInsets.all(15.0), -// child: Text("Online Clinics: ", -// style: TextStyle( -// fontSize: 20.0, fontWeight: FontWeight.bold)), -// ), ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, @@ -505,7 +498,7 @@ class _clinic_listState extends State { children: [ Container( margin: EdgeInsets.all(15.0), - child: Text("Online Clinics: ", style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).onlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), ), ListView.builder( scrollDirection: Axis.vertical, @@ -529,7 +522,7 @@ class _clinic_listState extends State { ), Container( margin: EdgeInsets.all(15.0), - child: Text("Offline Clinics: ", style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), ), ListView.builder( scrollDirection: Axis.vertical, @@ -581,7 +574,7 @@ class _clinic_listState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: startLiveCare, - child: Text("Start", style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)), ), ), ), diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index d1d0293b..5de9c15a 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -205,7 +205,7 @@ class _AdvancePaymentPageState extends State { ), NewTextFields( hintText: TranslationBase.of(context).amount, - keyboardType: TextInputType.number, + keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), onChanged: (value) { setState(() { amount = value; diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 0d2fac93..93fbae87 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'dialogs/ConfirmSMSDialog.dart'; import 'new_text_Field.dart'; @@ -32,11 +33,7 @@ class ConfirmPaymentPage extends StatelessWidget { AppSharedPreferences sharedPref = AppSharedPreferences(); String transID = ""; - ConfirmPaymentPage( - {this.advanceModel, - this.patientInfoAndMobileNumber, - this.selectedPaymentMethod, - this.authenticatedUser}); + ConfirmPaymentPage({this.advanceModel, this.patientInfoAndMobileNumber, this.selectedPaymentMethod, this.authenticatedUser}); @override Widget build(BuildContext context) { @@ -51,11 +48,9 @@ class ConfirmPaymentPage extends StatelessWidget { print("dialog dismissed"); print(value); if (value != null && value) { - AppoitmentAllHistoryResultList appo = - new AppoitmentAllHistoryResultList(); + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.projectID = patientInfoAndMobileNumber.projectID; - openPayment(selectedPaymentMethod, authenticatedUser, - double.parse(advanceModel.amount), null); + openPayment(selectedPaymentMethod, authenticatedUser, double.parse(advanceModel.amount), null); } }); } @@ -87,7 +82,7 @@ class ConfirmPaymentPage extends StatelessWidget { height: 100.0, padding: EdgeInsets.all(7.0), width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset(getImagePath(selectedPaymentMethod)), + child: selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(selectedPaymentMethod)) : Image.asset(getImagePath(selectedPaymentMethod)), ), Texts( '${advanceModel.amount} SAR', @@ -136,11 +131,7 @@ class ConfirmPaymentPage extends StatelessWidget { ), NewTextFields( hintText: TranslationBase.of(context).depositorName, - initialValue: model.user.firstName + - " " + - model.user.middleName + - " " + - model.user.lastName, + initialValue: model.user.firstName + " " + model.user.middleName + " " + model.user.lastName, isEnabled: false, ), SizedBox( @@ -166,14 +157,9 @@ class ConfirmPaymentPage extends StatelessWidget { disabled: model.state == ViewState.Busy, onTap: () { GifLoaderDialogUtils.showMyDialog(context); - model - .sendActivationCodeForAdvancePayment( - patientID: int.parse(advanceModel.fileNumber), - projectID: advanceModel.hospitalsModel.iD) - .then((value) { + model.sendActivationCodeForAdvancePayment(patientID: int.parse(advanceModel.fileNumber), projectID: advanceModel.hospitalsModel.iD).then((value) { GifLoaderDialogUtils.hideDialog(context); - if (model.state != ViewState.ErrorLocal && - model.state != ViewState.Error) showSMSDialog(); + if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(); }); }, ), @@ -199,36 +185,21 @@ class ConfirmPaymentPage extends StatelessWidget { case "Installment": return 'assets/images/new-design/installment.png'; break; + case "ApplePay": + return 'assets/images/new-design/applepay.svg'; + break; } return 'assets/images/new-design/mada.png'; } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, - double amount, AppoitmentAllHistoryResultList appo) { - browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); - transID = Utils.getAdvancePaymentTransID( - advanceModel.hospitalsModel.iD, int.parse(advanceModel.fileNumber)); + transID = Utils.getAdvancePaymentTransID(advanceModel.hospitalsModel.iD, int.parse(advanceModel.fileNumber)); - browser.openPaymentBrowser( - amount, - "Advance Payment", - transID, - advanceModel.hospitalsModel.iD.toString(), - advanceModel.email, - paymentMethod, - patientInfoAndMobileNumber.patientType, - advanceModel.patientName, - advanceModel.fileNumber, - authenticatedUser, - browser, - false, - null, - null); + browser.openPaymentBrowser(amount, "Advance Payment", transID, advanceModel.hospitalsModel.iD.toString(), advanceModel.email, paymentMethod, patientInfoAndMobileNumber.patientType, + advanceModel.patientName, advanceModel.fileNumber, authenticatedUser, browser, false, "3", null); } onBrowserLoadStart(String url) { @@ -280,23 +251,11 @@ class ConfirmPaymentPage extends StatelessWidget { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service.HIS_createAdvancePayment( - appo, - advanceModel.hospitalsModel.iD.toString(), - res['Amount'], - res['Fort_id'], - res['PaymentMethod'], - patientInfoAndMobileNumber.patientType, - advanceModel.patientName, - advanceModel.fileNumber, - AppGlobal.context) + service.HIS_createAdvancePayment(appo, advanceModel.hospitalsModel.iD.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], patientInfoAndMobileNumber.patientType, + advanceModel.patientName, advanceModel.fileNumber, AppGlobal.context) .then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - 0, - appo); + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, 0, appo); }).catchError((err) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: err); @@ -304,13 +263,9 @@ class ConfirmPaymentPage extends StatelessWidget { }); } - addAdvancedNumberRequest(String advanceNumber, String paymentReference, - dynamic appointmentID, AppoitmentAllHistoryResultList appo) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, AppGlobal.context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, AppGlobal.context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(AppGlobal.context); navigateToHome(AppGlobal.context); diff --git a/lib/pages/medical/labs/passport_update_page.dart b/lib/pages/medical/labs/passport_update_page.dart index 1e81b2e5..ad77320f 100644 --- a/lib/pages/medical/labs/passport_update_page.dart +++ b/lib/pages/medical/labs/passport_update_page.dart @@ -28,6 +28,8 @@ class _PassportUpdatePageState extends State { appBarTitle: TranslationBase.of(context).passportNumber, isShowAppBar: true, isBottomBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, body: Container( child: SingleChildScrollView( child: Column( @@ -50,34 +52,34 @@ class _PassportUpdatePageState extends State { onChanged: (value) => {_onPassportTextChanged(value)}, padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), hintText: TranslationBase.of(context).passportNumber, - )) + )), + Container( + margin: EdgeInsets.only(top: 30.0, left: 45.0, right: 45.0, bottom: 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFFc5272d), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.red[300], + onPressed: () { + if (_isButtonDisabled == false) + updatePassportNumber(); + else + AppToast.showErrorToast(message: TranslationBase.of(context).validPassportNumber); + }, + child: Text(TranslationBase.of(context).submit, style: TextStyle(fontSize: 18.0)), + ), + ), + ), ], ), ), ), - bottomSheet: Container( - margin: EdgeInsets.only(top: 10.0, left: 30.0, right: 30.0, bottom: 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFFc5272d), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.red[300], - onPressed: () { - if (_isButtonDisabled == false) - updatePassportNumber(); - else - AppToast.showErrorToast(message: TranslationBase.of(context).validPassportNumber); - }, - child: Text(TranslationBase.of(context).submit, style: TextStyle(fontSize: 18.0)), - ), - ), - ), ); } diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 7345c3fe..7d65837d 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; @@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../../Constants.dart'; @@ -22,6 +24,8 @@ class _HomePrescriptionsPageState extends State with Sing TabController _tabController; List imagesInfo = List(); + ProjectViewModel projectViewModel; + @override void initState() { super.initState(); @@ -40,6 +44,7 @@ class _HomePrescriptionsPageState extends State with Sing @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPrescriptions(), builder: (_, model, widget) => AppScaffold( @@ -71,7 +76,7 @@ class _HomePrescriptionsPageState extends State with Sing fontWeight: FontWeight.w600, letterSpacing: -0.48, ), - tabs: [Text(TranslationBase.of(context).prescriptions), Text(TranslationBase.of(context).history)], + tabs: [Text(TranslationBase.of(context).prescriptions, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), Text(TranslationBase.of(context).history, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'))], ), Expanded( child: TabBarView( diff --git a/lib/pages/medical/reports/monthly_reports.dart b/lib/pages/medical/reports/monthly_reports.dart index f1c1aa08..2a2647f7 100644 --- a/lib/pages/medical/reports/monthly_reports.dart +++ b/lib/pages/medical/reports/monthly_reports.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -11,6 +12,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class MonthlyReportsPage extends StatefulWidget { @override @@ -36,6 +38,7 @@ class _MonthlyReportsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView(builder: (_, model, w) { if (isSummary == null) { isSummary = model.receiveHealthSummaryReport; @@ -184,7 +187,7 @@ class _MonthlyReportsPageState extends State { RichText( text: TextSpan( text: TranslationBase.of(context).toViewTheTermsAndConditions + " ", - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), children: [ TextSpan( text: TranslationBase.of(context).clickHere, diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index e24e9ac7..6e6d991a 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -3,13 +3,12 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -81,15 +80,19 @@ class _HomeReportPageState extends State with SingleTickerProvid tabs: [ Text( TranslationBase.of(context).requested, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), Text( TranslationBase.of(context).ready, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), Text( TranslationBase.of(context).completed, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), Text( TranslationBase.of(context).cancelled, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), ], ), diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 285fa0bf..7ae70376 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -20,8 +21,7 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -44,8 +44,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_CLINICS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LIVECARE_CLINICS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -57,8 +56,7 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -81,12 +79,11 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINICS, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINICS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } @@ -94,8 +91,7 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -119,12 +115,11 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } @@ -132,23 +127,17 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); // Request req = appGlobal.getPublicRequest(); - request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "TokenID": "", - "SessionID": "YckwoXhUmWBsnHKEKig" - }; + request = {"LanguageID": languageID == 'ar' ? 1 : 2, "TokenID": "", "SessionID": "YckwoXhUmWBsnHKEKig"}; dynamic localRes; - await baseAppClient.post(GET_LIVECARE_HISTORY, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LIVECARE_HISTORY, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -156,13 +145,11 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getLivecareClinicTiming( - int serviceID, BuildContext context) async { + Future getLivecareClinicTiming(int serviceID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -185,8 +172,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_CLINIC_TIMING, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LIVECARE_CLINIC_TIMING, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -198,8 +184,7 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -225,8 +210,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_ER_APPOINTMENT_FEES, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_ER_APPOINTMENT_FEES, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -238,8 +222,7 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -265,8 +248,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_ER_APPOINTMENT_TIME, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_ER_APPOINTMENT_TIME, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -274,8 +256,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future addNewCallForPatientER( - int serviceID, String clientRequestID, BuildContext context) async { + Future addNewCallForPatientER(int serviceID, String clientRequestID, BuildContext context) async { Map request; String deviceToken; @@ -285,8 +266,7 @@ class LiveCareService extends BaseService { }); if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -316,8 +296,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(ADD_NEW_CALL_FOR_PATIENT_ER, - onSuccess: (response, statusCode) async { + await baseAppClient.post(ADD_NEW_CALL_FOR_PATIENT_ER, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -334,16 +313,14 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } request = {"VCID": vc_id}; dynamic localRes; - await baseAppClient.post(CANCEL_LIVECARE_REQUEST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(CANCEL_LIVECARE_REQUEST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -351,25 +328,34 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future sendLiveCareInvoiceEmail(String appoNo, int projectID, - String emailAddress, BuildContext context) async { + Future applePayInsertRequest(ApplePayInsertRequest applePayInsertRequest, BuildContext context) async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + dynamic localRes; + + await baseAppClient.post(APPLE_PAY_INSERT_REQUEST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: applePayInsertRequest.toJson()); + return Future.value(localRes); + } + + Future sendLiveCareInvoiceEmail(String appoNo, int projectID, String emailAddress, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - request = { - "To": emailAddress, - "ProjectID": projectID, - "AppointmentNo": appoNo - }; + request = {"To": emailAddress, "ProjectID": projectID, "AppointmentNo": appoNo}; dynamic localRes; - await baseAppClient.post(SEND_LIVECARE_INVOICE_EMAIL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(SEND_LIVECARE_INVOICE_EMAIL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b7efad42..291b2ebe 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2164,6 +2164,12 @@ class TranslationBase { localizedValues["h2o-info"][locale.languageCode]; String get askDocEmpty => localizedValues["ask-doc-empty"][locale.languageCode]; + String get onlineClinics => + localizedValues["online-clinics"][locale.languageCode]; + String get offlineClinics => + localizedValues["offline-clinics"][locale.languageCode]; + String get clinicSchedule => + localizedValues["clinic-schedule"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f3aed157..d50420ab 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -5,17 +5,21 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; enum _PAYMENT_TYPE { PACKAGES, PHARMACY, PATIENT } + var _InAppBrowserOptions = InAppBrowserClassOptions( - inAppWebViewGroupOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true)), + inAppWebViewGroupOptions: InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true)), crossPlatform: InAppBrowserOptions(hideUrlBar: true), ios: IOSInAppBrowserOptions( toolbarBottom: false, @@ -23,38 +27,28 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; + // static String SERVICE_URL = // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = - 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String PREAUTH_SERVICE_URL = // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - static String PREAUTH_SERVICE_URL = - 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store // static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; - static String PRESCRIPTION_PAYMENT_WITH_ORDERID = - 'https://mdlaboratories.com/exacartapi/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; //Live + static String PRESCRIPTION_PAYMENT_WITH_ORDERID = 'https://mdlaboratories.com/exacartapi/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; //Live // Packages - static String PACKAGES_REQUEST_PAYMENT_URL = - '$EXA_CART_API_BASE_URL/checkout/OpcCompleteRedirectionPayment1'; - static String PACKAGES_PAYMENT_SUCCESS_URL = - '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess'; - static String PACKAGES_PAYMENT_FAIL_URL = - '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed'; - - static List successURLS = [ - 'success', - 'PayFortResponse', - 'PayFortSucess', - 'mobilepaymentcomplete' - ]; + static String PACKAGES_REQUEST_PAYMENT_URL = '$EXA_CART_API_BASE_URL/checkout/OpcCompleteRedirectionPayment1'; + static String PACKAGES_PAYMENT_SUCCESS_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess'; + static String PACKAGES_PAYMENT_FAIL_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed'; + + static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete']; static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed']; @@ -76,8 +70,7 @@ class MyInAppBrowser extends InAppBrowser { static bool isPaymentDone = false; - MyInAppBrowser( - {this.onExitCallback, this.appo, this.onLoadStartCallback, this.context}); + MyInAppBrowser({this.onExitCallback, this.appo, this.onLoadStartCallback, this.context}); Future onBrowserCreated() async { print("\n\nBrowser Created!\n\n"); @@ -99,8 +92,7 @@ class MyInAppBrowser extends InAppBrowser { } @override - void onProgressChanged(int progress) { - } + void onProgressChanged(int progress) {} @override void onExit() { @@ -109,14 +101,11 @@ class MyInAppBrowser extends InAppBrowser { } @override - Future shouldOverrideUrlLoading( - ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async { + Future shouldOverrideUrlLoading(ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async { var url = shouldOverrideUrlLoadingRequest.url; debugPrint("redirecting/overriding to: $url"); - if (paymentType == _PAYMENT_TYPE.PACKAGES && - [PACKAGES_PAYMENT_SUCCESS_URL, PACKAGES_PAYMENT_FAIL_URL] - .contains(url)) { + if (paymentType == _PAYMENT_TYPE.PACKAGES && [PACKAGES_PAYMENT_SUCCESS_URL, PACKAGES_PAYMENT_FAIL_URL].contains(url)) { isPaymentDone = (url == PACKAGES_PAYMENT_SUCCESS_URL); close(); } @@ -135,86 +124,88 @@ class MyInAppBrowser extends InAppBrowser { getPatientData() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && - await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } } - openPackagesPaymentBrowser( - {@required int customer_id, @required int order_id}) { + openPackagesPaymentBrowser({@required int customer_id, @required int order_id}) { paymentType = _PAYMENT_TYPE.PACKAGES; - var full_url = - '$PACKAGES_REQUEST_PAYMENT_URL?customer_id=$customer_id&order_id=$order_id'; + var full_url = '$PACKAGES_REQUEST_PAYMENT_URL?customer_id=$customer_id&order_id=$order_id'; this.openUrl(url: full_url, options: _InAppBrowserOptions); } - openPaymentBrowser( - double amount, - String orderDesc, - String transactionID, - String projId, - String emailId, - String paymentMethod, - dynamic patientType, - String patientName, - dynamic patientID, - AuthenticatedUser authenticatedUser, - InAppBrowser browser, - bool isLiveCareAppo, - var servID, - var LiveServID, - [var appoDate, - var appoNo, - var clinicID, - var doctorID]) { + openPaymentBrowser(double amount, String orderDesc, String transactionID, String projId, String emailId, String paymentMethod, dynamic patientType, String patientName, dynamic patientID, + AuthenticatedUser authenticatedUser, InAppBrowser browser, bool isLiveCareAppo, var servID, var LiveServID, + [var appoDate, var appoNo, var clinicID, var doctorID]) async { this.browser = browser; - getPatientData(); - generateURL( - amount, - orderDesc, - transactionID, - projId, - emailId, - paymentMethod, - patientType, - patientName, - patientID, - authenticatedUser, - isLiveCareAppo, - servID, - LiveServID, - appoDate, - appoNo, - clinicID, - doctorID) - .then((value) { - paymentType = _PAYMENT_TYPE.PATIENT; - this.browser.openUrl(url: value, options: _InAppBrowserOptions); - }); + await getPatientData(); + if (paymentMethod == "ApplePay") { + MyChromeSafariBrowser safariBrowser = new MyChromeSafariBrowser(new MyInAppBrowser(), onExitCallback: browser.onExit, onLoadStartCallback: this.browser.onLoadStart, appo: this.appo); + + if (context != null) GifLoaderDialogUtils.showMyDialog(context); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + applePayInsertRequest.clientRequestID = transactionID; + applePayInsertRequest.clinicID = clinicID != null ? clinicID : 0; + applePayInsertRequest.currency = authenticatedUser.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = emailId; + applePayInsertRequest.customerID = authenticatedUser.patientID; + applePayInsertRequest.customerName = authenticatedUser.firstName; + applePayInsertRequest.deviceToken = deviceToken; + applePayInsertRequest.doctorID = doctorID != null ? doctorID : 0; + applePayInsertRequest.projectID = projId; + applePayInsertRequest.serviceID = servID; + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = authenticatedUser.patientID; + applePayInsertRequest.patientTypeID = authenticatedUser.patientType; + applePayInsertRequest.patientOutSA = authenticatedUser.outSA; + applePayInsertRequest.appointmentDate = appoDate != null ? appoDate : null; + applePayInsertRequest.appointmentNo = appoNo != null ? appoNo : 0; + applePayInsertRequest.orderDescription = orderDesc; + applePayInsertRequest.liveServiceID = LiveServID; + applePayInsertRequest.latitude = this.lat.toString(); + applePayInsertRequest.longitude = this.long.toString(); + applePayInsertRequest.amount = amount.toString(); + applePayInsertRequest.isSchedule = "0"; + applePayInsertRequest.language = getLanguageID() == 'ar' ? 'AR' : 'EN'; + applePayInsertRequest.userName = authenticatedUser.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + service.applePayInsertRequest(applePayInsertRequest, context).then((res) { + if (context != null) GifLoaderDialogUtils.hideDialog(context); + var url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; + print(url); + safariBrowser.open(url: url); + // this.browser.openUrl(url: url, options: _InAppBrowserOptions); + }).catchError((err) { + print(err); + if (context != null) GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + }); + } else { + generateURL(amount, orderDesc, transactionID, projId, emailId, paymentMethod, patientType, patientName, patientID, authenticatedUser, isLiveCareAppo, servID, LiveServID, appoDate, appoNo, + clinicID, doctorID) + .then((value) { + paymentType = _PAYMENT_TYPE.PATIENT; + this.browser.openUrl(url: value, options: _InAppBrowserOptions); + }); + } } - openPharmacyPaymentBrowser( - OrderDetailModel order, - double amount, - String orderDesc, - String transactionID, - String emailId, - String paymentMethod, - String patientName, - dynamic patientID, - AuthenticatedUser authenticatedUser, - InAppBrowser browser) { + openPharmacyPaymentBrowser(OrderDetailModel order, double amount, String orderDesc, String transactionID, String emailId, String paymentMethod, String patientName, dynamic patientID, + AuthenticatedUser authenticatedUser, InAppBrowser browser) { this.browser = browser; getPatientData(); - generatePharmacyURL(order, amount, orderDesc, transactionID, emailId, - paymentMethod, patientName, patientID, authenticatedUser) - .then((value) { + generatePharmacyURL(order, amount, orderDesc, transactionID, emailId, paymentMethod, patientName, patientID, authenticatedUser).then((value) { this.browser.openUrl(url: value); }); } @@ -224,25 +215,9 @@ class MyInAppBrowser extends InAppBrowser { this.browser.openUrl(url: url, options: _InAppBrowserOptions); } - Future generateURL( - double amount, - String orderDesc, - String transactionID, - String projId, - String emailId, - String paymentMethod, - dynamic patientType, - String patientName, - dynamic patientID, - AuthenticatedUser authUser, - bool isLiveCareAppo, - var servID, - var LiveServID, - [var appoDate, - var appoNo, - var clinicID, - var doctorID, - var patientData]) async { + Future generateURL(double amount, String orderDesc, String transactionID, String projId, String emailId, String paymentMethod, dynamic patientType, String patientName, dynamic patientID, + AuthenticatedUser authUser, bool isLiveCareAppo, var servID, var LiveServID, + [var appoDate, var appoNo, var clinicID, var doctorID, var patientData]) async { getDeviceToken(); String currentLanguageID = getLanguageID() == 'ar' ? 'AR' : 'EN'; String form = isLiveCareAppo ? getLiveCareForm() : getForm(); @@ -256,19 +231,15 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('PROJECT_ID_VALUE', projId); form = form.replaceFirst('PAYMENT_OPTION_VALUE', paymentMethod); form = form.replaceFirst('LANG_VALUE', currentLanguageID); - form = form.replaceFirst('PATIENT_OUT_SA', - authUser.outSA == 0 ? false.toString() : true.toString()); - form = form.replaceFirst( - 'PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); + form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); + form = form.replaceFirst('PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); - form = form.replaceFirst( - 'DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); + form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString()); if (servID == "4") - form = form.replaceFirst( - 'SERVICE_URL_VALUE', MyInAppBrowser.PREAUTH_SERVICE_URL); + form = form.replaceFirst('SERVICE_URL_VALUE', MyInAppBrowser.PREAUTH_SERVICE_URL); else form = form.replaceFirst('SERVICE_URL_VALUE', MyInAppBrowser.SERVICE_URL); @@ -297,19 +268,8 @@ class MyInAppBrowser extends InAppBrowser { } Future generatePharmacyURL( - OrderDetailModel order, - double amount, - String orderDesc, - String transactionID, - String emailId, - String paymentMethod, - String patientName, - dynamic patientID, - AuthenticatedUser authUser) async { - String pharmacyURL = PRESCRIPTION_PAYMENT_WITH_ORDERID + - order.orderGuid + - '&&CustomerId=' + - "${order.customerId}"; + OrderDetailModel order, double amount, String orderDesc, String transactionID, String emailId, String paymentMethod, String patientName, dynamic patientID, AuthenticatedUser authUser) async { + String pharmacyURL = PRESCRIPTION_PAYMENT_WITH_ORDERID + order.orderGuid + '&&CustomerId=' + "${order.customerId}"; return pharmacyURL; } @@ -380,10 +340,18 @@ class MyInAppBrowser extends InAppBrowser { '' + ''; } + + safariCallBack() { + print("Safari CallBack!!!"); + } } class MyChromeSafariBrowser extends ChromeSafariBrowser { - MyChromeSafariBrowser(browserFallback) : super(bFallback: browserFallback); + final Function onExitCallback; + final Function onLoadStartCallback; + AppoitmentAllHistoryResultList appo; + + MyChromeSafariBrowser(browserFallback, {@required this.onExitCallback, @required this.onLoadStartCallback, @required this.appo}) : super(bFallback: browserFallback); @override void onOpened() { @@ -393,10 +361,13 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser { @override void onCompletedInitialLoad() { print("ChromeSafari browser initial load completed"); + onLoadStartCallback("ApplePay"); } @override void onClosed() { print("ChromeSafari browser closed"); + MyInAppBrowser.isPaymentDone = true; + onExitCallback(); } }