Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Coupons/fetch reports #3012

Merged
merged 10 commits into from
May 21, 2024
Merged

Coupons/fetch reports #3012

merged 10 commits into from
May 21, 2024

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented May 15, 2024

⚠️ This has a breaking change, please don't merge, I'll handle merging when all PRs are ready.

Closes woocommerce/woocommerce-android#11518

This PR adds the networking implementation needed for the coupons card in the dynamic dashboard.

Testing

  1. Open the example app.
  2. Click on Woo then on Coupons.
  3. Select a site.
  4. Click on "Fetch the most active coupons"
  5. Confirm the 3 most active coupons in the last month are printed to the console.

Also check woocommerce/woocommerce-android#11531 for testing the other changes.

PLUGIN_NOT_ACTIVE,
API_NOT_FOUND,
Copy link
Member Author

Choose a reason for hiding this comment

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

I was the one who introduced PLUGIN_NOT_ACTIVE during the REST API project, it was to match the value emitted by the Order REST client, but I think that name was not the right choice, the error could happen for any non-existing endpoint, be it because the plugin is not active, or any other reason, so I renamed it to make it more clear, please let me know what you think?

And this is a breaking change for WCAndroid, so let's not merge this until the WCAndroid PR is ready.


NOT_FOUND -> {
when (apiError) {
"rest_no_route" -> WooErrorType.API_NOT_FOUND
Copy link
Member Author

Choose a reason for hiding this comment

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

We need this specific differentiation now, the new error type will help identify when the wc-analytics endpoint is not available.

@hichamboushaba hichamboushaba force-pushed the coupons/fetch-reports branch from 2847b97 to 52cd84a Compare May 17, 2024 11:54
@0nko 0nko self-assigned this May 20, 2024
Copy link
Contributor

@0nko 0nko left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@hichamboushaba hichamboushaba merged commit 09a0d45 into trunk May 21, 2024
14 checks passed
@hichamboushaba hichamboushaba deleted the coupons/fetch-reports branch May 21, 2024 11:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dynamic Dashboard] Integrate the coupons report endpoint for Top 3 coupons card
2 participants