|
|
|
@ -98,7 +98,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
|
|
|
|
).paddingSymmetrical(16.h, 16.h),
|
|
|
|
).paddingSymmetrical(16.h, 16.h),
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
selectedPaymentMethod = "MADA";
|
|
|
|
selectedPaymentMethod = "MADA";
|
|
|
|
// openPaymentURL("mada");
|
|
|
|
openPaymentURL("mada");
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
@ -137,7 +137,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
|
|
|
|
).paddingSymmetrical(16.h, 16.h),
|
|
|
|
).paddingSymmetrical(16.h, 16.h),
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
selectedPaymentMethod = "VISA";
|
|
|
|
selectedPaymentMethod = "VISA";
|
|
|
|
// openPaymentURL("visa");
|
|
|
|
openPaymentURL("visa");
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -188,7 +188,9 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
|
|
|
if (Utils.havePrivilege(103)) {
|
|
|
|
if (Utils.havePrivilege(103)) {
|
|
|
|
startApplePay();
|
|
|
|
startApplePay();
|
|
|
|
} else {}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
openPaymentURL("applepay");
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
: SizedBox(height: 12.h),
|
|
|
|
: SizedBox(height: 12.h),
|
|
|
|
SizedBox(height: 32.h),
|
|
|
|
SizedBox(height: 32.h),
|
|
|
|
@ -285,101 +287,137 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
|
|
|
|
void checkPaymentStatus() async {
|
|
|
|
void checkPaymentStatus() async {
|
|
|
|
LoaderBottomSheet.showLoader();
|
|
|
|
LoaderBottomSheet.showLoader();
|
|
|
|
await payfortViewModel.checkPaymentStatus(
|
|
|
|
await payfortViewModel.checkPaymentStatus(
|
|
|
|
transactionID: transID,
|
|
|
|
transactionID: transID,
|
|
|
|
onSuccess: (apiResponse) async {
|
|
|
|
onSuccess: (apiResponse) async {
|
|
|
|
print(apiResponse.data);
|
|
|
|
print(apiResponse.data);
|
|
|
|
if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") {
|
|
|
|
if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") {
|
|
|
|
await habibWalletVM.HISCreateAdvancePayment(
|
|
|
|
await habibWalletVM.HISCreateAdvancePayment(
|
|
|
|
paymentMethodName: selectedPaymentMethod,
|
|
|
|
paymentMethodName: selectedPaymentMethod,
|
|
|
|
paidAmount: habibWalletVM.walletRechargeAmount,
|
|
|
|
paidAmount: habibWalletVM.walletRechargeAmount,
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
patientID: habibWalletVM.fileNumber,
|
|
|
|
patientID: habibWalletVM.fileNumber,
|
|
|
|
projectID: habibWalletVM.selectedHospital!.iD!,
|
|
|
|
projectID: habibWalletVM.selectedHospital!.iD!,
|
|
|
|
depositorName: habibWalletVM.depositorName,
|
|
|
|
depositorName: habibWalletVM.depositorName,
|
|
|
|
onSuccess: (value) async {
|
|
|
|
onSuccess: (value) async {
|
|
|
|
await habibWalletVM.addAdvanceNumberRequest(
|
|
|
|
await habibWalletVM.addAdvanceNumberRequest(
|
|
|
|
advanceNumber: Utils.isVidaPlusProject(habibWalletVM.selectedHospital!.iD)
|
|
|
|
advanceNumber: Utils.isVidaPlusProject(habibWalletVM.selectedHospital!.iD)
|
|
|
|
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
|
|
|
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
|
|
|
: value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
: value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
onSuccess: (value) {
|
|
|
|
onSuccess: (value) {
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
child: Utils.getSuccessWidget(loadingText: "Payment Successful!".needTranslation),
|
|
|
|
child: Utils.getSuccessWidget(loadingText: "Payment Successful!".needTranslation),
|
|
|
|
callBackFunc: () {
|
|
|
|
callBackFunc: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
isFullScreen: false,
|
|
|
|
isFullScreen: false,
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onError: (err) {
|
|
|
|
onError: (err) {
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
child: Utils.getErrorWidget(loadingText: "Payment Failed - ${err}".needTranslation),
|
|
|
|
child: Utils.getErrorWidget(loadingText: "Payment Failed - ${err}".needTranslation),
|
|
|
|
callBackFunc: () {},
|
|
|
|
callBackFunc: () {},
|
|
|
|
isFullScreen: false,
|
|
|
|
isFullScreen: false,
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onError: (err) {});
|
|
|
|
onError: (err) {});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation),
|
|
|
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onBrowserLoadStart(String url) {
|
|
|
|
|
|
|
|
print("onBrowserLoadStart");
|
|
|
|
|
|
|
|
print(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedPaymentMethod == "tamara") {
|
|
|
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
|
|
|
Uri uri = new Uri.dataFromString(url);
|
|
|
|
|
|
|
|
// tamaraPaymentStatus = uri.queryParameters['status']!;
|
|
|
|
|
|
|
|
// tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Uri uri = new Uri.dataFromString(url);
|
|
|
|
|
|
|
|
// tamaraPaymentStatus = uri.queryParameters['paymentStatus']!;
|
|
|
|
|
|
|
|
// tamaraOrderID = uri.queryParameters['orderId']!;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(selectedPaymentMethod != "TAMARA") {
|
|
|
|
|
|
|
|
MyInAppBrowser.successURLS.forEach((element) {
|
|
|
|
|
|
|
|
if (url.contains(element)) {
|
|
|
|
|
|
|
|
browser?.close();
|
|
|
|
|
|
|
|
MyInAppBrowser.isPaymentDone = true;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(selectedPaymentMethod != "TAMARA") {
|
|
|
|
|
|
|
|
MyInAppBrowser.errorURLS.forEach((element) {
|
|
|
|
|
|
|
|
if (url.contains(element)) {
|
|
|
|
|
|
|
|
browser?.close();
|
|
|
|
|
|
|
|
MyInAppBrowser.isPaymentDone = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onBrowserExit(bool isPaymentMade) async {
|
|
|
|
|
|
|
|
print("onBrowserExit Called!!!!");
|
|
|
|
|
|
|
|
if (selectedPaymentMethod == "TAMARA") {
|
|
|
|
|
|
|
|
// checkTamaraPaymentStatus(transID!, appo);
|
|
|
|
|
|
|
|
// if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") {
|
|
|
|
|
|
|
|
// updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// updateTamaraRequestStatus("Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
checkPaymentStatus();
|
|
|
|
|
|
|
|
// checkPaymentStatus(appo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openPaymentURL(String paymentMethod) {
|
|
|
|
|
|
|
|
browser = MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart, context: context);
|
|
|
|
|
|
|
|
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
|
|
|
|
|
|
|
|
|
|
|
|
// await myAppointmentsViewModel.createAdvancePayment(
|
|
|
|
browser?.openPaymentBrowser(
|
|
|
|
// paymentMethodName: selectedPaymentMethod,
|
|
|
|
habibWalletVM.walletRechargeAmount,
|
|
|
|
// projectID: widget.patientAppointmentHistoryResponseModel.projectID,
|
|
|
|
"Advance Payment",
|
|
|
|
// clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
|
|
|
|
transID,
|
|
|
|
// appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
|
|
|
|
habibWalletVM.selectedHospital!.iD!.toString(),
|
|
|
|
// payedAmount: payfortViewModel.payfortCheckPaymentStatusResponseModel!.amount!,
|
|
|
|
"CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com",
|
|
|
|
// paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
selectedPaymentMethod,
|
|
|
|
// patientID: "4767477",
|
|
|
|
appState.getAuthenticatedUser()!.patientType.toString(),
|
|
|
|
// patientType: 1,
|
|
|
|
"${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}",
|
|
|
|
// onSuccess: (value) async {
|
|
|
|
appState.getAuthenticatedUser()!.patientId.toString(),
|
|
|
|
// print(value);
|
|
|
|
appState.getAuthenticatedUser()!,
|
|
|
|
// await myAppointmentsViewModel.addAdvanceNumberRequest(
|
|
|
|
browser!,
|
|
|
|
// advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
|
|
|
|
false,
|
|
|
|
// ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
|
|
|
"3",
|
|
|
|
// : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
"0",
|
|
|
|
// paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!,
|
|
|
|
context,
|
|
|
|
// appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
|
|
|
|
"",
|
|
|
|
// onSuccess: (value) async {
|
|
|
|
"",
|
|
|
|
// if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) {
|
|
|
|
"",
|
|
|
|
// //TODO: Implement LiveCare Check-In API Call
|
|
|
|
"",
|
|
|
|
// } else {
|
|
|
|
"3");
|
|
|
|
// 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), () {
|
|
|
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
|
|
|
// Navigator.pushAndRemoveUntil(
|
|
|
|
|
|
|
|
// context,
|
|
|
|
|
|
|
|
// CustomPageRoute(
|
|
|
|
|
|
|
|
// page: LandingNavigation(),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// (r) => false);
|
|
|
|
|
|
|
|
// Navigator.of(context).push(
|
|
|
|
|
|
|
|
// CustomPageRoute(page: MyAppointmentsPage()),
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation),
|
|
|
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|