Apple Pay payfort response API Added

Main_App_Replacement^2
haroon amjad 1 week ago
parent 5d4031e02d
commit b68bf1d321

@ -209,8 +209,8 @@ class ApiClientImp implements ApiClient {
body['TokenID'] = "@dm!n";
}
body['TokenID'] = "@dm!n";
// body['PatientID'] = 7000792;
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 1009156;
// body['PatientID'] = 53320;
// body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0;

@ -578,4 +578,27 @@ class PayfortViewModel extends ChangeNotifier {
);
}
Future<void> addApplePayPayfortResponse(dynamic paymentMap) async {
PayfortResponseInsertModel payfortResponseInsertModel = PayfortResponseInsertModel();
payfortResponseInsertModel.fortId = paymentMap['fort_id'] ?? "";
payfortResponseInsertModel.commandType = paymentMap['command'] ?? "";
payfortResponseInsertModel.amount = num.tryParse(paymentMap['amount'] ?? "0") ?? 0;
payfortResponseInsertModel.sadadOLP = "";
payfortResponseInsertModel.paymentOption = paymentMap['payment_option'] ?? "";
payfortResponseInsertModel.customerIP = paymentMap['customer_ip'] ?? "";
payfortResponseInsertModel.eCI = paymentMap['eci'] ?? "";
payfortResponseInsertModel.responseMessage = paymentMap['response_message'] ?? "";
payfortResponseInsertModel.cardNumber = paymentMap['card_number'] ?? "";
payfortResponseInsertModel.cardBin = paymentMap['card_bin'] ?? "";
payfortResponseInsertModel.installmentsNumber = int.tryParse(paymentMap['installments_number'] ?? "0") ?? 0;
payfortResponseInsertModel.status = paymentMap['status'] ?? "";
payfortResponseInsertModel.merchantRef = paymentMap['merchant_reference'] ?? "";
payfortResponseInsertModel.isRefund = false;
payfortResponseInsertModel.remmeberMe = true;
payfortResponseInsertModel.reconciliationReference = "";
payfortResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);
}
}

@ -1283,6 +1283,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
onFailed: (failureResult) async {
log("failureResult: ${failureResult.message.toString()}");
payfortViewModel.addApplePayPayfortResponse(failureResult.response);
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
@ -1293,10 +1294,94 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
);
},
onSucceeded: (successResult) async {
payfortViewModel.addApplePayPayfortResponse(successResult);
LoaderBottomSheet.hideLoader();
log("successResult: ${successResult.responseMessage.toString()}");
selectedPaymentMethod = successResult.paymentOption ?? "VISA";
checkPaymentStatus();
// LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
// await myAppointmentsViewModel.createAdvancePayment(
// paymentMethodName: selectedPaymentMethod,
// projectID: widget.patientAppointmentHistoryResponseModel.projectID,
// clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
// appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
// payedAmount: num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
// paymentReference: successResult.fortId!,
// 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()
// : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
// paymentReference: successResult.fortId!,
// appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
// onSuccess: (value) async {
// if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) {
// //TODO: Implement LiveCare Check-In API Call
// await myAppointmentsViewModel.insertLiveCareVIDARequest(
// clientRequestID: transID,
// patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
// onSuccess: (apiResponse) {
// Future.delayed(Duration(milliseconds: 500), () {
// myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
// myAppointmentsViewModel.initAppointmentsViewModel();
// myAppointmentsViewModel.getPatientAppointments(true, false);
//
// getIt.get<HabibWalletViewModel>().setIsWalletAmountToBeLoaded(true);
// getIt.get<HabibWalletViewModel>().initHabibWalletProvider();
// getIt.get<HabibWalletViewModel>().getPatientBalanceAmount();
//
// LoaderBottomSheet.hideLoader();
// Navigator.pushAndRemoveUntil(
// context,
// CustomPageRoute(
// page: LandingNavigation(),
// ),
// (r) => false);
// });
// },
// onError: (error) {});
// } else {
// await myAppointmentsViewModel.generateAppointmentQR(
// clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
// projectID: widget.patientAppointmentHistoryResponseModel.projectID,
// appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
// isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!,
// onSuccess: (apiResponse) {
// Future.delayed(Duration(milliseconds: 500), () {
// myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
// myAppointmentsViewModel.initAppointmentsViewModel();
// myAppointmentsViewModel.getPatientAppointments(true, false);
//
// getIt.get<HabibWalletViewModel>().setIsWalletAmountToBeLoaded(true);
// getIt.get<HabibWalletViewModel>().initHabibWalletProvider();
// getIt.get<HabibWalletViewModel>().getPatientBalanceAmount();
//
// LoaderBottomSheet.hideLoader();
// Navigator.pushAndRemoveUntil(
// context,
// CustomPageRoute(
// page: LandingNavigation(),
// ),
// (r) => false);
// });
// });
// }
// });
// },
// onError: (err) {
// LoaderBottomSheet.hideLoader();
// showCommonBottomSheetWithoutHeight(
// context,
// child: Utils.getErrorWidget(loadingText: err.toString()),
// callBackFunc: () {},
// isFullScreen: false,
// isCloseButtonVisible: true,
// );
// });
},
// projectId: appo.projectID,
// serviceTypeEnum: ServiceTypeEnum.appointmentPayment,

@ -1077,6 +1077,7 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
onFailed: (failureResult) async {
log("failureResult: ${failureResult.message.toString()}");
payfortViewModel.addApplePayPayfortResponse(failureResult.response);
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
@ -1087,6 +1088,7 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
);
},
onSucceeded: (successResult) async {
payfortViewModel.addApplePayPayfortResponse(successResult);
LoaderBottomSheet.hideLoader();
log("successResult: ${successResult.responseMessage.toString()}");
selectedPaymentMethod = successResult.paymentOption ?? "VISA";

@ -904,6 +904,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
applePayShaRequestPhrase: payfortViewModel.payfortProjectDetailsRespModel!.shaRequest,
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
onFailed: (failureResult) async {
payfortViewModel.addApplePayPayfortResponse(failureResult.response);
log("failureResult: ${failureResult.message.toString()}");
Navigator.of(context).pop();
showCommonBottomSheetWithoutHeight(
@ -915,6 +916,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
);
},
onSucceeded: (successResult) async {
payfortViewModel.addApplePayPayfortResponse(successResult);
log("successResult: ${successResult.responseMessage.toString()}");
selectedPaymentMethod = successResult.paymentOption ?? "VISA";
checkPaymentStatus();

@ -668,6 +668,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
onFailed: (failureResult) async {
log("failureResult: ${failureResult.message.toString()}");
payfortViewModel.addApplePayPayfortResponse(failureResult.response);
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: failureResult.message.toString()),
@ -678,6 +679,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
},
onSucceeded: (successResult) async {
log("successResult: ${successResult.responseMessage.toString()}");
payfortViewModel.addApplePayPayfortResponse(successResult);
selectedPaymentMethod = successResult.paymentOption ?? "VISA";
checkPaymentStatus();
},

@ -280,7 +280,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
AppCustomChipWidget(
icon: AppAssets.blood_icon,
labelText: appState.getUserBloodGroup.isEmpty ? "N/A" : appState.getUserBloodGroup,
iconColor: AppColors.primaryRedColor,
iconColor: AppColors.primaryRedColorBase,
labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w),
padding: EdgeInsets.zero,
),

@ -819,6 +819,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
applePayShaRequestPhrase: payfortViewModel.payfortProjectDetailsRespModel!.shaRequest,
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
onFailed: (failureResult) async {
payfortViewModel.addApplePayPayfortResponse(failureResult.response);
log("failureResult: ${failureResult.message.toString()}");
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
@ -830,6 +831,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
);
},
onSucceeded: (successResult) async {
payfortViewModel.addApplePayPayfortResponse(successResult);
LoaderBottomSheet.hideLoader();
log("successResult: ${successResult.responseMessage.toString()}");
selectedPaymentMethod = successResult.paymentOption ?? "VISA";

@ -93,7 +93,7 @@ class _SplashScreenState extends State<SplashPage> {
if (isAppOpenedFromCall) {
navigateToTeleConsult();
} else {
if (Utils.havePrivilege(124)) {
if (!kDebugMode && Utils.havePrivilege(124)) {
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pushAndRemoveUntil(CustomPageRoute(page: AppClosedPage()), (r) => false);
} else {
if (await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) {

Loading…
Cancel
Save