|
|
|
|
@ -116,7 +116,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Utils.buildImgWithAssets(icon: AppAssets.mada, width: 72.h, height: 25.h),
|
|
|
|
|
Utils.buildImgWithAssets(icon: AppAssets.mada, width: 72.h, height: 25.h, fit: BoxFit.contain),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
LocaleKeys.mada.tr(context: context).toText16(isBold: true),
|
|
|
|
|
],
|
|
|
|
|
@ -135,7 +135,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingSymmetrical(16.h, 16.h),
|
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() async {
|
|
|
|
|
selectedPaymentMethod = "MADA";
|
|
|
|
|
if (appState.isPaytabsEnabled) {
|
|
|
|
|
paytabsViewModel.setPaymentConfiguration(
|
|
|
|
|
@ -179,7 +179,66 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
openPaymentURL("mada");
|
|
|
|
|
if (appState.isPayfortHostedPageEnabled) {
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPaymentInformation.tr(context: context));
|
|
|
|
|
|
|
|
|
|
transID = Utils.getAppointmentTransID(
|
|
|
|
|
bookAppointmentsViewModel.selectedDoctor.projectID!,
|
|
|
|
|
bookAppointmentsViewModel.selectedDoctor.clinicID!,
|
|
|
|
|
bookAppointmentsViewModel.selectedDoctor.doctorID!,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await payfortViewModel.getPayfortConfigurations(
|
|
|
|
|
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: bookAppointmentsViewModel.selectedDoctor.projectID!, integrationId: 1);
|
|
|
|
|
|
|
|
|
|
payfortViewModel.initiatePaymentWithCard(
|
|
|
|
|
transactionID: transID,
|
|
|
|
|
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
|
|
|
|
|
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
|
|
|
|
|
onSucceeded: (paymentResult) async {
|
|
|
|
|
print("Payment Success Data: ${paymentResult.toString()}");
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
|
|
|
|
|
await bookAppointmentsViewModel.insertSpecificAppointmentForWalkIn(onSuccess: (val) async {
|
|
|
|
|
String appointmentNo = val.data['AppointmentNo'].toString();
|
|
|
|
|
await myAppointmentsViewModel.createAdvancePayment(
|
|
|
|
|
paymentMethodName: selectedPaymentMethod,
|
|
|
|
|
projectID: bookAppointmentsViewModel.waitingAppointmentProjectID,
|
|
|
|
|
clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!,
|
|
|
|
|
appointmentNo: appointmentNo,
|
|
|
|
|
payedAmount: payfortViewModel.payfortCheckPaymentStatusResponseModel!.amount!,
|
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
|
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
|
|
|
|
|
patientType: appState.getAuthenticatedUser()!.patientType!,
|
|
|
|
|
onSuccess: (value) async {
|
|
|
|
|
print(value);
|
|
|
|
|
await myAppointmentsViewModel.addAdvanceNumberRequest(
|
|
|
|
|
advanceNumber: Utils.isVidaPlusProject(bookAppointmentsViewModel.waitingAppointmentProjectID)
|
|
|
|
|
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
|
|
|
|
: value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
|
appointmentNo: appointmentNo,
|
|
|
|
|
onSuccess: (value) async {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
sendCheckInRequest(bookAppointmentsViewModel.waitingAppointmentNFCCode, appointmentNo, context);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onFailed: (err) {
|
|
|
|
|
print("Payment Failed Data: ${err.toString()}");
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr(context: context)),
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
openPaymentURL("mada");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
@ -199,7 +258,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
|
|
|
|
|
children: [
|
|
|
|
|
Utils.buildImgWithAssets(icon: AppAssets.visa, width: 50.h, height: 50.h),
|
|
|
|
|
SizedBox(width: 8.h),
|
|
|
|
|
Utils.buildImgWithAssets(icon: AppAssets.mastercard, width: 40.h, height: 40.h),
|
|
|
|
|
Utils.buildImgWithAssets(icon: AppAssets.mastercard, width: 40.h, height: 40.h, fit: BoxFit.contain),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
@ -220,7 +279,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingSymmetrical(16.h, 16.h),
|
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() async {
|
|
|
|
|
selectedPaymentMethod = "VISA";
|
|
|
|
|
if (appState.isPaytabsEnabled) {
|
|
|
|
|
paytabsViewModel.setPaymentConfiguration(
|
|
|
|
|
@ -264,7 +323,66 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
openPaymentURL("visa");
|
|
|
|
|
if (appState.isPayfortHostedPageEnabled) {
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPaymentInformation.tr(context: context));
|
|
|
|
|
|
|
|
|
|
transID = Utils.getAppointmentTransID(
|
|
|
|
|
bookAppointmentsViewModel.selectedDoctor.projectID!,
|
|
|
|
|
bookAppointmentsViewModel.selectedDoctor.clinicID!,
|
|
|
|
|
bookAppointmentsViewModel.selectedDoctor.doctorID!,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await payfortViewModel.getPayfortConfigurations(
|
|
|
|
|
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: bookAppointmentsViewModel.selectedDoctor.projectID!, integrationId: 1);
|
|
|
|
|
|
|
|
|
|
payfortViewModel.initiatePaymentWithCard(
|
|
|
|
|
transactionID: transID,
|
|
|
|
|
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
|
|
|
|
|
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
|
|
|
|
|
onSucceeded: (paymentResult) async {
|
|
|
|
|
print("Payment Success Data: ${paymentResult.toString()}");
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
|
|
|
|
|
await bookAppointmentsViewModel.insertSpecificAppointmentForWalkIn(onSuccess: (val) async {
|
|
|
|
|
String appointmentNo = val.data['AppointmentNo'].toString();
|
|
|
|
|
await myAppointmentsViewModel.createAdvancePayment(
|
|
|
|
|
paymentMethodName: selectedPaymentMethod,
|
|
|
|
|
projectID: bookAppointmentsViewModel.waitingAppointmentProjectID,
|
|
|
|
|
clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!,
|
|
|
|
|
appointmentNo: appointmentNo,
|
|
|
|
|
payedAmount: payfortViewModel.payfortCheckPaymentStatusResponseModel!.amount!,
|
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
|
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
|
|
|
|
|
patientType: appState.getAuthenticatedUser()!.patientType!,
|
|
|
|
|
onSuccess: (value) async {
|
|
|
|
|
print(value);
|
|
|
|
|
await myAppointmentsViewModel.addAdvanceNumberRequest(
|
|
|
|
|
advanceNumber: Utils.isVidaPlusProject(bookAppointmentsViewModel.waitingAppointmentProjectID)
|
|
|
|
|
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
|
|
|
|
: value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
|
appointmentNo: appointmentNo,
|
|
|
|
|
onSuccess: (value) async {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
sendCheckInRequest(bookAppointmentsViewModel.waitingAppointmentNFCCode, appointmentNo, context);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onFailed: (err) {
|
|
|
|
|
print("Payment Failed Data: ${err.toString()}");
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr(context: context)),
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
openPaymentURL("visa");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
|