-
Notifications
You must be signed in to change notification settings - Fork 121
REST API: Check for Woo after authentication #8525
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3bf6772
Enable application password for fetching site plugin details
itsmeichigo 6845228
Check for woo plugin after authentication
itsmeichigo d8b8e64
Show alert when Woo check fails
itsmeichigo 1047167
Use default alert for site credential login failures
itsmeichigo cd1fb1c
Revert changes to FancyAlertViewController
itsmeichigo 3b201ca
Remove formatting for no Woo error
itsmeichigo 2295109
Remove alert title for site credential failure
itsmeichigo 736e59b
Move login checker to a new file
itsmeichigo deecb1c
Revert "Enable application password for fetching site plugin details"
itsmeichigo a141eec
Add woo check to settings remote and store
itsmeichigo 6c527d6
Check woo with site settings
itsmeichigo aec51ca
Simplify code with less guard let self
itsmeichigo 5939c7f
Refactor PostSiteCredentialLoginChecker for testability
itsmeichigo 81a4e03
Add tests for PostSiteCredentialLoginCheckerTests's application passw…
itsmeichigo 3754169
Add tests for role eligibility check
itsmeichigo 2697edd
Revert "Add woo check to settings remote and store"
itsmeichigo e2eebbd
Check for woo in WordPressSite
itsmeichigo eaf0b7a
Check for Woo by fetching WordPressSite
itsmeichigo e33605d
Remove redundant line
itsmeichigo 2499757
Add tests for woo check
itsmeichigo 1f78ccd
Add namespaces to the mock response for wordpress site
itsmeichigo c9a5fa3
Add more checks to WordPressSiteMapperTests
itsmeichigo 4d2afb8
Fix unit test failure for WordPressSiteStoreTests
itsmeichigo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@itsmeichigo I was just taking a look to compare how the implementation differs between the two platforms, and if I'm understanding things correctly, you are using the endpoint
/wp/v2/pluginsto check if Woo is installed here, I don't think this can work for all cases, users with the role "shop manager" can't use this endpoint.As detailed in the internal doc pe5sF9-U3-p2, there are two ways to check if Woo is installed for all the users. Currently, in Android we are re-using the same check as Jetpack CP sites (meaning
/wc/v3/settings), but if we decide to remove XMLRPC, we might try to move to use the root endpoint/wp-json/in order to reduce the number of requests we send.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.
Thanks for looking into my code @hichamboushaba! Could you clarify how we can use the root endpoint to check for Woo please? And how does it have anything to do with XMLRPC?
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 would be the same as we do for checking the Woo API version (here), the root endpoint returns an array of the available namespaces of APIs in the site, and if it contains
/wc/{something}, we can infer that the site has WooCommerce.Sorry for not being clear about this, this is specific to Android, currently the site data is being fetched using XMLRPC, so as long as we don't touch this, it made sense to me to reuse the same WooCommerce check that we use for Jetpack CP sites. But if we decide to remove XMLRPC, we will use the root endpoint to fetch site data, so in order to save one request, I would use this same request to infer if Woo is installed or not too, and stop using
/wc/v3/settings.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.
Thanks for the detailed explanation Hicham! I'll use the root endpoint to check too, for simplicity 🙇