|
|
|
|
@ -103,7 +103,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.visaOrMastercard.tr(context: context).toText16(isBold: true).toShimmer2(isShow: todoVM.isProcessingPayment),
|
|
|
|
|
Image.asset(AppAssets.mada, width: 50.h, height: 50.h),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
LocaleKeys.mada.tr(context: context).toText16(isBold: true).toShimmer2(isShow: todoVM.isProcessingPayment),
|
|
|
|
|
],
|
|
|
|
|
@ -468,86 +468,43 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
|
|
|
|
|
languageID: appState.isArabic() ? 1 : 2,
|
|
|
|
|
onSuccess: (response) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
|
|
|
|
|
final invoiceNo = response['AncillaryOrderInvoiceList']?[0]?['InvoiceNo'];
|
|
|
|
|
|
|
|
|
|
_showSuccessDialog(invoiceNo);
|
|
|
|
|
},
|
|
|
|
|
onError: (error) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
todoSectionViewModel.setProcessingPayment(false);
|
|
|
|
|
Utils.showToast(error);
|
|
|
|
|
showCommonBottomSheetWithoutHeight(context,
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: error.toString()), isCloseButtonVisible: true, isDismissible: true, isFullScreen: false, callBackFunc: () {});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _showSuccessDialog(dynamic invoiceNo) {
|
|
|
|
|
todoSectionViewModel.setProcessingPayment(false);
|
|
|
|
|
|
|
|
|
|
log("Ancillary order payment successful! Invoice #: $invoiceNo");
|
|
|
|
|
|
|
|
|
|
// Show success message and navigate
|
|
|
|
|
Utils.showToast("Payment successful! Invoice #: $invoiceNo");
|
|
|
|
|
// Utils.showToast("Payment successful! Invoice #: $invoiceNo");
|
|
|
|
|
// Navigate back to home after a short delay
|
|
|
|
|
Future.delayed(Duration(seconds: 1), () {
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.hereIsYourInvoiceNumber.tr(context: context).toText14(
|
|
|
|
|
color: AppColors.textColorLight,
|
|
|
|
|
weight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 4.w),
|
|
|
|
|
("12345").toText16(isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
height: 56.h,
|
|
|
|
|
text: LocaleKeys.ok.tr(context: context),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
page: LandingNavigation(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
borderColor: AppColors.secondaryLightRedColor,
|
|
|
|
|
textColor: AppColors.primaryRedColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// title: LocaleKeys.paymentCompletedSuccessfully.tr(context: context),
|
|
|
|
|
titleWidget: Utils.getSuccessWidget(loadingText: LocaleKeys.paymentCompletedSuccessfully.tr(context: context)),
|
|
|
|
|
isCloseButtonVisible: false,
|
|
|
|
|
isDismissible: false,
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
);
|
|
|
|
|
// Future.delayed(Duration(seconds: 1), () {
|
|
|
|
|
showCommonBottomSheetWithoutHeight(context,
|
|
|
|
|
child: Utils.getSuccessWidget(loadingText: "${LocaleKeys.paymentCompletedSuccessfully.tr(context: context)}, ${LocaleKeys.hereIsYourInvoiceNumber.tr(context: context)}$invoiceNo"),
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
isDismissible: true,
|
|
|
|
|
isFullScreen: false, callBackFunc: () {
|
|
|
|
|
// Pop until we reach the LandingPage
|
|
|
|
|
todoSectionViewModel.setIsAncillaryOrdersNeedReloading(true);
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
page: LandingNavigation(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
});
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_startApplePay() async {
|
|
|
|
|
showCommonBottomSheet(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getLoadingWidget(),
|
|
|
|
|
callBackFunc: (str) {},
|
|
|
|
|
title: "",
|
|
|
|
|
height: ResponsiveExtension.screenHeight * 0.3,
|
|
|
|
|
isCloseButtonVisible: false,
|
|
|
|
|
isDismissible: false,
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
);
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingApplePayDetails.tr(context: context));
|
|
|
|
|
final user = appState.getAuthenticatedUser();
|
|
|
|
|
transID = Utils.getAdvancePaymentTransID(widget.projectID, user!.patientId!);
|
|
|
|
|
|
|
|
|
|
@ -604,7 +561,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
|
|
|
|
|
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
log("Apple Pay Insert Request Failed: $error");
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: LocaleKeys.failedToInitializeApplePay.tr(context: context)),
|
|
|
|
|
@ -627,7 +584,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
|
|
|
|
|
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
|
|
|
|
|
onFailed: (failureResult) async {
|
|
|
|
|
log("failureResult: ${failureResult.message.toString()}");
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: failureResult.message.toString()),
|
|
|
|
|
@ -637,7 +594,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
onSucceeded: (successResult) async {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
log("successResult: ${successResult.responseMessage.toString()}");
|
|
|
|
|
selectedPaymentMethod = successResult.paymentOption ?? "VISA";
|
|
|
|
|
_checkPaymentStatus();
|
|
|
|
|
|