Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Woo POS] Track POS-specific analytics events in reader payment flow #13323

Open
wants to merge 16 commits into
base: trunk
Choose a base branch
from

Conversation

samiuelson
Copy link
Collaborator

@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

3 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.

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
Commit97dbbf3
Direct Downloadwoocommerce-wear-prototype-build-pr13323-97dbbf3.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
Commit97dbbf3
Direct Downloadwoocommerce-prototype-build-pr13323-97dbbf3.apk

…ader-payment-flow-to-start-with-woocommerceandroid_pos-prefix
@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2025

Codecov Report

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

Project coverage is 41.01%. Comparing base (bbebf6c) to head (97dbbf3).
Report is 7 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.08%   41.01%   -0.07%     
- Complexity     6422     6464      +42     
============================================
  Files          1322     1324       +2     
  Lines         77249    77489     +240     
  Branches      10660    10660              
============================================
+ Hits          31740    31785      +45     
- Misses        42693    42888     +195     
  Partials       2816     2816              

☔ 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
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
4 participants