|
|
|
|
@ -544,6 +544,9 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String _paymentMethod;
|
|
|
|
|
String _amount;
|
|
|
|
|
|
|
|
|
|
openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async {
|
|
|
|
|
widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
|
|
|
|
|
|
|
|
|
|
@ -567,6 +570,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
widget.patientShareResponse.clinicID,
|
|
|
|
|
widget.patientShareResponse.doctorID,
|
|
|
|
|
paymentMethod[1]);
|
|
|
|
|
_paymentMethod = paymentMethod.first;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -600,24 +604,33 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
|
|
|
|
|
String paymentInfo = res['Response_Message'];
|
|
|
|
|
if (paymentInfo == 'Success') {
|
|
|
|
|
createAdvancePayment(res, appo);
|
|
|
|
|
String txn_ref = res['Merchant_Reference'];
|
|
|
|
|
String amount = res['Amount'];
|
|
|
|
|
String amount = res['Amount'].toString();
|
|
|
|
|
String payment_method = res['PaymentMethod'];
|
|
|
|
|
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
|
|
|
|
|
projectViewModel.analytics.appointment.payment_success(
|
|
|
|
|
appointment_type: 'regular', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref);
|
|
|
|
|
createAdvancePayment(res, appo);
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: res['Response_Message']);
|
|
|
|
|
paymentFail("400", res['Response_Message']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
paymentFail("400", err.toString());
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
paymentFail(String errorCode, errorMessage){
|
|
|
|
|
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
|
|
|
|
|
projectViewModel.analytics.advancePayments.payment_fail(
|
|
|
|
|
appointment_type: 'livecare', payment_method: _paymentMethod, payment_type: 'appointment', clinic: widget.patientShareResponse.clinicName, hospital: "", txn_amount: widget.patientShareResponse.patientShareWithTax.toString(), txn_currency: currency, error_code: errorCode, error_message: errorMessage
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getApplePayAPQ(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
|