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

Implements /v0/me/capabilities, upholdInsufficientCapabilitiesModal. #13474

Merged
merged 1 commit into from
May 26, 2022

Conversation

szilardszaloki
Copy link
Collaborator

@szilardszaloki szilardszaloki commented May 25, 2022

Resolves brave/brave-browser#22508.

Implements /v0/me/capabilities and upholdInsufficientCapabilitiesModal:
upholdInsufficientCapabilitiesModal

Removes:

  • Uphold user status inspection
  • explicit CDD check
  • upholdBlockedUserModal, upholdPendingUserModal, upholdRestrictedUserModal, upholdCustomerDueDiligenceRequiredModal

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

The Test Plan of #11857 can be applied here. Make sure to edit the response of /v0/me/capabilities with Charles Proxy so that either receives or sends is set to false.

@szilardszaloki szilardszaloki requested a review from a team as a code owner May 25, 2022 21:35
@szilardszaloki szilardszaloki self-assigned this May 25, 2022
@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label May 25, 2022
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@szilardszaloki szilardszaloki force-pushed the sszaloki-22508-capabilities-endpoint branch from 4eba72e to a90d22f Compare May 26, 2022 03:37
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Removes:
- Uphold user status inspection
- explicit CDD check
- `upholdBlockedUserModal`, `upholdPendingUserModal`, `upholdRestrictedUserModal`, `upholdCustomerDueDiligenceRequiredModal`
@szilardszaloki szilardszaloki force-pushed the sszaloki-22508-capabilities-endpoint branch from a90d22f to c58bd92 Compare May 26, 2022 12:53
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

LGTM

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@szilardszaloki szilardszaloki added this to the 1.41.x - Nightly milestone May 26, 2022
@szilardszaloki szilardszaloki merged commit 7687ffe into master May 26, 2022
@szilardszaloki szilardszaloki deleted the sszaloki-22508-capabilities-endpoint branch May 26, 2022 16:21
bsclifton pushed a commit that referenced this pull request May 27, 2022
…oint

Implements `/v0/me/capabilities`, `upholdInsufficientCapabilitiesModal`.
bsclifton pushed a commit that referenced this pull request May 27, 2022
…oint

Implements `/v0/me/capabilities`, `upholdInsufficientCapabilitiesModal`.
@LaurenWags
Copy link
Member

LaurenWags commented Jun 1, 2022

Verified with

Brave | 1.41.30 Chromium: 102.0.5005.78 (Official Build) nightly (x86_64)
-- | --
Revision | df6dbb5a9fd82af3f567198af2eb5fb4876ef99c-refs/branch-heads/5005_59@{#3}
OS | macOS Version 12.4 (Build 21F79)

Verified test plan from #13474 (comment) for the following:

Case 1: Clean profile, "sends" capability is false - PASSED
  1. Set up rewrite rule in Charles Proxy so that the "sends" part of the response to https://api-sandbox.uphold.com/v0/me/capabilities has enabled = false like below (note, this is not the entire response, just the snippet we need to modify, your rewrite rule needs the entire response)
	"category": "permissions",
	"enabled": false,
	"key": "sends",
	"name": "Sends",
	"requirements": [],
	"restrictions": []
  1. Using clean profile, launch 1.41.x w/ staging env and Charles running w/ the rewrite rule in place.
  2. Enable Rewards
  3. Login using Uphold account
  4. Confirm rewrite rule is used using Charles
  5. Confirm you see the below in your logs
[11842:259:0601/144220.033667:INFO:uphold_wallet.cc(153)] User doesn't have the required Uphold capabilities!
  1. Confirm the expected modal shows on the brave://rewards page
1
Case 2: Upgrade profile, "sends" capability is false, brave://rewards page is open and active after upgrade - PASSED
  1. Set up rewrite rule in Charles Proxy so that the "sends" part of the response to https://api-sandbox.uphold.com/v0/me/capabilities has enabled = false like below (note, this is not the entire response, just the snippet we need to modify, your rewrite rule needs the entire response)
	"category": "permissions",
	"enabled": false,
	"key": "sends",
	"name": "Sends",
	"requirements": [],
	"restrictions": []
  1. Using clean profile, launch 1.39.x w/ staging env and Charles running w/ the rewrite rule in place.
  2. Enable Rewards
  3. Login using Uphold account, confirm account is linked as expected (you see balance, etc) - note, this is expected as 1.39.x does not use the "capabilities" endpoint
  4. Keep brave://rewards page as the open/active tab. Close 1.39.x
  5. Rename profile to "Brave-Browser-Nightly"
  6. Launch 1.41.x w/ staging
  7. Confirm rewrite rule is used using Charles
  8. Confirm you see the below in your logs
[12496:259:0601/145424.637891:INFO:uphold_wallet.cc(153)] User doesn't have the required Uphold capabilities!
  1. Confirm the expected modal shows on the brave://rewards page
  2. Confirm after you close the modal you are logged out of Uphold in UI and your balance is not displayed.
1.39.x 1.41.x 1.41.x
1 39 x 2 2-b
  1. Confirm the "Logged out" notification is displayed on the BAT logo:
2-logged out
Case 3: Upgrade profile, "sends" capability is false, brave://rewards page is not open after upgrade - PASSED
  1. Set up rewrite rule in Charles Proxy so that the "sends" part of the response to https://api-sandbox.uphold.com/v0/me/capabilities has enabled = false like below (note, this is not the entire response, just the snippet we need to modify, your rewrite rule needs the entire response)
	"category": "permissions",
	"enabled": false,
	"key": "sends",
	"name": "Sends",
	"requirements": [],
	"restrictions": []
  1. Using clean profile, launch 1.39.x w/ staging env and Charles running w/ the rewrite rule in place.
  2. Enable Rewards
  3. Login using Uphold account, confirm account is linked as expected (you see balance, etc) - note, this is expected as 1.39.x does not use the "capabilities" endpoint
  4. Close any brave://rewards page and have some other tab as the open/active tab. Close 1.39.x.
  5. Rename profile to "Brave-Browser-Nightly"
  6. Launch 1.41.x w/ staging
  7. Open panel
  8. Confirm rewrite rule is used using Charles
  9. Confirm you see the below in your logs
[12775:259:0601/151459.952294:INFO:uphold_wallet.cc(153)] User doesn't have the required Uphold capabilities!
  1. Confirm the panel shows you are logged out of Uphold notification in UI and your balance is not displayed.
1.39.x 1.41.x 1.41.x
1 39 111 3 3-b
Case 4: Clean profile, "receives" capability is false - PASSED
  1. Set up rewrite rule in Charles Proxy so that the "receives" part of the response to https://api-sandbox.uphold.com/v0/me/capabilities has enabled = false like below (note, this is not the entire response, just the snippet we need to modify, your rewrite rule needs the entire response)
	"category": "permissions",
	"enabled": false,
	"key": "receives",
	"name": "Receives",
	"requirements": [],
	"restrictions": []
  1. Using clean profile, launch 1.41.x w/ staging env and Charles running w/ the rewrite rule in place.
  2. Enable Rewards
  3. Login using Uphold account
  4. Confirm rewrite rule is used using Charles
  5. Confirm you see the below in your logs
[12897:259:0601/152151.537735:INFO:uphold_wallet.cc(153)] User doesn't have the required Uphold capabilities!
  1. Confirm the expected modal shows on the brave://rewards page
4
Case 5: Upgrade profile, "receives" capability is false, brave://rewards page is open and active after upgrade - PASSED
  1. Set up rewrite rule in Charles Proxy so that the "receives" part of the response to https://api-sandbox.uphold.com/v0/me/capabilities has enabled = false like below (note, this is not the entire response, just the snippet we need to modify, your rewrite rule needs the entire response)
	"category": "permissions",
	"enabled": false,
	"key": "receives",
	"name": "Receives",
	"requirements": [],
	"restrictions": []
  1. Using clean profile, launch 1.39.x w/ staging env and Charles running w/ the rewrite rule in place.
  2. Enable Rewards
  3. Login using Uphold account, confirm account is linked as expected (you see balance, etc) - note, this is expected as 1.39.x does not use the "capabilities" endpoint
  4. Keep brave://rewards page as the open/active tab. Close 1.39.x
  5. Rename profile to "Brave-Browser-Nightly"
  6. Launch 1.41.x w/ staging
  7. Confirm rewrite rule is used using Charles
  8. Confirm you see the below in your logs
[13276:259:0601/153020.922087:INFO:uphold_wallet.cc(153)] User doesn't have the required Uphold capabilities!
  1. Confirm the expected modal shows on the brave://rewards page
  2. Confirm after you close the modal you are logged out of Uphold in UI and your balance is not displayed.
1.39.x 1.41.x 1.41.x
1 39 x 5 5-b
  1. Confirm the "Logged out" notification is displayed on the BAT logo:
5-logged out
Case 6: Upgrade profile, "receives" capability is false, brave://rewards page is not open after upgrade - PASSED
  1. Set up rewrite rule in Charles Proxy so that the "receives " part of the response to https://api-sandbox.uphold.com/v0/me/capabilities has enabled = false like below (note, this is not the entire response, just the snippet we need to modify, your rewrite rule needs the entire response)
	"category": "permissions",
	"enabled": false,
	"key": "receives",
	"name": "Receives",
	"requirements": [],
	"restrictions": []
  1. Using clean profile, launch 1.39.x w/ staging env and Charles running w/ the rewrite rule in place.
  2. Enable Rewards
  3. Login using Uphold account, confirm account is linked as expected (you see balance, etc) - note, this is expected as 1.39.x does not use the "capabilities" endpoint
  4. Close any brave://rewards page and have some other tab as the open/active tab. Close 1.39.x.
  5. Rename profile to "Brave-Browser-Nightly"
  6. Launch 1.41.x w/ staging
  7. Open panel
  8. Confirm rewrite rule is used using Charles
  9. Confirm you see the below in your logs
[13424:259:0601/153315.992860:INFO:uphold_wallet.cc(153)] User doesn't have the required Uphold capabilities!
  1. Confirm the panel shows you are logged out of Uphold notification in UI and your balance is not displayed.
1.39.x 1.41.x 1.41.x
1 39 111 6 6-b

Also verified the following cases for an account in good standing/full capabilities:

Case 7: Clean profile, both "sends" and "receives" are true - PASSED
  1. Confirm you've disabled all rewrite rules or have stopped running Charles
  2. Using clean profile, launch 1.41.x w/ staging env
  3. Enable Rewards
  4. Login using Uphold account in good standing
  5. Confirm able to link uphold account to Brave Rewards without any errors
  6. Confirm "sends" and "receives" both have enabled = true
{"category":"permissions","enabled":true,"key":"receives","name":"Receives","requirements":[],"restrictions":[]},
{"category":"permissions","enabled":true,"key":"sends","name":"Sends","requirements":[],"restrictions":[]},
  1. Confirm balance displays in rewards as you would expect
Example Example
Screen Shot 2022-06-01 at 3 44 28 PM Screen Shot 2022-06-01 at 3 44 39 PM
Case 8: Upgrade profile, "sends" and "receives" are true, brave://rewards page is open and active after upgrade - PASSED
  1. Confirm you've disabled all rewrite rules or have stopped running Charles
  2. Using clean profile, launch 1.39.x w/ staging env
  3. Enable Rewards
  4. Login using Uphold account, confirm account is linked as expected (you see balance, etc)
  5. Keep brave://rewards page as the open/active tab. Close 1.39.x
  6. Rename profile to "Brave-Browser-Nightly"
  7. Launch 1.41.x w/ staging
  8. Confirm "sends" and "receives" both have enabled = true
{"category":"permissions","enabled":true,"key":"receives","name":"Receives","requirements":[],"restrictions":[]},
{"category":"permissions","enabled":true,"key":"sends","name":"Sends","requirements":[],"restrictions":[]},
  1. Confirm you are still logged in to Uphold with Brave Rewards
  2. Confirm balance displays in rewards as you would expect
1.39.x 1.41.x
Screen Shot 2022-06-01 at 4 12 29 PM Screen Shot 2022-06-01 at 4 13 20 PM
Case 9: Upgrade profile, "sends" and "receives" are true, brave://rewards page is not open after upgrade - PASSED
  1. Confirm you've disabled all rewrite rules or have stopped running Charles
  2. Using clean profile, launch 1.39.x w/ staging env
  3. Enable Rewards
  4. Login using Uphold account, confirm account is linked as expected (you see balance, etc)
  5. Close any brave://rewards pages and have another tab as the open/active tab. Close 1.39.x
  6. Rename profile to "Brave-Browser-Nightly"
  7. Launch 1.41.x w/ staging
  8. Confirm "sends" and "receives" both have enabled = true
{"category":"permissions","enabled":true,"key":"receives","name":"Receives","requirements":[],"restrictions":[]},
{"category":"permissions","enabled":true,"key":"sends","name":"Sends","requirements":[],"restrictions":[]},
  1. Confirm you are still logged in to Uphold with Brave Rewards
  2. Confirm balance displays in rewards as you would expect
1.39.x 1.41.x
Screen Shot 2022-06-01 at 4 18 38 PM Screen Shot 2022-06-01 at 4 19 07 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement error modal if user does not have receives OR sends capabilities on Uphold
5 participants