|
|
|
|
@ -397,25 +397,33 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
|
|
|
|
|
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
|
|
|
|
print("onBrowserExit Called!!!!");
|
|
|
|
|
if (isPaymentMade) checkPaymentStatus(appo);
|
|
|
|
|
// if (isPaymentMade)
|
|
|
|
|
checkPaymentStatus(appo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
String txn_ref;
|
|
|
|
|
String amount;
|
|
|
|
|
String payment_method;
|
|
|
|
|
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.checkPaymentStatus(transID, AppGlobal.context).then((res) {
|
|
|
|
|
String paymentInfo = res['Response_Message'];
|
|
|
|
|
if (paymentInfo == 'Success') {
|
|
|
|
|
String txn_ref = res['Merchant_Reference'];
|
|
|
|
|
String amount = res['Amount'];
|
|
|
|
|
String payment_method = res['PaymentMethod'];
|
|
|
|
|
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
|
|
|
|
|
txn_ref = res['Merchant_Reference'];
|
|
|
|
|
amount = res['Amount'].toString();
|
|
|
|
|
payment_method = res['PaymentMethod'];
|
|
|
|
|
createAdvancePayment(res, appo);
|
|
|
|
|
projectViewModel.analytics.advancePayments.payment_success(
|
|
|
|
|
payment_type: 'wallet', payment_method: payment_method, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref, hospital: widget.advanceModel.hospitalsModel.name);
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
|
|
|
|
|
AppToast.showErrorToast(message: res['Response_Message']);
|
|
|
|
|
amount = widget.advanceModel.amount;
|
|
|
|
|
payment_method = widget.selectedPaymentMethod;
|
|
|
|
|
projectViewModel.analytics.advancePayments.payment_fail(
|
|
|
|
|
payment_type: 'wallet', payment_method: payment_method, txn_amount: "$amount", txn_currency: currency, hospital: widget.advanceModel.hospitalsModel.name, error_type: res['Response_Message']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
|
|
|
|
|
|