From 88b904a4b8abb846f586cb0c53e929b19620e104 Mon Sep 17 00:00:00 2001 From: Zohaib Iqbal Kambrani <> Date: Thu, 9 Jun 2022 18:13:37 +0300 Subject: [PATCH] analytics changes --- lib/analytics/flows/advance_payments.dart | 16 ------------- lib/analytics/flows/appointments.dart | 19 +++++++-------- lib/analytics/google-analytics.dart | 2 +- lib/pages/BookAppointment/BookSuccess.dart | 17 ++----------- lib/pages/livecare/widgets/clinic_list.dart | 20 +--------------- .../medical/balance/confirm_payment_page.dart | 24 +------------------ lib/widgets/in_app_browser/InAppBrowser.dart | 8 +++---- 7 files changed, 17 insertions(+), 89 deletions(-) diff --git a/lib/analytics/flows/advance_payments.dart b/lib/analytics/flows/advance_payments.dart index 6bd43a08..db52eb59 100644 --- a/lib/analytics/flows/advance_payments.dart +++ b/lib/analytics/flows/advance_payments.dart @@ -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, - }); - } } \ No newline at end of file diff --git a/lib/analytics/flows/appointments.dart b/lib/analytics/flows/appointments.dart index 0e911d75..50a02c76 100644 --- a/lib/analytics/flows/appointments.dart +++ b/lib/analytics/flows/appointments.dart @@ -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 } diff --git a/lib/analytics/google-analytics.dart b/lib/analytics/google-analytics.dart index a8252051..081bd29e 100644 --- a/lib/analytics/google-analytics.dart +++ b/lib/analytics/google-analytics.dart @@ -27,7 +27,7 @@ typedef GALogger = Function(String name, {Map parameters}); var _analytics = FirebaseAnalytics(); _logger(String name, {Map parameters}) async { - // return; + return; if (name != null && name.isNotEmpty) { if (name.contains(' ')) name = name.replaceAll(' ', '_'); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index e16c618f..693f98e9 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -544,9 +544,6 @@ class _BookSuccessState extends State { }); } - String _paymentMethod; - String _amount; - openPayment(List 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 { widget.patientShareResponse.clinicID, widget.patientShareResponse.doctorID, paymentMethod[1]); - _paymentMethod = paymentMethod.first; // } } @@ -604,33 +600,24 @@ class _BookSuccessState extends State { 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(); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 74d25f5a..1b2b4384 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -296,11 +296,7 @@ class _clinic_listState extends State { }); } - String _paymentMethod; - String _amount; openPayment(List 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 { 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); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 12bcc439..fcb893a2 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -407,39 +407,17 @@ class _ConfirmPaymentPageState extends State { 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(); diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index a21028f8..b258a7ff 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -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=';