Skip to content

Conversation

@samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Jan 15, 2025

Closes: #13302

Description

This PR modifies analytics tracking code to use a POS-specific prefix (woocommerce_android_pos) in case the payment flow (CardReaderPaymentController) is used from Point of Sale.

Implementation details

  • PaymentsFlowTracker.kt was refactored to obtain instances of AnalyticsEvent classes using PaymentsFlowTrackerEventProvider.kt interface.
  • The PaymentsFlowTrackerEventProvider.kt interface has two implementations: StoreManagementPaymentsFlowTrackerEventProvider and WooPosPaymentsFlowTrackerEventProvider. The first one provides IAnalyticsEvent with isPosEvent property set to false, while the second one provides events with isPosEvent property set to true.
  • A desired implementation of PaymentsFlowTrackerEventProvider is injected into the PaymentsFlowTracker tracker class at the compile time, using the newly introduced qualifier annotations: @PointOfSaleMode and @ StoreManagementMode.

Steps to reproduce

The goal is to verify that during card payment flow the events we track in IPP start with woocommerce_android_, and the ones in POS with woocommerce_android_pos prefix.

Note: tracking of payment cancel event from POS is implemented in the next PR: https://github.com/woocommerce/woocommerce-android/pull/13333/files

Testing information

  • Verify that card payment events in IPP are tracked without any change
  • Verify that card payment events in POS are tracked with a desired prefix

The tests that have been performed

I tested the card reader payment flow in POS and IPP modes and verified analytics events are tracked with proper prefixes, woocommerce_android_pos_ and woocommerce_android_ respectively.

Images/gif

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@dangermattic
Copy link
Collaborator

dangermattic commented Jan 15, 2025

4 Warnings
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ Class PaymentFlowTrackerEvent is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ Class WooPosPaymentsFlowTrackerEventProvider is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ This PR is assigned to the milestone 21.5. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 15, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitfe88724
Direct Downloadwoocommerce-wear-prototype-build-pr13323-fe88724.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 15, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitfe88724
Direct Downloadwoocommerce-prototype-build-pr13323-fe88724.apk

…ader-payment-flow-to-start-with-woocommerceandroid_pos-prefix
…-flow-to-start-with-woocommerceandroid_pos-prefix' into woo-pos-update-payment-canceled-analytics-event
@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 28.99023% with 218 lines in your changes missing coverage. Please review.

Project coverage is 41.10%. Comparing base (92347d4) to head (fe88724).
Report is 25 commits behind head on trunk.

Files with missing lines Patch % Lines
...d/ui/woopos/util/analytics/WooPosAnalyticsEvent.kt 0.00% 119 Missing ⚠️
...nalytics/WooPosPaymentsFlowTrackerEventProvider.kt 0.00% 60 Missing ⚠️
...ndroid/ui/payments/tracking/PaymentsFlowTracker.kt 67.18% 21 Missing ⚠️
...StoreManagementPaymentsFlowTrackerEventProvider.kt 70.00% 18 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #13323      +/-   ##
============================================
- Coverage     41.17%   41.10%   -0.08%     
- Complexity     6442     6484      +42     
============================================
  Files          1323     1325       +2     
  Lines         77259    77499     +240     
  Branches      10669    10669              
============================================
+ Hits          31813    31856      +43     
- Misses        42617    42814     +197     
  Partials       2829     2829              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@samiuelson samiuelson requested a review from kidinov January 17, 2025 14:35
@samiuelson samiuelson marked this pull request as ready for review January 17, 2025 14:35
@samiuelson samiuelson added this to the 21.5 milestone Jan 17, 2025
@kidinov kidinov self-assigned this Jan 21, 2025
Copy link
Contributor

@kidinov kidinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the idea! LGTM!

…ader-payment-flow-to-start-with-woocommerceandroid_pos-prefix
…-flow-to-start-with-woocommerceandroid_pos-prefix' into woo-pos-update-payment-canceled-analytics-event
…celed-analytics-event

[Woo POS] Track POS-specific analytics event in case of reader payment flow cancellation
…ader-payment-flow-to-start-with-woocommerceandroid_pos-prefix
@samiuelson samiuelson merged commit f9da72a into trunk Jan 22, 2025
15 checks passed
@samiuelson samiuelson deleted the 13302-woo-pos-update-analytics-events-in-reader-payment-flow-to-start-with-woocommerceandroid_pos-prefix branch January 22, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Woo POS] Update analytics events in reader payment flow to start with woocommerceandroid_pos prefix

6 participants