|
|
|
|
@ -1,16 +1,22 @@
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/core/enum/PayfortEnums.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/header_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/routes.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
@ -28,6 +34,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../config/shared_pref_kay.dart';
|
|
|
|
|
import 'QRCode.dart';
|
|
|
|
|
|
|
|
|
|
class BookSuccess extends StatefulWidget {
|
|
|
|
|
@ -57,12 +64,15 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
String? selectedInstallments = "";
|
|
|
|
|
String? tamaraPaymentStatus;
|
|
|
|
|
String? tamaraOrderID;
|
|
|
|
|
String? transID;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
initState() {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
if (widget.patientShareResponse.isLiveCareAppointment! &&
|
|
|
|
|
(widget.patientShareResponse.patientShareWithTax.toString() == "0" || widget.patientShareResponse.patientShareWithTax.toString() == "0.0")) {
|
|
|
|
|
(widget.patientShareResponse.patientShareWithTax.toString() == "0" ||
|
|
|
|
|
widget.patientShareResponse.patientShareWithTax.toString() ==
|
|
|
|
|
"0.0")) {
|
|
|
|
|
setOnlineCheckInForAppointment();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -106,18 +116,26 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
color: CustomColors.green,
|
|
|
|
|
child: Table(
|
|
|
|
|
border: TableBorder(verticalInside: BorderSide(width: 0.5, color: Colors.white)),
|
|
|
|
|
border: TableBorder(verticalInside: BorderSide(
|
|
|
|
|
width: 0.5, color: Colors.white)),
|
|
|
|
|
children: [
|
|
|
|
|
TableRow(
|
|
|
|
|
children: [
|
|
|
|
|
TableCell(child: _getNormalText(TranslationBase.of(context).patientShare)),
|
|
|
|
|
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareWithTax)),
|
|
|
|
|
TableCell(child: _getNormalText(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.patientShare)),
|
|
|
|
|
TableCell(child: _getNormalText(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.patientShareWithTax)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
TableRow(
|
|
|
|
|
children: [
|
|
|
|
|
TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShare.toString())),
|
|
|
|
|
TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShareWithTax.toString())),
|
|
|
|
|
TableCell(child: _getHeadingText("SR " +
|
|
|
|
|
widget.patientShareResponse.patientShare.toString())),
|
|
|
|
|
TableCell(child: _getHeadingText("SR " +
|
|
|
|
|
widget.patientShareResponse.patientShareWithTax
|
|
|
|
|
.toString())),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -160,7 +178,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
return Container(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
margin: EdgeInsets.all(14),
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.18,
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height * 0.18,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -172,7 +193,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
minWidth: MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
minWidth: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.7,
|
|
|
|
|
height: 45.0,
|
|
|
|
|
child: CustomTextButton(
|
|
|
|
|
backgroundColor: CustomColors.green,
|
|
|
|
|
@ -181,7 +205,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
getAppoQR(context);
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).checkinOptions, style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.checkinOptions,
|
|
|
|
|
style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -192,7 +219,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
minWidth: MediaQuery.of(context).size.width * 0.7,
|
|
|
|
|
minWidth: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.7,
|
|
|
|
|
height: 45.0,
|
|
|
|
|
child: CustomTextButton(
|
|
|
|
|
backgroundColor: Color(0xffc5272d),
|
|
|
|
|
@ -202,7 +232,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
// getAppoQR(context);
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).done, style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.done,
|
|
|
|
|
style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -237,9 +270,16 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
startPaymentProcess();
|
|
|
|
|
projectViewModel.analytics.appointment.pay_now_for_appointment(appointment_type: 'regular', doctorDetail: widget.docObject, payNow: true);
|
|
|
|
|
projectViewModel.analytics.appointment
|
|
|
|
|
.pay_now_for_appointment(
|
|
|
|
|
appointment_type: 'regular',
|
|
|
|
|
doctorDetail: widget.docObject,
|
|
|
|
|
payNow: true);
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).payNow.toUpperCase(),
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.payNow
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 18.0,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
@ -260,9 +300,17 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
navigateToHome(context);
|
|
|
|
|
projectViewModel.analytics.appointment.pay_now_for_appointment(appointment_type: 'regular', doctorDetail: widget.docObject, payNow: false);
|
|
|
|
|
projectViewModel.analytics.appointment
|
|
|
|
|
.pay_now_for_appointment(
|
|
|
|
|
appointment_type: 'regular',
|
|
|
|
|
doctorDetail: widget.docObject,
|
|
|
|
|
payNow: false);
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).payLater.toUpperCase(), style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.payLater
|
|
|
|
|
.toUpperCase(), style: TextStyle(
|
|
|
|
|
fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -270,33 +318,37 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
),
|
|
|
|
|
widget.isCash
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
mHeight(10.0),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).cashAmountUpdateInsurance,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mHeight(5.0),
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase.of(context).updateInsuranceText,
|
|
|
|
|
() {
|
|
|
|
|
Navigator.pop(context, null);
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => LandingPage()),
|
|
|
|
|
(Route<dynamic> route) => false,
|
|
|
|
|
);
|
|
|
|
|
Navigator.push(context, FadePage(page: InsuranceUpdate()));
|
|
|
|
|
},
|
|
|
|
|
color: Color(0xffEAA118),
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
children: [
|
|
|
|
|
mHeight(10.0),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.cashAmountUpdateInsurance,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mHeight(5.0),
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.updateInsuranceText,
|
|
|
|
|
() {
|
|
|
|
|
Navigator.pop(context, null);
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => LandingPage()),
|
|
|
|
|
(Route<dynamic> route) => false,
|
|
|
|
|
);
|
|
|
|
|
Navigator.push(context, FadePage(page: InsuranceUpdate()));
|
|
|
|
|
},
|
|
|
|
|
color: Color(0xffEAA118),
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -328,17 +380,23 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.clinicID = widget.docObject.clinicID;
|
|
|
|
|
appo.projectID = widget.docObject.projectID;
|
|
|
|
|
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
|
|
|
|
|
appo.appointmentNo =
|
|
|
|
|
widget.patientShareResponse.appointmentNo;
|
|
|
|
|
appo.serviceID = widget.patientShareResponse.serviceID;
|
|
|
|
|
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.isLiveCareAppointment =
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.doctorID = widget.patientShareResponse.doctorID;
|
|
|
|
|
appo.appointmentDate = widget.patientShareResponse.appointmentDate;
|
|
|
|
|
appo.appointmentDate =
|
|
|
|
|
widget.patientShareResponse.appointmentDate;
|
|
|
|
|
if (appo.isLiveCareAppointment!)
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
else
|
|
|
|
|
navigateToHome(context);
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).confirmLater, style: TextStyle(fontSize: 16.0, color: Colors.white)),
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.confirmLater,
|
|
|
|
|
style: TextStyle(fontSize: 16.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -357,9 +415,11 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.clinicID = widget.docObject.clinicID;
|
|
|
|
|
appo.projectID = widget.docObject.projectID;
|
|
|
|
|
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
|
|
|
|
|
appo.appointmentNo =
|
|
|
|
|
widget.patientShareResponse.appointmentNo;
|
|
|
|
|
appo.serviceID = widget.patientShareResponse.serviceID;
|
|
|
|
|
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.isLiveCareAppointment =
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.doctorID = widget.patientShareResponse.doctorID;
|
|
|
|
|
if (appo.isLiveCareAppointment!) {
|
|
|
|
|
navigateToHome(context);
|
|
|
|
|
@ -367,7 +427,13 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
confirmAppointment(appo);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Text(widget.patientShareResponse.isLiveCareAppointment! ? TranslationBase.of(context).confirmLiveCare : TranslationBase.of(context).confirm,
|
|
|
|
|
child: Text(widget.patientShareResponse.isLiveCareAppointment!
|
|
|
|
|
? TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.confirmLiveCare
|
|
|
|
|
: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.confirm,
|
|
|
|
|
style: TextStyle(fontSize: 16.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -437,7 +503,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 30.0, bottom: 40.0),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(TranslationBase.of(context).confirmAppo, style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)),
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.confirmAppo,
|
|
|
|
|
style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)),
|
|
|
|
|
),
|
|
|
|
|
Flex(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
@ -451,8 +520,14 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
_getBulletPoint("1"),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
|
|
|
child: Text(TranslationBase.of(context).upcomingConfirm, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)),
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.8,
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.upcomingConfirm, overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(fontSize: 13.0)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -472,8 +547,14 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
_getBulletPoint("2"),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
|
|
|
child: Text(TranslationBase.of(context).upcomingConfirmMore, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)),
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.8,
|
|
|
|
|
child: Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.upcomingConfirmMore, overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(fontSize: 13.0)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -481,7 +562,8 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), child: getPaymentMethods()),
|
|
|
|
|
Container(margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0),
|
|
|
|
|
child: getPaymentMethods()),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -493,13 +575,17 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
setOnlineCheckInForAppointment() {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID!, projectViewModel.isArabic ? 1 : 2, context).then((res) {
|
|
|
|
|
service.setOnlineCheckInForAppointment(
|
|
|
|
|
widget.patientShareResponse.appointmentNo.toString(),
|
|
|
|
|
widget.patientShareResponse.projectID!,
|
|
|
|
|
projectViewModel.isArabic ? 1 : 2, context).then((res) {
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.clinicID = widget.docObject.clinicID;
|
|
|
|
|
appo.projectID = widget.docObject.projectID;
|
|
|
|
|
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
|
|
|
|
|
appo.serviceID = widget.patientShareResponse.serviceID;
|
|
|
|
|
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.isLiveCareAppointment =
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.doctorID = widget.patientShareResponse.doctorID;
|
|
|
|
|
appo.appointmentDate = widget.patientShareResponse.appointmentDate;
|
|
|
|
|
insertLiveCareVIDARequest(appo, isMoveHome: false);
|
|
|
|
|
@ -514,7 +600,9 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
confirmAppointment(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.confirmAppointment(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.isLiveCareAppointment!, context).then((res) {
|
|
|
|
|
service.confirmAppointment(
|
|
|
|
|
appo.appointmentNo!, appo.clinicID!, appo.projectID!,
|
|
|
|
|
appo.isLiveCareAppointment!, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
@ -533,12 +621,22 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo, {bool isMoveHome = true}) {
|
|
|
|
|
insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo,
|
|
|
|
|
{bool isMoveHome = true}) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
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!,
|
|
|
|
|
Utils.getAppointmentTransID(
|
|
|
|
|
appo.projectID, appo.clinicID, appo.appointmentNo),
|
|
|
|
|
projectViewModel.isArabic ? 1 : 2,
|
|
|
|
|
context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
@ -561,7 +659,9 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).payNowBookSuccess,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.payNowBookSuccess,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 24.0,
|
|
|
|
|
letterSpacing: -1.44,
|
|
|
|
|
@ -569,7 +669,9 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).neverWait,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.neverWait,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12.0,
|
|
|
|
|
letterSpacing: -0.54,
|
|
|
|
|
@ -577,15 +679,20 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mHeight(24),
|
|
|
|
|
Text(TranslationBase.of(context).payNowBookSuccesstext1,
|
|
|
|
|
Text(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.payNowBookSuccesstext1,
|
|
|
|
|
overflow: TextOverflow.fade,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12.0,
|
|
|
|
|
letterSpacing: -0.36,
|
|
|
|
|
)),
|
|
|
|
|
Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()),
|
|
|
|
|
Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0),
|
|
|
|
|
child: getPaymentMethods()),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).payNowBookSuccesstext2,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.payNowBookSuccesstext2,
|
|
|
|
|
overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12.0,
|
|
|
|
|
@ -601,42 +708,173 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
navigateToPaymentMethod(context, widget.patientShareResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse) async {
|
|
|
|
|
Future navigateToPaymentMethod(context,
|
|
|
|
|
PatientShareResponse patientShareResponse) async {
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.projectID = widget.patientShareResponse.projectID;
|
|
|
|
|
appo.clinicID = widget.patientShareResponse.clinicID;
|
|
|
|
|
appo.clinicName = widget.patientShareResponse.clinicName;
|
|
|
|
|
appo.projectName = widget.patientShareResponse.projectName;
|
|
|
|
|
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
|
|
|
|
|
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.isLiveCareAppointment =
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.doctorID = widget.patientShareResponse.doctorID;
|
|
|
|
|
appo.appointmentDate = widget.patientShareResponse.appointmentDate;
|
|
|
|
|
appo.serviceID = widget.patientShareResponse.serviceID;
|
|
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: PaymentMethod(
|
|
|
|
|
onSelectedMethod: (String metohd, [String? selectedInstallmentPlan]) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
patientShare: widget.patientShareResponse.patientShareWithTax)))
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: PaymentMethod(
|
|
|
|
|
onSelectedMethod: (String metohd,
|
|
|
|
|
[String? selectedInstallmentPlan]) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
patientShare: widget.patientShareResponse.patientShareWithTax)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
selectedPaymentMethod = value[0];
|
|
|
|
|
if (value != null) {
|
|
|
|
|
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');
|
|
|
|
|
if (selectedPaymentMethod == "ApplePay") {
|
|
|
|
|
startApplePay(appo, patientShareResponse);
|
|
|
|
|
} else {
|
|
|
|
|
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');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void startApplePay(AppoitmentAllHistoryResultList appo,
|
|
|
|
|
PatientShareResponse patientShareResponse) async {
|
|
|
|
|
transID = Utils.getAppointmentTransID(
|
|
|
|
|
appo.projectID, appo.clinicID, appo.appointmentNo);
|
|
|
|
|
print("TransactionID: $transID");
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
LiveCareService service = new LiveCareService();
|
|
|
|
|
ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest();
|
|
|
|
|
|
|
|
|
|
PayfortProjectDetailsRespModel? payfortProjectDetailsRespModel;
|
|
|
|
|
await context.read<PayfortViewModel>()
|
|
|
|
|
.getProjectDetailsForPayfort(projectId: appo.projectID,
|
|
|
|
|
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum())
|
|
|
|
|
.then((value) {
|
|
|
|
|
payfortProjectDetailsRespModel = value!;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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.doctorID = appo.doctorID;
|
|
|
|
|
applePayInsertRequest.projectID = appo.projectID.toString();
|
|
|
|
|
applePayInsertRequest.serviceID =
|
|
|
|
|
ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString();
|
|
|
|
|
applePayInsertRequest.channelID = 3;
|
|
|
|
|
applePayInsertRequest.patientID =
|
|
|
|
|
projectViewModel.authenticatedUserObject.user.patientID;
|
|
|
|
|
applePayInsertRequest.patientTypeID =
|
|
|
|
|
projectViewModel.authenticatedUserObject.user.patientType;
|
|
|
|
|
applePayInsertRequest.patientOutSA =
|
|
|
|
|
projectViewModel.authenticatedUserObject.user.outSA;
|
|
|
|
|
applePayInsertRequest.appointmentDate = appo.appointmentDate;
|
|
|
|
|
applePayInsertRequest.appointmentNo = appo.appointmentNo;
|
|
|
|
|
applePayInsertRequest.orderDescription = "Advance Payment";
|
|
|
|
|
applePayInsertRequest.liveServiceID = "0";
|
|
|
|
|
applePayInsertRequest.latitude = "0.0";
|
|
|
|
|
applePayInsertRequest.longitude = "0.0";
|
|
|
|
|
applePayInsertRequest.amount =
|
|
|
|
|
patientShareResponse.patientShareWithTax.toString();
|
|
|
|
|
applePayInsertRequest.isSchedule = appo.isLiveCareAppointment! ? "1" : "0";
|
|
|
|
|
applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en';
|
|
|
|
|
applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2;
|
|
|
|
|
applePayInsertRequest.userName =
|
|
|
|
|
projectViewModel.authenticatedUserObject.user.patientID;
|
|
|
|
|
applePayInsertRequest.responseContinueURL =
|
|
|
|
|
"http://hmg.com/Documents/success.html";
|
|
|
|
|
applePayInsertRequest.backClickUrl =
|
|
|
|
|
"http://hmg.com/Documents/success.html";
|
|
|
|
|
applePayInsertRequest.paymentOption = "ApplePay";
|
|
|
|
|
|
|
|
|
|
applePayInsertRequest.isMobSDK = true;
|
|
|
|
|
applePayInsertRequest.merchantReference = transID;
|
|
|
|
|
applePayInsertRequest.merchantIdentifier =
|
|
|
|
|
payfortProjectDetailsRespModel!.merchantIdentifier!;
|
|
|
|
|
applePayInsertRequest.commandType = "PURCHASE";
|
|
|
|
|
applePayInsertRequest.signature = payfortProjectDetailsRespModel!.signature;
|
|
|
|
|
applePayInsertRequest.accessCode =
|
|
|
|
|
payfortProjectDetailsRespModel!.accessCode;
|
|
|
|
|
applePayInsertRequest.shaRequestPhrase =
|
|
|
|
|
payfortProjectDetailsRespModel!.shaRequest;
|
|
|
|
|
applePayInsertRequest.shaResponsePhrase =
|
|
|
|
|
payfortProjectDetailsRespModel!.shaResponse;
|
|
|
|
|
applePayInsertRequest.returnURL = "";
|
|
|
|
|
|
|
|
|
|
service.applePayInsertRequest(applePayInsertRequest, context).then((
|
|
|
|
|
res) async {
|
|
|
|
|
await context.read<PayfortViewModel>().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<PayfortViewModel>().addPayfortApplePayResponse(
|
|
|
|
|
result: successResult);
|
|
|
|
|
checkPaymentStatus(appo);
|
|
|
|
|
},
|
|
|
|
|
projectId: appo.projectID,
|
|
|
|
|
serviceTypeEnum: ServiceTypeEnum.appointmentPayment,
|
|
|
|
|
);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openPayment(List<String?> paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async {
|
|
|
|
|
widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
|
|
|
|
|
selectedPaymentMethod = paymentMethod[0];
|
|
|
|
|
selectedInstallments = paymentMethod[1];
|
|
|
|
|
transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
|
|
|
|
|
widget.browser.openPaymentBrowser(
|
|
|
|
|
amount,
|
|
|
|
|
"Appointment check in",
|
|
|
|
|
Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!),
|
|
|
|
|
transID!,
|
|
|
|
|
appo.projectID.toString(),
|
|
|
|
|
authenticatedUser.emailAddress!,
|
|
|
|
|
paymentMethod[0]!,
|
|
|
|
|
@ -791,7 +1029,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
final currency = projectViewModel.user!.outSA == 0 ? "sar" : 'aed';
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), false, context).then((res) {
|
|
|
|
|
service.checkPaymentStatus(transID!, false, context).then((res) {
|
|
|
|
|
String paymentInfo = res['Response_Message'];
|
|
|
|
|
if (paymentInfo == 'Success') {
|
|
|
|
|
txn_ref = res['Merchant_Reference'];
|
|
|
|
|
@ -969,9 +1207,6 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_getTextStyling() {
|
|
|
|
|
return TextStyle(fontSize: 14.0, color: Colors.white, letterSpacing: 0.7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_getBulletPoint(bulletPoint) {
|
|
|
|
|
return Container(
|
|
|
|
|
@ -1062,4 +1297,8 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_getTextStyling() {
|
|
|
|
|
return TextStyle(fontSize: 14.0, color: Colors.white, letterSpacing: 0.7);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|