Appointment payment finalised, Ask Doc implemeted & other updates

merge-update-with-lab-changes
Haroon Amjad 6 years ago
parent 41c922bfeb
commit 8ad2941836

@ -67,9 +67,10 @@ const CHECK_PAYMENT_STATUS = "/PayFort_Serv.svc/REST/GetRequestStatusByRequestID
//URL create advance payment
const CREATE_ADVANCE_PAYMENT = "/Doctors.svc/REST/CreateAdvancePayment";
const ADD_ADVANCE_NUMBER_REQUEST = '/PayFort_Serv.svc/REST/AddAdvancedNumberRequest';
const IS_ALLOW_ASK_DOCTOR = '/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
//URL to get medicine and pharmacies list
const CHANNEL = 3;
const GENERAL_ID = 'Cs2020@2016\$2958';

@ -181,5 +181,5 @@ const Map<String, Map<String, String>> localizedValues = {
"payNowBookSuccesstext1": {"en": "Pay Now using online payment service From secure payment gateways", "ar": "ادفع الآن باستخدام خدمة الدفع عبر الإنترنت من بوابات الدفع الآمنة"},
"payNowBookSuccesstext2": {"en": "You can also Pay Later via online payment Or in Hospital", "ar": "يمكنك أيضًا الدفع لاحقًا عبر الدفع عبر الإنترنت أو في المستشفى"},
'payLater': {'en': 'Pay Later', 'ar': 'ادفع لاحقا'},
'askDocNotAllowed': {'en': 'This service will be available for last 15 days doctor Visit only', 'ar': 'هذه الخدمة متاحة للزيارات خلال اخر 15 يوم فقط'},
};

@ -173,7 +173,7 @@ class AppoitmentAllHistoryResultList {
doctorImageURL = json['DoctorImageURL'];
doctorNameObj = json['DoctorNameObj'];
doctorRate = json['DoctorRate'];
doctorSpeciality = json['DoctorSpeciality'].cast<String>();
doctorSpeciality = json['DoctorSpeciality'] != null ?json['DoctorSpeciality'].cast<String>() : ["null"];
doctorTitle = json['DoctorTitle'];
gender = json['Gender'];
genderDescription = json['GenderDescription'];

@ -14,6 +14,8 @@ class AppointmentDetails extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
static bool isLoading = false;
static bool showFooterButton = false;
AppointmentDetails({@required this.appo});
@override
@ -23,7 +25,6 @@ class AppointmentDetails extends StatefulWidget {
class _AppointmentDetailsState extends State<AppointmentDetails>
with SingleTickerProviderStateMixin {
static TabController _tabController;
bool showFooterButton = false;
@override
void initState() {
@ -43,7 +44,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails>
return AppScaffold(
appBarTitle: widget.appo.doctorNameObj,
isShowAppBar: true,
bottomSheet: showFooterButton
bottomSheet: AppointmentDetails.showFooterButton
? Container(
width: MediaQuery.of(context).size.width,
height: 50.0,
@ -146,9 +147,9 @@ class _AppointmentDetailsState extends State<AppointmentDetails>
onTap: (index) {
setState(() {
index == 1
? showFooterButton = true
: showFooterButton = false;
print(showFooterButton);
? AppointmentDetails.showFooterButton = true
: AppointmentDetails.showFooterButton = false;
print(AppointmentDetails.showFooterButton);
});
},
tabs: [
@ -170,7 +171,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails>
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
AppointmentActions(appo: widget.appo, tabController: _tabController),
AppointmentActions(appo: widget.appo, tabController: _tabController, enableFooterButton: enableFooterButton),
DocAvailableAppointments(doctor: getDoctorObject())
],
controller: _tabController,
@ -183,6 +184,12 @@ class _AppointmentDetailsState extends State<AppointmentDetails>
);
}
void enableFooterButton() {
setState(() {
AppointmentDetails.showFooterButton = true;
});
}
void goToBookConfirm() {
if (DocAvailableAppointments.areSlotsAvailable)
navigateToBookConfirm(context);

@ -49,7 +49,7 @@ class ArrivedButtons {
"title": "Ask Your",
"subtitle": "Doctor",
"icon": "assets/images/new-design/ask_doctor_icon.png",
"caller": "goToTodoList"
"caller": "askDoc"
},
{
"title": "Survey",

@ -18,8 +18,12 @@ import 'package:url_launcher/url_launcher.dart';
class AppointmentActions extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
TabController tabController;
final Function enableFooterButton;
AppointmentActions({@required this.appo, @required this.tabController});
AppointmentActions(
{@required this.appo,
@required this.tabController,
@required this.enableFooterButton});
@override
_AppointmentActionsState createState() => _AppointmentActionsState();
@ -117,6 +121,10 @@ class _AppointmentActionsState extends State<AppointmentActions> {
switch (AppoDetailsButton.caller) {
case "openReschedule":
widget.tabController.animateTo((widget.tabController.index + 1) % 2);
setState(() {
print("Reschedule");
widget.enableFooterButton();
});
break;
case "onCancelAppointment":
@ -146,6 +154,10 @@ class _AppointmentActionsState extends State<AppointmentActions> {
case "goToTodoList":
Navigator.of(context).pop();
break;
case "askDoc":
askYourDoc();
break;
}
}
@ -347,8 +359,23 @@ class _AppointmentActionsState extends State<AppointmentActions> {
pageBuilder: (context, animation1, animation2) {});
}
askYourDoc() {
DoctorsListService service = new DoctorsListService();
service
.isAllowedToAskDoctor(widget.appo.doctorID, context)
.then((res) {
print(res['PatientDoctorAppointmentResultList']);
if (res['PatientDoctorAppointmentResultList'].length != 0) {
} else {
AppToast.showErrorToast(message: TranslationBase.of(context).askDocNotAllowed);
}
}).catchError((err) {
print(err);
});
}
confirmAppointment() {
loading(true);
DoctorsListService service = new DoctorsListService();
service
.confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID,
@ -356,14 +383,12 @@ class _AppointmentActionsState extends State<AppointmentActions> {
.then((res) {
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
loading(false);
Navigator.of(context).pop();
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
loading(false);
}
}).catchError((err) {
print(err);
loading(false);
});
}

@ -614,7 +614,10 @@ class DoctorsListService extends BaseService {
}
Future<Map> addAdvancedNumberRequest(
String advanceNumber, String paymentReference, String appointmentID, BuildContext context) async {
String advanceNumber,
String paymentReference,
String appointmentID,
BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
@ -644,10 +647,53 @@ class DoctorsListService extends BaseService {
dynamic localRes;
await baseAppClient.post(ADD_ADVANCE_NUMBER_REQUEST,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> isAllowedToAskDoctor(int docID, BuildContext context) async {
Utils.showProgressDialog(context);
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"IsForAskYourDoctor": true,
"DoctorID": docID,
"Top": 25,
"beforeDays": 15,
"exludType": 4,
"VersionID": req.VersionID,
"Channel": req.Channel,
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": req.IPAdress,
"generalid": req.generalid,
"PatientOutSA": authUser.outSA,
"SessionID": "YckwoXhUmWBsnHKEKig",
"isDentalAllowedBackend": false,
"DeviceTypeID": req.DeviceTypeID,
"PatientID": authUser.patientID,
"TokenID": "@dm!n",
"PatientTypeID": authUser.patientType,
"PatientType": authUser.patientType
};
dynamic localRes;
await baseAppClient.post(IS_ALLOW_ASK_DOCTOR,
onSuccess: (response, statusCode) async {
localRes = response;
Utils.hideProgressDialog();
}, onFailure: (String error, int statusCode) {
Utils.hideProgressDialog();
throw error;
}, body: request);
return Future.value(localRes);
}
@ -672,7 +718,11 @@ class DoctorsListService extends BaseService {
"AppointmentNo": appo.appointmentNo.toString(),
"PaymentMethodName": paymentMethodName,
"PaymentAmount": payedAmount == 0 ? "0" : payedAmount.toString(),
"PaymentDate": payedAmount == 0 ? "" : "/Date(" + DateTime.now().millisecondsSinceEpoch.toString() + ")/",
"PaymentDate": payedAmount == 0
? ""
: "/Date(" +
DateTime.now().millisecondsSinceEpoch.toString() +
")/",
"PaymentReferenceNumber": payedAmount == 0 ? "" : paymentReference,
"ProjectID": appo.projectID.toString(),
"PatientID": authUser.patientID,

@ -292,6 +292,7 @@ class TranslationBase {
String get payNowBookSuccesstext1 => localizedValues['payNowBookSuccesstext1'][locale.languageCode];
String get payNowBookSuccesstext2 => localizedValues['payNowBookSuccesstext2'][locale.languageCode];
String get payLater => localizedValues['payLater'][locale.languageCode];
String get askDocNotAllowed => localizedValues['askDocNotAllowed'][locale.languageCode];
}

@ -10,16 +10,18 @@ import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
class MyInAppBrowser extends InAppBrowser {
static String SERVICE_URL =
'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// ignore: non_constant_identifier_names
// static String SERVICE_URL =
// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
// 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// ignore: non_constant_identifier_names
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
// '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 List<String> successURLS = [
'success',

Loading…
Cancel
Save