Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Nov 2, 2022

Closes: #7994

Description

With this PR, we'll be sending extra tags to ZenDesk that reflect the plugin status of woocommerce-gateway-stripe and woocommerce-payments plugins. There are 3 tags for each plugin:

  • _installed_and_activated
  • _installed_and_not_activated
  • _not_installed

Changes

In order to add these IPP statuses to ZenDesk tickets, we need to pass these tags through the SupportSDK's RequestUiConfiguration class when we create a new request. As we need to do this before ZenDesk tabs loads, we'll be using a StorageSitePlugin results controller directly through the ZendeskManager class, in order to fetch plugin statuses and pass these as tags.

Testing instructions

The easiest way is through the debugger:

  1. Confirm that you have WooCommerce Payments, and/or WooCommerce Stripe Gateway installed and/or activated
  2. Add a breakpoint to requestConfig.tags to confirm which tags are we sending to ZenDesk.
  3. Go to Menu > Settings > Help and Support > Tap on "Contact Support"
  4. In Xcode's debugger, see the tags:
tags	[String]	7 values	
[0]	String	"iOS"	
[1]	String	"woo-mobile-sdk"	
[2]	String	"jetpack"	
[3]	String	"woo_mobile_stripe_not_installed"	
[4]	String	"woo_mobile_wcpay_not_installed"	
[5]	String	"wpcom"	
[6]	String	"eCommerce"	

It can also be tested directly in ZenDesk, which requires extra steps:

  1. Confirm that you have WooCommerce Payments, and/or WooCommerce Stripe Gateway installed and/or activated
  2. Go to Menu > Settings > Help and Support > Confirm that you're logged into the app with a non-a8c account > Tap on "Contact Support" and send a request (You may need to test this on a physical device, not the simulator)
  3. Log into ZenDesk, find your ticket, and confirm that the tags have been added and reflect the plugin status. If you have no ZD account, feel free to ping me on Slack with the non-a8c-email used (or any HE :D), in order to find the ticket.

Screenshot 2022-11-07 at 12 30 43


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@iamgabrielma iamgabrielma added type: enhancement A request for an enhancement. feature: support Related to anything in the help & support section, including app logs and the Zendesk SDK. labels Nov 2, 2022
@iamgabrielma iamgabrielma added this to the 11.1 milestone Nov 2, 2022
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 2, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8008-d341fc5 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@iamgabrielma iamgabrielma added the status: draft This is a draft, still need more work but can be reviewed and commented if asked. label Nov 3, 2022
@iamgabrielma iamgabrielma modified the milestones: 11.1, 11.2 Nov 3, 2022
@iamgabrielma iamgabrielma marked this pull request as ready for review November 3, 2022 09:43
@iamgabrielma iamgabrielma removed the status: draft This is a draft, still need more work but can be reviewed and commented if asked. label Nov 7, 2022
@iamgabrielma iamgabrielma requested a review from Ecarrion November 7, 2022 10:10
@Ecarrion Ecarrion removed their request for review November 8, 2022 14:18
We’re moving the logic to retrieve IPP plugin statuses directly to ZenDesk, as if a merchant attempts to open a ticket without passing through the SettingsView, we wouldn’t have these available.
@itsmeichigo itsmeichigo self-assigned this Nov 9, 2022
Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

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

I've tested the PR following the first method (adding a breakpoint to tags). I tried switching between different stores with different statuses for Stripe and WCPay. It looks like the tags are not correctly reflecting the plugin statuses when switching stores.

Maybe we should synchronize plugins at some point to have the correct data in storage?

As ZendeskManager is initialized only once, moving the ResultsController outside of the init allows for the siteID to be recalculated when we switch stores.
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@iamgabrielma
Copy link
Contributor Author

I've tested the PR following the first method (adding a breakpoint to tags). I tried switching between different stores with different statuses for Stripe and WCPay. It looks like the tags are not correctly reflecting the plugin statuses when switching stores. Maybe we should synchronize plugins at some point to have the correct data in storage?

Thanks for your review and help with this, this was definitely tricky. Fixed on e88a7a3 . As we thought, we need to also call pluginResultsController.performFetch() in the initializer, otherwise will not work the first time we run it (only on store switcheroo).

Ready for review! 🙇

Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

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

This works perfectly now 💯 I left a few more nits, please feel free to merge after updating them.

///
private lazy var pluginResultsController: ResultsController<StorageSitePlugin> = updatePluginResultsController()

private func updatePluginResultsController() -> ResultsController<StorageSitePlugin> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Super nit:

Suggested change
private func updatePluginResultsController() -> ResultsController<StorageSitePlugin> {
/// Returns a `pluginResultsController` using the latest selected site ID for predicate.
private func createPluginResultsController() -> ResultsController<StorageSitePlugin> {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see! create makes more sense than update as we're not really updating it but creating a new one on each call. Changed on 9984996

@iamgabrielma iamgabrielma merged commit bc568ef into trunk Nov 10, 2022
@iamgabrielma iamgabrielma deleted the issue/7994-add-zd-ipp-statuses branch November 10, 2022 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: support Related to anything in the help & support section, including app logs and the Zendesk SDK. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tag to ZenDesk with IPP plugins statuses

4 participants