InPatient Advance payment API implemented

Dev_3.3_InPatient_CR
haroon amjad 1 year ago
parent a9ae44ca89
commit ae0fca865d

@ -616,6 +616,8 @@ var GET_MEDICAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getPatientAdmissionReques
var GET_INPATIENT_ADVANCE_PAYMENT_REQUESTS = 'Services/INPs.svc/REST/getInpatientAdvancePendingPayment';
var GET_INPATIENT_ADVANCE_PAYMENT_LINK = 'Services/PayFort_Serv.svc/REST/InsertInPatientAdvanceDetails';
var INSERT_INPATIENT_ORDER = 'Services/INPs.svc/REST/Inpcp_insertOrder';
var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymothermrn';

@ -39,7 +39,7 @@ class ResponseInpatientAdvanceInfo {
String createdOn;
int patientId;
int projectId;
int requestedAmount;
num requestedAmount;
String setupId;
int status;

@ -1,6 +1,9 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_inpatient_advance_requests_response_model.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
@ -8,6 +11,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';
class InPatientPendingAdvancePayment extends StatefulWidget {
InPatientAdvanceResponseModel inPatientAdvanceResponseModel;
@ -185,7 +189,7 @@ class _InPatientPendingAdvancePaymentState extends State<InPatientPendingAdvance
DefaultButton(
TranslationBase.of(context).payNow.toUpperCase(),
() {
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse("https://google.com/")), options: _InAppBrowserOptions);
getInPatientPaymentLink(false);
},
// : null,
color: CustomColors.green,
@ -205,9 +209,7 @@ class _InPatientPendingAdvancePaymentState extends State<InPatientPendingAdvance
DefaultButton(
TranslationBase.of(context).copyLink.toUpperCase(),
() {
Clipboard.setData(const ClipboardData(text: "https://google.com/")).then((_) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(TranslationBase.of(context).paymentLinkCopied)));
});
getInPatientPaymentLink(true);
},
svgIcon: "assets/images/new/copy.svg",
color: CustomColors.accentColor,
@ -220,4 +222,38 @@ class _InPatientPendingAdvancePaymentState extends State<InPatientPendingAdvance
),
);
}
void getInPatientPaymentLink(bool isCopy) {
ClinicListService service = new ClinicListService();
GifLoaderDialogUtils.showMyDialog(context);
int orderID = DateTime.now().microsecondsSinceEpoch;
int clinicID = projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.clinicID : 17;
service
.getInPatientPaymentLink(
projectViewModel.inPatientProjectID,
projectViewModel.getAdmissionInfoResponseModel.admissionNo,
orderID,
projectViewModel.user.firstName + " " + projectViewModel.user.lastName,
projectViewModel.user.emailAddress,
widget.inPatientAdvanceResponseModel.responseInpatientAdvanceInfo[0].requestedAmount,
projectViewModel.user.patientIdentificationNo,
clinicID,
context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["MessageStatus"] == 1) {
String paymentLink = res["PaymentUrl"];
if (isCopy) {
Share.share(paymentLink);
} else {
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(paymentLink)), options: _InAppBrowserOptions);
}
} else {
AppToast.showErrorToast(message: res["endUserMessage"]);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
}

@ -289,13 +289,17 @@ class InPatientServicesHome extends StatelessWidget {
ClinicListService service = new ClinicListService();
GifLoaderDialogUtils.showMyDialog(context);
service
.getInPatientAdvancePaymentRequests(
projectViewModel.inPatientProjectID, projectViewModel.getAdmissionInfoResponseModel.admissionNo, projectViewModel.getAdmissionInfoResponseModel.admissionRequestNo, context)
.getInPatientAdvancePaymentRequests(projectViewModel.inPatientProjectID, projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionNo : 0,
projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionRequestNo : projectViewModel.getAdmissionRequestInfoResponseModel.admissionRequestNo, context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["MessageStatus"] == 1) {
inPatientAdvanceResponseModel = InPatientAdvanceResponseModel.fromJson(res["responseInpatient"]);
Navigator.push(context, FadePage(page: InPatientAdvancePayment(inPatientAdvanceResponseModel: inPatientAdvanceResponseModel)));
if (res['responseInpatient'] != null) {
inPatientAdvanceResponseModel = InPatientAdvanceResponseModel.fromJson(res["responseInpatient"]);
Navigator.push(context, FadePage(page: InPatientAdvancePayment(inPatientAdvanceResponseModel: inPatientAdvanceResponseModel)));
} else {
AppToast.showErrorToast(message: "No record found.");
}
} else {
AppToast.showErrorToast(message: res["endUserMessage"]);
}

@ -107,6 +107,37 @@ class ClinicListService extends BaseService {
return Future.value(localRes);
}
Future<Map> getInPatientPaymentLink(int projectID, int admissionNo, int orderID, String name, String email, num amount, String nationalID, int clinicID, context) async {
Map<String, dynamic> request;
// request = {"ProjectID": projectID, "AdmissionReqNo": admissionReqNo, "AdmissionNo": admissionNo};
request = {
"ProjectID": projectID,
"ClientOrderID": admissionNo,
"OrderDescription": "InPatient Advance Payment",
"CustomerName": name,
"CustomerEmail": email,
"Amount": amount,
"IsPaid": 0,
"AppointmentID": admissionNo.toString(),
"PaymentOption": "0",
"PaymentReferenceNumber": admissionNo,
"SourceType": "1",
"NationalID": nationalID,
"ClinicID": clinicID,
"createdBy": 102
};
dynamic localRes;
await baseAppClient.post(GET_INPATIENT_ADVANCE_PAYMENT_LINK, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request, isAllowAny: true);
return Future.value(localRes);
}
Future<Map> getMedicalInstructions(int projectID, context) async {
Map<String, dynamic> request;
request = {"ProjectID": projectID};
@ -239,8 +270,8 @@ class ClinicListService extends BaseService {
return Future.value(localRes);
}
Future<Map> insertInPatientOrder(
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel, int typeID, String patientName, String patientNameAR, String patientMobileNo, String comments, context) async {
Future<Map> insertInPatientOrder(GetAdmissionInfoResponseModel getAdmissionInfoResponseModel, int typeID, String patientName, String patientNameAR, String patientMobileNo, String comments,
context) async {
Map<String, dynamic> request;
request = {
"ProjectID": getAdmissionInfoResponseModel.projectID,

@ -604,6 +604,7 @@ class _AppDrawerState extends State<AppDrawer> {
await _privilegeService.getPrivilege();
projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList);
projectProvider.setIsPatientAdmitted(false);
projectProvider.setPatientHasAdmissionRequest(false);
projectProvider.setInPatientProjectID(0);
var appLanguage = await sharedPref.getString(APP_LANGUAGE);
await sharedPref.clear();

@ -35,11 +35,11 @@ class MyInAppBrowser extends InAppBrowser {
// static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE
static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
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://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS
// static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS
// static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
// 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';

@ -196,6 +196,7 @@ dependencies:
# flutter_hms_gms_availability: ^2.0.0
huawei_hmsavailability: ^6.6.0+300
huawei_location: 6.0.0+302
share_plus: ^6.3.4
# Marker Animation
# flutter_animarker: ^3.2.0

Loading…
Cancel
Save