-
Notifications
You must be signed in to change notification settings - Fork 118
[Woo POS] Receipts: enable feature flag with analytics #15674
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
Conversation
|
…` and `pos_receipt_email_failed` events. Track error for `pos_receipt_email_failed` event.
…ns` parameter in `VersionHelpers.isVersionSupported`.
5cc5102
to
66a3823
Compare
} | ||
} catch { | ||
throw POSReceiptServiceError.sendReceiptFailed | ||
throw POSReceiptServiceError.sendReceiptFailed(underlyingError: error as NSError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗒️ This allows better tracking of the underlying error in pos_receipt_email_failed
event, otherwise the error just showed Yosemite.POSReceiptService.POSReceiptServiceError.sendReceiptFailed
.
@jaclync what's the best way to test WC 10+? The WC Beta tester plugin only reaches to |
Apology for forgetting to link a test site, please check out the JN site linked in the comment in WOOPRD-535. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Store with WC version < 10.0.0
✅ Store with WC version >= 10.0.0
Works well! Tested on simulator iPad Pro M4 iOS 18.3 🚢
let isSupported = VersionHelpers.isVersionSupported(version: plugin.version, | ||
minimumRequired: minimumVersion) | ||
minimumRequired: minimumVersion, | ||
includesDevAndBetaVersions: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Just registered |
Fixes WOOPRD-536
Description
This pull request enabled the local POS receipts feature flag, and added analytics for tracking receipt sneding success and failure for non-POS and POS receipts.
Analytics Plan from WOOPRD-535
Feature Flag Updates:
Experiments/Experiments/DefaultFeatureFlagService.swift
: ThepointOfSaleReceipts
feature flag now always returnstrue
, enabling this feature across all build configurations.Error Handling Enhancements:
WooCommerce/Classes/POS/Controllers/PointOfSaleOrderController.swift
: Improved error handling in thesendReceipt
method by introducing a custom error (PointOfSaleOrderControllerError.noOrder
) and tracking analytics for success and failure scenarios with detailed properties.WooCommerce/Classes/POS/Models/PointOfSaleAggregateModel.swift
: Removed error tracking logic from thesendReceipt
method now that the tracking is inPointOfSaleOrderController
, centralizing analytics tracking within the controller logic.Analytics Tracking Testing:
WooCommerce/WooCommerceTests/POS/Controllers/PointOfSaleOrderControllerTests.swift
: Added tests to validate analytics tracking for receipt success and failure scenarios, including cases with and without eligibility for POS receipts.WooCommerce/WooCommerceTests/POS/Mocks/MockReceiptService.swift
: Updated theMockReceiptService
to simulate success or failure scenarios using thesendReceiptResult
property, enabling more robust testing of receipt handling logic.Steps to reproduce
Store with WC version < 10.0.0 (not eligible for POS receipts)
Prerequisite: the store is eligible for POS
Email receipt
pos_receipt_email_success
event should have a propertyeligible_for_pos_receipt: false
Email receipt
againpos_receipt_email_failed
event should not have a propertyeligible_for_pos_receipt: false
(because the order sync API request fails and returns early before eligibility check) and error propertiesStore with WC version >= 10.0.0 (eligible for POS receipts)
Prerequisite: the store is eligible for POS, and POS feature is enabled in WC Settings > Advanced > Features
Email receipt
pos_receipt_email_success
event should have a propertyeligible_for_pos_receipt: true
Email receipt
againpos_receipt_email_failed
event should not have a propertyeligible_for_pos_receipt: true
(because the order sync API request fails and returns early before eligibility check) and error propertiesOptional - Store with WC version >= 10.0.0 with eceipt sending error
Prerequisite: the store is eligible for POS, and POS feature is enabled in WC Settings > Advanced > Features. Receipt sending fails, this can be simulated by updating the template ID to an invalid one like
customer_pose_completed_order
Email receipt
pos_receipt_email_failed
event should have a propertyeligible_for_pos_receipt: true
with error properties likeerror_description: Yosemite.POSReceiptService.POSReceiptServiceError.sendReceiptFailed(underlyingError: Dotcom Error: [rest_invalid_param] Invalid parameter(s): template_id)
Testing information
I tested all cases above on iPad Pro 11in 3rd gen iOS 18.5.
RELEASE-NOTES.txt
if necessary.