Merge pull request 'haroon_dev' (#364) from haroon_dev into master

Reviewed-on: https://34.17.182.140/Haroon6138/HMG_Patient_App_New/pulls/364
pull/372/head
Haroon6138 1 month ago
commit 3fc4094c75

@ -101,9 +101,7 @@ class ImmediateLiveCareRepoImp implements ImmediateLiveCareRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final respObject = response['GetERAppointmentFeesList'];
final liveCareFeesObj = LiveCareImmediateAppointmentFeesList.fromJson(respObject);
apiResponse = GenericApiModel<LiveCareImmediateAppointmentFeesList>(
messageStatus: messageStatus,
statusCode: statusCode,

@ -58,7 +58,7 @@ class PayfortRepoImp implements PayfortRepo {
try {
final list = response;
if (list == null || list.isEmpty) {
throw Exception("payfort list is empty");
throw Exception("No project configuration found.");
}
final applePayConfigurationResponse = PayfortProjectDetailsRespModel.fromJson(list[0]);

@ -17,6 +17,7 @@ import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/paytabs_config.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_project_details_resp_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
import 'package:hmg_patient_app_new/features/paytabs/models/paytabs_transaction_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_request_insert_model.dart';
@ -32,19 +33,26 @@ class PayTabsViewModel extends ChangeNotifier {
final ErrorHandlerService errorHandlerService;
late PaytabsTransactionResponseModel paytabsTransactionResponseModel;
PayfortProjectDetailsRespModel? paytabsProjectDetailsRespModel;
PayTabsViewModel({
required this.appState,
required this.payfortRepo,
required this.errorHandlerService,
});
setPaymentConfiguration(String paymentDescription, num amount, {bool isAddCard = false}) {
setPaymentConfiguration(String paymentDescription, num amount, int serviceID, int projectID, {bool isAddCard = false}) async {
String cartID = DateTime.now().millisecondsSinceEpoch.toString();
LoaderBottomSheet.showLoader();
await getPayTabsConfigurations(serviceId: serviceID, projectId: projectID);
paymentConfiguration = PaymentSdkConfigurationDetails(
profileId: PaymentSdkDefaultConfig.profileID,
serverKey: PaymentSdkDefaultConfig.serverKey,
clientKey: PaymentSdkDefaultConfig.clientKey,
transactionType: PaymentSdkTransactionType.SALE,
profileId: paytabsProjectDetailsRespModel!.merchantIdentifier,
serverKey: paytabsProjectDetailsRespModel!.accessCode,
clientKey: paytabsProjectDetailsRespModel!.shaResponse,
transactionType: PaymentSdkTransactionType.SALE,
cartId: cartID.substring((cartID.length - 5), cartID.length),
cartDescription: paymentDescription,
merchantName: PaymentSdkDefaultConfig.defaultMerchantName,
@ -112,12 +120,17 @@ class PayTabsViewModel extends ChangeNotifier {
notifyListeners();
}
setAlternatePaymentConfiguration(String paymentDescription, num amount, {bool isAddCard = false}) {
setAlternatePaymentConfiguration(String paymentDescription, num amount, int serviceID, int projectID, {bool isAddCard = false}) async {
String cartID = DateTime.now().millisecondsSinceEpoch.toString();
LoaderBottomSheet.showLoader();
await getPayTabsConfigurations(serviceId: serviceID, projectId: projectID);
paymentConfiguration = PaymentSdkConfigurationDetails(
profileId: PaymentSdkDefaultConfig.profileID,
serverKey: PaymentSdkDefaultConfig.serverKey,
clientKey: PaymentSdkDefaultConfig.clientKey,
profileId: paytabsProjectDetailsRespModel!.merchantIdentifier,
serverKey: paytabsProjectDetailsRespModel!.accessCode,
clientKey: paytabsProjectDetailsRespModel!.shaResponse,
transactionType: PaymentSdkTransactionType.SALE,
cartId: cartID.substring((cartID.length - 5), cartID.length),
cartDescription: paymentDescription,
@ -260,7 +273,7 @@ class PayTabsViewModel extends ChangeNotifier {
bool _callbackFired = false; // prevent duplicate callback invocations
try {
LoaderBottomSheet.showLoader();
// LoaderBottomSheet.showLoader();
// Create PayfortRequestInsertModel (same as Payfort implementation)
PayfortRequestInsertModel payfortRequestInsertModel = PayfortRequestInsertModel();
@ -382,7 +395,7 @@ class PayTabsViewModel extends ChangeNotifier {
required bool isSchedule,
Function(PaytabsTransactionResponseModel)? onSuccess,
Function(String)? onError}) async {
LoaderBottomSheet.showLoader();
// LoaderBottomSheet.showLoader();
TamaraRequestModel tamaraRequestModel = TamaraRequestModel();
@ -448,4 +461,23 @@ class PayTabsViewModel extends ChangeNotifier {
}
});
}
Future<void> getPayTabsConfigurations({int? serviceId, int? projectId, int integrationId = 5, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.getPayfortConfigurations(serviceId: serviceId, projectId: projectId, integrationId: integrationId);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
paytabsProjectDetailsRespModel = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
}

@ -150,10 +150,11 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
widget.patientAppointmentHistoryResponseModel.clinicID,
widget.patientAppointmentHistoryResponseModel.appointmentNo,
);
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
);
await paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
widget.patientAppointmentHistoryResponseModel.projectID);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -179,7 +180,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -263,7 +263,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
orderDescription: "Appointment Payment",
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(
paymentMethodName: selectedPaymentMethod,
@ -275,7 +274,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -391,10 +389,11 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
widget.patientAppointmentHistoryResponseModel.clinicID,
widget.patientAppointmentHistoryResponseModel.appointmentNo,
);
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
);
await paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
widget.patientAppointmentHistoryResponseModel.projectID);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -420,7 +419,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -504,7 +502,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
orderDescription: "Appointment Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(
paymentMethodName: selectedPaymentMethod,
@ -516,7 +513,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -640,7 +636,10 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
if (appState.isPaytabsEnabled) {
paytabsViewModel.setAlternatePaymentConfiguration(
"Appointment Payment", num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()));
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
widget.patientAppointmentHistoryResponseModel.projectID);
paytabsViewModel.startAlternatePayment(
liveServiceID: "0",
appointmentDate: widget.patientAppointmentHistoryResponseModel.appointmentDate!,
@ -1121,10 +1120,13 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
projectId: widget.patientAppointmentHistoryResponseModel.projectID,
integrationId: 2);
if (!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: widget.patientAppointmentHistoryResponseModel.projectID, integrationId: 2);
} else {
await paytabsViewModel.setPaymentConfiguration("Appointment Payment", num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), widget.patientAppointmentHistoryResponseModel.projectID);
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = widget.patientAppointmentHistoryResponseModel.clinicID;
@ -1160,12 +1162,13 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
applePayInsertRequest.isMobSDK = true;
applePayInsertRequest.merchantReference = transID;
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.merchantIdentifier =
appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.merchantIdentifier : payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.commandType = "PURCHASE";
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.signature = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.signature : payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.accessCode : payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaRequest : payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaResponse : payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.returnURL = "";
//TODO: Need to pass dynamic params to the Apple Pay instead of static values
@ -1173,10 +1176,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
if (appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(

@ -45,8 +45,9 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
checkInOptionCard(
AppAssets.checkin_location_icon,
Utils.havePrivilege(102)
? checkInOptionCard(
AppAssets.checkin_location_icon,
LocaleKeys.liveLocation.tr(context: context),
LocaleKeys.verifyYourLocationAtHospital.tr(context: context),
).onPress(() {
@ -71,9 +72,10 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
}, isFullScreen: false);
}
});
}),
})
: SizedBox.shrink(),
// SizedBox(height: 16.h),
// checkInOptionCard(O
// checkInOptionCard(
// AppAssets.checkin_nfc_icon,
// LocaleKeys.nfcNearFieldCommunication.tr(context: context),
// LocaleKeys.scanPhoneViaNFC.tr(context: context),

@ -173,39 +173,39 @@ class AppointmentDoctorCard extends StatelessWidget {
? SizedBox.shrink()
: Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_icon, width: 20.h, height: 20.h, fit: BoxFit.scaleDown)
.onPress(() async {
DoctorsListResponseModel selectedDoctor = DoctorsListResponseModel();
selectedDoctor.doctorID = patientAppointmentHistoryResponseModel.doctorID;
selectedDoctor.doctorImageURL = patientAppointmentHistoryResponseModel.doctorImageURL;
selectedDoctor.name = patientAppointmentHistoryResponseModel.doctorNameObj;
selectedDoctor.doctorTitle = patientAppointmentHistoryResponseModel.doctorTitle;
selectedDoctor.nationalityFlagURL = "";
selectedDoctor.speciality = patientAppointmentHistoryResponseModel.doctorSpeciality;
selectedDoctor.clinicName = patientAppointmentHistoryResponseModel.clinicName;
selectedDoctor.projectName = patientAppointmentHistoryResponseModel.projectName;
selectedDoctor.clinicID = patientAppointmentHistoryResponseModel.clinicID;
selectedDoctor.projectID = patientAppointmentHistoryResponseModel.projectID;
getIt.get<BookAppointmentsViewModel>().setSelectedDoctor(selectedDoctor);
LoaderBottomSheet.showLoader();
await getIt.get<BookAppointmentsViewModel>().getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(
isDoctorAllowedToBook: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false),
),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
// DoctorsListResponseModel selectedDoctor = DoctorsListResponseModel();
// selectedDoctor.doctorID = patientAppointmentHistoryResponseModel.doctorID;
// selectedDoctor.doctorImageURL = patientAppointmentHistoryResponseModel.doctorImageURL;
// selectedDoctor.name = patientAppointmentHistoryResponseModel.doctorNameObj;
// selectedDoctor.doctorTitle = patientAppointmentHistoryResponseModel.doctorTitle;
// selectedDoctor.nationalityFlagURL = "";
// selectedDoctor.speciality = patientAppointmentHistoryResponseModel.doctorSpeciality;
// selectedDoctor.clinicName = patientAppointmentHistoryResponseModel.clinicName;
// selectedDoctor.projectName = patientAppointmentHistoryResponseModel.projectName;
// selectedDoctor.clinicID = patientAppointmentHistoryResponseModel.clinicID;
// selectedDoctor.projectID = patientAppointmentHistoryResponseModel.projectID;
//
// getIt.get<BookAppointmentsViewModel>().setSelectedDoctor(selectedDoctor);
// LoaderBottomSheet.showLoader();
// await getIt.get<BookAppointmentsViewModel>().getDoctorProfile(onSuccess: (dynamic respData) {
// LoaderBottomSheet.hideLoader();
// Navigator.of(context).push(
// CustomPageRoute(
// page: DoctorProfilePage(
// isDoctorAllowedToBook: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false),
// ),
// ),
// );
// }, onError: (err) {
// LoaderBottomSheet.hideLoader();
// showCommonBottomSheetWithoutHeight(
// context,
// child: Utils.getErrorWidget(loadingText: err),
// callBackFunc: () {},
// isFullScreen: false,
// isCloseButtonVisible: true,
// );
// });
})
],
),
@ -220,7 +220,48 @@ class AppointmentDoctorCard extends StatelessWidget {
],
),
),
);
).onPress(() async {
if ((patientAppointmentHistoryResponseModel.isLiveCareAppointment! ||
patientAppointmentHistoryResponseModel.isExecludeDoctor! ||
patientAppointmentHistoryResponseModel.isClinicReBookingAllowed! == false ||
patientAppointmentHistoryResponseModel.isActiveDoctor! == false ||
!Utils.isClinicAllowedForRebook(patientAppointmentHistoryResponseModel.clinicID))) {
} else {
DoctorsListResponseModel selectedDoctor = DoctorsListResponseModel();
selectedDoctor.doctorID = patientAppointmentHistoryResponseModel.doctorID;
selectedDoctor.doctorImageURL = patientAppointmentHistoryResponseModel.doctorImageURL;
selectedDoctor.name = patientAppointmentHistoryResponseModel.doctorNameObj;
selectedDoctor.doctorTitle = patientAppointmentHistoryResponseModel.doctorTitle;
selectedDoctor.nationalityFlagURL = "";
selectedDoctor.speciality = patientAppointmentHistoryResponseModel.doctorSpeciality;
selectedDoctor.clinicName = patientAppointmentHistoryResponseModel.clinicName;
selectedDoctor.projectName = patientAppointmentHistoryResponseModel.projectName;
selectedDoctor.clinicID = patientAppointmentHistoryResponseModel.clinicID;
selectedDoctor.projectID = patientAppointmentHistoryResponseModel.projectID;
getIt.get<BookAppointmentsViewModel>().setSelectedDoctor(selectedDoctor);
LoaderBottomSheet.showLoader();
await getIt.get<BookAppointmentsViewModel>().getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(
isDoctorAllowedToBook: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false),
),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}
});
}
Widget getAppointmentActionButtons(bool isAppointmentArrived) {

@ -137,10 +137,8 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12,
DateTime.now().millisecondsSinceEpoch,
);
paytabsViewModel.setPaymentConfiguration(
"LiveCare Payment",
num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
);
await paytabsViewModel.setPaymentConfiguration("LiveCare Payment", num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12));
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
@ -149,10 +147,10 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
amount: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "LiveCare Payment",
serviceID: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(),
serviceID: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(),
projectID: (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12).toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr());
@ -306,10 +304,8 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12,
DateTime.now().millisecondsSinceEpoch,
);
paytabsViewModel.setPaymentConfiguration(
"LiveCare Payment",
num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
);
await paytabsViewModel.setPaymentConfiguration("LiveCare Payment", num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12));
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
@ -318,10 +314,10 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
amount: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "LiveCare Payment",
serviceID: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(),
serviceID: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(),
projectID: (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12).toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr());
@ -471,7 +467,9 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
);
if (appState.isPaytabsEnabled) {
paytabsViewModel.setAlternatePaymentConfiguration(
"LiveCare Payment", num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()));
"LiveCare Payment", num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total!),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(),
(ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12));
paytabsViewModel.startAlternatePayment(
liveServiceID: immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
@ -817,9 +815,13 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
);
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), projectId: ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12, integrationId: 2);
if (!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), projectId: ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12, integrationId: 2);
} else {
await paytabsViewModel.setPaymentConfiguration("LiveCare Payment", num.parse((immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0")),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12));
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID!;
@ -856,20 +858,19 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
applePayInsertRequest.isMobSDK = true;
applePayInsertRequest.merchantReference = transID;
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.merchantIdentifier = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.merchantIdentifier : payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.commandType = "PURCHASE";
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.signature = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.signature : payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.accessCode : payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaRequest : payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaResponse : payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.returnURL = "";
//TODO: Need to pass dynamic params to the Apple Pay instead of static values
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest).then((value) {
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest).then((value) async {
if (appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration("Advance Payment", num.parse((immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0")));
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr());
await immediateLiveCareViewModel.addNewCallRequestForImmediateLiveCare(transactionData.transactionReference!);

@ -146,7 +146,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!,
);
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), bookAppointmentsViewModel.selectedDoctor.projectID!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -316,7 +316,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!,
);
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), bookAppointmentsViewModel.selectedDoctor.projectID!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -854,7 +854,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!,
);
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), bookAppointmentsViewModel.selectedDoctor.projectID!);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
await bookAppointmentsViewModel.insertSpecificAppointmentForWalkIn(onSuccess: (val) async {

@ -131,7 +131,7 @@ class _ErOnlineCheckinPaymentPageState extends State<ErOnlineCheckinPaymentPage>
paytabsViewModel.setPaymentConfiguration(
"ER Online Check-In Payment",
emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!,
);
ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum(), emergencyServicesViewModel.selectedHospital!.iD);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -238,7 +238,7 @@ class _ErOnlineCheckinPaymentPageState extends State<ErOnlineCheckinPaymentPage>
paytabsViewModel.setPaymentConfiguration(
"ER Online Check-In Payment",
emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!,
);
ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum(), emergencyServicesViewModel.selectedHospital!.iD);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -533,7 +533,7 @@ class _ErOnlineCheckinPaymentPageState extends State<ErOnlineCheckinPaymentPage>
paytabsViewModel.setPaymentConfiguration(
"ER Online Check-In Payment",
emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!,
);
ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum(), emergencyServicesViewModel.selectedHospital!.iD);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
if (emergencyServicesViewModel.isERBookAppointment) {

@ -116,7 +116,8 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
selectedPaymentMethod = "MADA";
if (appState.isPaytabsEnabled) {
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount);
await paytabsViewModel.setPaymentConfiguration(
"Advance Payment", habibWalletVM.walletRechargeAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), habibWalletVM.selectedHospital!.iD!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -313,7 +314,8 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
selectedPaymentMethod = "VISA";
if (appState.isPaytabsEnabled) {
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount);
await paytabsViewModel.setPaymentConfiguration(
"Advance Payment", habibWalletVM.walletRechargeAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), habibWalletVM.selectedHospital!.iD!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -543,7 +545,11 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
await payfortViewModel.getPayfortConfigurations(serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), projectId: habibWalletVM.selectedHospital!.iD!, integrationId: 2);
if(!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), projectId: habibWalletVM.selectedHospital!.iD!, integrationId: 2);
} else {
await paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), habibWalletVM.selectedHospital!.iD!);
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = 0;
@ -579,12 +585,12 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
applePayInsertRequest.isMobSDK = true;
applePayInsertRequest.merchantReference = transID;
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.merchantIdentifier = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.merchantIdentifier : payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.commandType = "PURCHASE";
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.signature = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.signature : payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.accessCode : payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaRequest : payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaResponse : payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.returnURL = "";
//TODO: Need to pass dynamic params to the Apple Pay instead of static values
@ -592,7 +598,6 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
if(appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader();
await habibWalletVM.HISCreateAdvancePayment(

@ -357,21 +357,7 @@ class _LandingPageState extends State<LandingPage> {
// spacing: 18.h,
children: [
Stack(clipBehavior: Clip.none, children: [
if (appState.isAuthenticated)
Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 24.h, width: 24.h).onPress(() async {
if (appState.isAuthenticated) {
notificationsViewModel.setNotificationStatusID(2);
notificationsViewModel.getAllNotifications();
Navigator.of(context).push(
CustomPageRoute(
page: NotificationsListPage(),
// page: LoginScreen(),
),
);
} else {
await authVM.onLoginPressed();
}
}),
if (appState.isAuthenticated) Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 24.h, width: 24.h),
(appState.isAuthenticated && todoSectionVM.notificationsCount != null && todoSectionVM.notificationsCount != "0")
? Positioned(
// right: appState.isArabic() ? 8.w : -8.w,
@ -399,7 +385,20 @@ class _LandingPageState extends State<LandingPage> {
),
)
: SizedBox.shrink(),
]),
]).onPress(() async {
if (appState.isAuthenticated) {
notificationsViewModel.setNotificationStatusID(2);
notificationsViewModel.getAllNotifications();
Navigator.of(context).push(
CustomPageRoute(
page: NotificationsListPage(),
// page: LoginScreen(),
),
);
} else {
await authVM.onLoginPressed();
}
}),
SizedBox(
width: 24.w,
),

@ -150,10 +150,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
widget.projectID,
appState.getAuthenticatedUser()!.patientId!,
);
paytabsViewModel.setPaymentConfiguration(
"Ancillary Orders Payment",
widget.totalAmount,
);
await paytabsViewModel.setPaymentConfiguration("Ancillary Orders Payment", widget.totalAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), widget.projectID);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
@ -289,10 +286,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
widget.projectID,
appState.getAuthenticatedUser()!.patientId!,
);
paytabsViewModel.setPaymentConfiguration(
"Ancillary Orders Payment",
widget.totalAmount,
);
await paytabsViewModel.setPaymentConfiguration("Ancillary Orders Payment", widget.totalAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), widget.projectID);
paytabsViewModel.startCardPayment(paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "false",
@ -721,11 +715,13 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
transID = Utils.getAdvancePaymentTransID(widget.projectID, user!.patientId!);
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum(),
projectId: widget.projectID,
integrationId: 2,
);
if (!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum(),
projectId: widget.projectID,
integrationId: 2,
);
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = 0;
@ -770,6 +766,10 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
applePayInsertRequest.returnURL = "";
try {
if (appState.isPaytabsEnabled) {
await paytabsViewModel.setPaymentConfiguration("Ancillary Orders Payment", widget.totalAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), widget.projectID);
}
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest);
} catch (error) {
log("Apple Pay Insert Request Failed: $error");
@ -787,10 +787,6 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
if(appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration(
"Ancillary Orders Payment",
widget.totalAmount,
);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
final paymentAmount = widget.totalAmount;
final fortId = transactionData.transactionReference;

Loading…
Cancel
Save