analytics changes

merge-requests/599/head
Zohaib Iqbal Kambrani 3 years ago
parent fb4fb8d29e
commit 88b904a4b8

@ -79,20 +79,4 @@ class AdvancePayments{
'transaction_currency' : txn_currency
});
}
// New
payment_fail({@required String appointment_type, clinic, hospital, payment_method, payment_type, txn_amount, txn_currency, error_code, error_message}){
logger('payment_fail', parameters: {
'appointment_type' : appointment_type,
'clinic_type_online' : clinic,
'payment_method' : payment_method,
'payment_type' : payment_type,
'hospital_name' : hospital,
'transaction_number' : "",
'transaction_amount' : txn_amount,
'transaction_currency' : txn_currency,
"error_code" : error_code,
"error_message" : error_message,
});
}
}

@ -232,17 +232,14 @@ class Appointment{
// R036
payment_success({@required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){
logger('payment_success', parameters: {
'appointment_type' : appointment_type,
'clinic_type_online' : clinic,
'payment_method' : payment_method,
'payment_type' : payment_type,
'hospital_name' : hospital,
'transaction_number' : txn_number,
'transaction_amount' : txn_amount,
'transaction_currency' : txn_currency,
});
// appointment_type
// clinic_type_online
// payment_method
// payment_type: 'appointment'
// hospital_name
// transaction_number
// transaction_amount
// transaction_currency
}

@ -27,7 +27,7 @@ typedef GALogger = Function(String name, {Map<String, dynamic> parameters});
var _analytics = FirebaseAnalytics();
_logger(String name, {Map<String, dynamic> parameters}) async {
// return;
return;
if (name != null && name.isNotEmpty) {
if (name.contains(' ')) name = name.replaceAll(' ', '_');

@ -544,9 +544,6 @@ 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);
@ -570,7 +567,6 @@ class _BookSuccessState extends State<BookSuccess> {
widget.patientShareResponse.clinicID,
widget.patientShareResponse.doctorID,
paymentMethod[1]);
_paymentMethod = paymentMethod.first;
// }
}
@ -604,33 +600,24 @@ 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'].toString();
String amount = res['Amount'];
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();

@ -296,11 +296,7 @@ class _clinic_listState extends State<ClinicList> {
});
}
String _paymentMethod;
String _amount;
openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) {
_paymentMethod = paymentMethod.first;
_amount = amount.toString();
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod[0],
@ -341,30 +337,16 @@ class _clinic_listState extends State<ClinicList> {
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {
addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo));
String txn_ref = res['Merchant_Reference'];
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: 'livecare', payment_method: payment_method, clinic: selectedClinicName, hospital: "", payment_type: 'appointment', txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref);
} else {
AppToast.showErrorToast(message: res['Response_Message']);
paymentFail("400", res['Response_Message'], _amount);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
paymentFail("400", err.toString(),_amount);
print(err);
});
}
paymentFail(String errorCode, errorMessage, String amount,){
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
projectViewModel.analytics.advancePayments.payment_fail(
appointment_type: 'livecare', payment_method: _paymentMethod, payment_type: 'appointment', clinic: selectedClinicName, hospital: "", txn_amount: "$amount", txn_currency: currency, error_code: errorCode, error_message: errorMessage
);
}
addNewCallForPatientER(String clientRequestID) {
LiveCareService service = new LiveCareService();
GifLoaderDialogUtils.showMyDialog(context);

@ -407,39 +407,17 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {
createAdvancePayment(res, appo);
String txn_ref = res['Merchant_Reference'];
String amount = res['Amount'].toString();
String payment_method = res['PaymentMethod'];
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
final hospital = widget.advanceModel.hospitalsModel.name;
projectViewModel.analytics.advancePayments.payment_success(
appointment_type: '', payment_method: payment_method, payment_type: 'wallet', clinic: '', hospital: hospital, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref
);
} else {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
AppToast.showErrorToast(message: res['Response_Message']);
paymentFail("400", paymentInfo);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
AppToast.showErrorToast(message: err);
paymentFail("400", err.toString());
print(err);
});
}
paymentFail(String errorCode, errorMessage){
final hospital = widget.advanceModel.hospitalsModel.name;
final amount = widget.advanceModel.amount;
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
projectViewModel.analytics.advancePayments.payment_fail(
appointment_type: '', payment_method: widget.selectedPaymentMethod, payment_type: 'wallet', clinic: '', hospital: hospital, txn_amount: "$amount", txn_currency: currency, error_code: errorCode, error_message: errorMessage
);
}
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
String paymentReference = res['Fort_id'].toString();

@ -33,13 +33,13 @@ class MyInAppBrowser extends InAppBrowser {
// static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE
static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWeb/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT
static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
// static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
// static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
// static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
// 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';

Loading…
Cancel
Save