Apple Pay code merged into main branch

dev_3.3_AmbulanceRequestCR^2
haroon amjad 2 years ago
parent 48202ffd12
commit d3bdcfa975

@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders';
var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_ORDER_HISTORY = '/api/orders/items';
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:4422/'; // var BASE_URL = 'http://10.50.100.198:4422/';
var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/'; var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'http://10.20.200.111:1010/';
// var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/';
@ -343,7 +343,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari
var CHANNEL = 3; var CHANNEL = 3;
var GENERAL_ID = 'Cs2020@2016\$2958'; var GENERAL_ID = 'Cs2020@2016\$2958';
var IP_ADDRESS = '10.20.10.20'; var IP_ADDRESS = '10.20.10.20';
var VERSION_ID = 11.9; var VERSION_ID = 12.0;
var SETUP_ID = '91877'; var SETUP_ID = '91877';
var LANGUAGE = 2; var LANGUAGE = 2;
// var PATIENT_OUT_SA = 0; // var PATIENT_OUT_SA = 0;
@ -630,9 +630,9 @@ var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceComp
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";
var payFortEnvironment = FortEnvironment.production; var payFortEnvironment = FortEnvironment.production;
var applePayMerchantId = "merchant.com.hmgwebservices";
// var payFortEnvironment = FortEnvironment.test; // var payFortEnvironment = FortEnvironment.test;
// var applePayMerchantId = "merchant.com.hmgwebservices.uat"; // var applePayMerchantId = "merchant.com.hmgwebservices.uat";
var applePayMerchantId = "merchant.com.hmgwebservices";
class AppGlobal { class AppGlobal {

@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_pro
import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_orders_proc_list.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_orders_proc_list.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.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_project_details_resp_model.dart';
@ -803,6 +804,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
okFunction: () { okFunction: () {
AlertDialogBox.closeAlertDialog(context); AlertDialogBox.closeAlertDialog(context);
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
}).showAlertDialog(context); }).showAlertDialog(context);
} }

@ -64,6 +64,7 @@ class _BookSuccessState extends State<BookSuccess> {
String selectedInstallments = ""; String selectedInstallments = "";
String tamaraPaymentStatus; String tamaraPaymentStatus;
String tamaraOrderID; String tamaraOrderID;
String transID;
@override @override
initState() { initState() {
@ -642,7 +643,7 @@ class _BookSuccessState extends State<BookSuccess> {
} }
void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async { void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async {
String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
print("TransactionID: $transID"); print("TransactionID: $transID");
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -726,10 +727,11 @@ class _BookSuccessState extends State<BookSuccess> {
widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
selectedPaymentMethod = paymentMethod[0]; selectedPaymentMethod = paymentMethod[0];
selectedInstallments = paymentMethod[1]; selectedInstallments = paymentMethod[1];
transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
widget.browser.openPaymentBrowser( widget.browser.openPaymentBrowser(
amount, amount,
"Appointment check in", "Appointment check in",
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), transID,
appo.projectID.toString(), appo.projectID.toString(),
authenticatedUser.emailAddress, authenticatedUser.emailAddress,
paymentMethod[0], paymentMethod[0],
@ -884,7 +886,7 @@ class _BookSuccessState extends State<BookSuccess> {
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService(); 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']; String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') { if (paymentInfo == 'Success') {
txn_ref = res['Merchant_Reference']; txn_ref = res['Merchant_Reference'];

@ -92,6 +92,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
List<AppoitmentAllHistoryResultList> appoList = []; List<AppoitmentAllHistoryResultList> appoList = [];
List<AncillaryOrdersListModel> ancillaryLists = []; List<AncillaryOrdersListModel> ancillaryLists = [];
List<OBGyneProcedureListResponse> obGyneAppoList = []; List<OBGyneProcedureListResponse> obGyneAppoList = [];
String transID;
@override @override
void initState() { void initState() {
@ -1061,11 +1062,11 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) {
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
browser.openPaymentBrowser( browser.openPaymentBrowser(
amount, amount,
"Appointment check in", "Appointment check in",
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), transID,
appo.projectID.toString(), appo.projectID.toString(),
authenticatedUser.emailAddress, authenticatedUser.emailAddress,
paymentMethod[0], paymentMethod[0],
@ -1214,7 +1215,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService(); 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) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
String paymentInfo = res['Response_Message']; String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') { if (paymentInfo == 'Success') {
@ -1319,7 +1320,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
} }
void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async { void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async {
String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
print("TransactionID: $transID"); print("TransactionID: $transID");
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);

@ -89,6 +89,9 @@ class _clinic_listState extends State<ClinicList> {
String tamaraOrderID; String tamaraOrderID;
String selectedInstallmentPlan; String selectedInstallmentPlan;
String transID;
BuildContext localContext;
@override @override
void initState() { void initState() {
liveCareClinicsListResponse = new LiveCareClinicsListResponse(); liveCareClinicsListResponse = new LiveCareClinicsListResponse();
@ -114,6 +117,7 @@ class _clinic_listState extends State<ClinicList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
localContext = context;
getLanguageID(); getLanguageID();
return Container( return Container(
child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList(), child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList(),
@ -325,6 +329,7 @@ class _clinic_listState extends State<ClinicList> {
patientShare: num.parse(getERAppointmentFeesList.total), patientShare: num.parse(getERAppointmentFeesList.total),
isFromAdvancePayment: widget.isPharmacyLiveCare, isFromAdvancePayment: widget.isPharmacyLiveCare,
))).then((value) { ))).then((value) {
if (value != null) {
selectedPaymentMethod = value[0]; selectedPaymentMethod = value[0];
print(value); print(value);
widget.isPharmacyLiveCare = isPharmacyLiveCare; widget.isPharmacyLiveCare = isPharmacyLiveCare;
@ -337,19 +342,21 @@ class _clinic_listState extends State<ClinicList> {
} }
projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value[0], payment_type: 'appointment'); projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value[0], payment_type: 'appointment');
} }
}
}); });
} }
void startApplePay(AppoitmentAllHistoryResultList appo, String amount) async { void startApplePay(AppoitmentAllHistoryResultList appo, String amount) async {
String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); try {
transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
print("TransactionID: $transID"); print("TransactionID: $transID");
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(localContext);
LiveCareService service = new LiveCareService(); LiveCareService service = new LiveCareService();
ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest();
PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; PayfortProjectDetailsRespModel payfortProjectDetailsRespModel;
await context await localContext
.read<PayfortViewModel>() .read<PayfortViewModel>()
.getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), languageID: projectViewModel.isArabic ? 1 : 2) .getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), languageID: projectViewModel.isArabic ? 1 : 2)
.then((value) { .then((value) {
@ -396,8 +403,8 @@ class _clinic_listState extends State<ClinicList> {
applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse;
applePayInsertRequest.returnURL = ""; applePayInsertRequest.returnURL = "";
service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { service.applePayInsertRequest(applePayInsertRequest, localContext).then((res) async {
await context.read<PayfortViewModel>().initiateApplePayWithPayfort( await localContext.read<PayfortViewModel>().initiateApplePayWithPayfort(
customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName,
customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
orderDescription: "LiveCare Payment", orderDescription: "LiveCare Payment",
@ -407,12 +414,13 @@ class _clinic_listState extends State<ClinicList> {
currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR",
onFailed: (failureResult) async { onFailed: (failureResult) async {
log("failureResult: ${failureResult.toString()}"); log("failureResult: ${failureResult.toString()}");
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(localContext);
AppToast.showErrorToast(message: failureResult.toString()); AppToast.showErrorToast(message: failureResult.toString());
}, },
onSuccess: (successResult) async { onSuccess: (successResult) async {
GifLoaderDialogUtils.hideDialog(localContext);
log("Payfort: ${successResult.responseMessage}"); log("Payfort: ${successResult.responseMessage}");
await context.read<PayfortViewModel>().addPayfortApplePayResponse(result: successResult); await localContext.read<PayfortViewModel>().addPayfortApplePayResponse(result: successResult);
checkPaymentStatus(appo); checkPaymentStatus(appo);
}, },
projectId: appo.projectID, projectId: appo.projectID,
@ -420,39 +428,24 @@ class _clinic_listState extends State<ClinicList> {
); );
}).catchError((err) { }).catchError((err) {
print(err); print(err);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(localContext);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
}); });
} catch (ex) {
print(ex.toString());
GifLoaderDialogUtils.hideDialog(localContext);
}
} }
openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) { openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) {
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo);
selectedPaymentMethod = paymentMethod[0]; selectedPaymentMethod = paymentMethod[0];
selectedInstallmentPlan = paymentMethod[1]; selectedInstallmentPlan = paymentMethod[1];
this.amount = amount.toString(); this.amount = amount.toString();
browser.openPaymentBrowser( browser.openPaymentBrowser(amount, "LiveCare Payment", widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : transID, "12", authenticatedUser.emailAddress, paymentMethod[0],
amount, authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "4", selectedClinicID, context, "", "", "", "", paymentMethod[1]);
"LiveCare Payment",
widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo),
"12",
authenticatedUser.emailAddress,
paymentMethod[0],
authenticatedUser.patientType,
authenticatedUser.firstName,
authenticatedUser.patientID,
authenticatedUser,
browser,
false,
"4",
selectedClinicID,
context,
"",
"",
"",
"",
paymentMethod[1]);
} }
onBrowserLoadStart(String url) { onBrowserLoadStart(String url) {
@ -560,10 +553,7 @@ class _clinic_listState extends State<ClinicList> {
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
service service.checkPaymentStatus(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : transID, widget.isPharmacyLiveCare, context).then((res) {
.checkPaymentStatus(
widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), widget.isPharmacyLiveCare, context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
String paymentInfo = res['Response_Message']; String paymentInfo = res['Response_Message'];
amount = res['Amount'].toString(); amount = res['Amount'].toString();
@ -611,7 +601,7 @@ class _clinic_listState extends State<ClinicList> {
isDataLoaded = false; isDataLoaded = false;
LiveCareService service = new LiveCareService(); LiveCareService service = new LiveCareService();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
service.getLivecareClinics(languageID == 'ar' ? 1: 2, context).then((res) { service.getLivecareClinics(languageID == 'ar' ? 1 : 2, context).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
print(res['PatientER_GetClinicsList'].length); print(res['PatientER_GetClinicsList'].length);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {

@ -49,12 +49,8 @@ class PayfortService extends BaseService {
"ECI": result.eci, "ECI": result.eci,
"Response_Message": result.responseMessage, "Response_Message": result.responseMessage,
"Card_Number": result.cardNumber, "Card_Number": result.cardNumber,
// "Card_Bin": result.ca,
"Status": result.status, "Status": result.status,
"Merchant_Ref": result.merchantReference, "Merchant_Ref": result.merchantReference,
// Installments_Number
// plan_code
// issuer_code
"Pat_Token": result.tokenName, "Pat_Token": result.tokenName,
"IsRefund": false, "IsRefund": false,
"RemmeberMe": false, "RemmeberMe": false,
@ -62,7 +58,6 @@ class PayfortService extends BaseService {
"LanguageID": 1, "LanguageID": 1,
}; };
// PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel();
await baseAppClient.post( await baseAppClient.post(
addPayFortApplePayResponse, addPayFortApplePayResponse,
onSuccess: (response, statusCode) async { onSuccess: (response, statusCode) async {

Loading…
Cancel
Save