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

Handling Uphold's CDD (customer due diligence) process. #11857

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

szilardszaloki
Copy link
Collaborator

@szilardszaloki szilardszaloki commented Jan 14, 2022

Resolves brave/brave-browser#20427, resolves brave/brave-browser#20497.

  • introducing a modal (upholdCustomerDueDiligenceRequiredModal) that tells the user to complete the CDD survey on Uphold
  • parsing out verifications.customerDueDiligence.status from the response of GET https://api.uphold.com/v0/me
  • sending the user to NOT_CONNECTED/DISCONNECTED_VERIFIED if CDD is required for them
  • showing upholdCustomerDueDiligenceRequiredModal (and the kWalletDisconnected notification, if they're already VERIFIED)
  • adding test cases

upholdCustomerDueDiligenceRequiredModal:
upholdCustomerDueDiligenceRequiredModal
Learn More links to https://wallet.uphold.com/customer-due-diligence.

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:

These tests need an Uphold account that requires CDD.

Testing linkage:

  • PENDING ==> NOT_CONNECTED (during linking attempt): only modal – no notification (since they haven't been verified)
linking_attempt.mp4

Upgrade tests:

Make sure you're on brave://rewards when upgrading to the new version!

  • VERIFIED ==> DISCONNECTED_VERIFIED (on Rewards page): modal + notification
rewards_page.mp4

Make sure you're not on brave://rewards when upgrading to the new version!

  • VERIFIED ==> DISCONNECTED_VERIFIED (on Rewards panel): only notification – no modal (since they're not on Rewards page)
rewards_panel.mp4

As far as the spinner issue, see brave/brave-browser#20529.
Android doesn't have the wallet_disconnected notification (ExternalWalletDisconnectedNotification) implemented, see brave/brave-browser#20603.

@szilardszaloki szilardszaloki requested a review from a team as a code owner January 14, 2022 21:56
@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Jan 14, 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

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, we should just make sure to create an issue for the Android piece of this.

Comment on lines +294 to +305
case 'upholdCustomerDueDiligenceRequiredModal':
return (
<ModalRedirect
id={'redirect-modal-uphold-customer-due-diligence-required'}
errorText={getLocale('redirectModalUpholdCustomerDueDiligenceRequiredText')}
titleText={getLocale('redirectModalUpholdCustomerDueDiligenceRequiredTitle')}
learnMore={'https://wallet.uphold.com/customer-due-diligence'}
buttonText={getLocale('redirectModalClose')}
walletType={walletType}
onClick={this.actions.hideRedirectModal}
/>
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we mentioned this in the meeting today, but any changes made to components/brave_rewards/resources/page should be made to components/brave_rewards/resources/android_page as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, just pushed them.
@emerick Would you mind helping me with testing this on Android? I don't have an Android device at hand.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, ping me whenever you're ready!

Comment on lines +206 to +210
if (action.payload.result === 43) { // type::Result::UPHOLD_CUSTOMER_DUE_DILIGENCE_REQUIRED
state.ui.modalRedirect = 'upholdCustomerDueDiligenceRequiredModal'
break
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

@szilardszaloki szilardszaloki force-pushed the sszaloki-20427-uphold-customer-due-diligence branch from f00eb56 to b99a8a8 Compare January 19, 2022 22:39
@brave-builds
Copy link
Collaborator

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

- introducing `upholdCustomerDueDiligenceRequiredModal` that tells the user to complete the CDD survey on Uphold
- parsing out `verifications.customerDueDiligence.status` from the response of `GET https://api.uphold.com/v0/me`
- sending the user to `NOT_CONNECTED`/`DISCONNECTED_VERIFIED` if CDD is required for them
- and showing `upholdCustomerDueDiligenceRequiredModal` (and `kWalletDisconnected` if already VERIFIED)
- adding test cases
@szilardszaloki szilardszaloki force-pushed the sszaloki-20427-uphold-customer-due-diligence branch from b99a8a8 to 4c3c01b Compare January 20, 2022 10:17
@brave-builds
Copy link
Collaborator

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

@szilardszaloki
Copy link
Collaborator Author

SonarCloud is reporting duplicated lines due to how we currently structure code in settingsPage.tsx and wallet_reducer.ts.

@szilardszaloki szilardszaloki merged commit 2a44eea into master Jan 20, 2022
@szilardszaloki szilardszaloki deleted the sszaloki-20427-uphold-customer-due-diligence branch January 20, 2022 18:02
brave-builds pushed a commit that referenced this pull request Jan 20, 2022
@szilardszaloki szilardszaloki added this to the 1.36.x - Nightly milestone Jan 21, 2022
@LaurenWags
Copy link
Member

LaurenWags commented Jan 24, 2022

Verified with

Brave | 1.36.63 Chromium: 97.0.4692.99 (Official Build) nightly (x86_64)
-- | --
Revision | d740da257583289dbebd2eb37e8668928fac5ead-refs/branch-heads/4692@{#1461}
OS | macOS Version 11.6.1 (Build 20G224)
Scenario 1: Clean install - PENDING ==> NOT_CONNECTED - PASSED

Pre-req: Use Charles Proxy to simulate CDD required or ask for your Uphold sandbox account to be put into this state.

  1. Clean install 1.36.63 w/ staging parameters
  2. Enable Rewards
  3. Link KYC'd account which has CDD "required"
  4. Confirm you get modal on brave://rewards page
  5. Confirm link on modal directs to https://wallet.uphold.com/customer-due-diligence (staging or production env, both link to the same place)
  6. Confirm close closes the modal
  7. Open the panel
  8. Confirm that no notification is shown on the panel per Handling Uphold's CDD (customer due diligence) process. #11857 (comment)
Settings Page Panel
1 2
Scenario 2: Upgrade - VERIFIED ==> DISCONNECTED_VERIFIED (brave://rewards tab active) - PASSED

Pre-req: Use Charles Proxy to simulate CDD required or ask for your Uphold sandbox account to be put into this state.

  1. Clean install 1.35.x Nightly version or 1.36.x prior to this fix w/ staging parameters
  2. Enable Rewards
  3. Link KYC'd account which has CDD "required"
  4. Confirm you are logged in without any problem (UI reflects this, your balance is displayed on settings and panel, etc)
  5. Have brave://rewards page open and as the active tab
  6. Upgrade to 1.36.63
  7. Confirm you get modal on brave://rewards page
  8. Confirm link on modal directs to https://wallet.uphold.com/customer-due-diligence (staging or production env, both link to the same place)
  9. Confirm close closes the modal
  10. Open the panel
  11. Confirm that notification is shown on the panel per Handling Uphold's CDD (customer due diligence) process. #11857 (comment)
Settings Page before upgrade Panel before upgrade Settings page after upgrade - modal Settings page after upgrade - modal closed Panel after upgrade
1 2 3 4 5
Scenario 3: Upgrade - VERIFIED ==> DISCONNECTED_VERIFIED (brave://rewards tab not active) - PASSED

Pre-req: Use Charles Proxy to simulate CDD required or ask for your Uphold sandbox account to be put into this state.

  1. Clean install 1.35.x Nightly version or 1.36.x prior to this fix w/ staging parameters
  2. Enable Rewards
  3. Link KYC'd account which has CDD "required"
  4. Confirm you are logged in without any problem (UI reflects this, your balance is displayed on settings and panel, etc)
  5. Close brave://rewards page if open
  6. Upgrade to 1.36.63
  7. Open the panel
  8. Confirm that notification is shown on the panel per Handling Uphold's CDD (customer due diligence) process. #11857 (comment)
  9. Navigate to brave://settings
  10. Confirm no modal shown
Settings Page before upgrade Panel before upgrade Panel after upgrade Settings page after upgrade
1 2 3 4

Encountered brave/brave-browser#20529 while testing scenario 3


Verified with 1.36.58 Chromium: 97.0.4692.99 (Official Build) canary on Google Pixel 3 XL running Android 12.

Note - the "Disconnected" panel notification is not implemented on Android, see brave/brave-browser#20603

Scenario 1: Clean install - PENDING ==> NOT_CONNECTED - PASSED

Pre-req: Use Charles Proxy to simulate CDD required or ask for your Uphold sandbox account to be put into this state.

  1. Clean install 1.36.58 w/ staging parameters
  2. Enable Rewards
  3. Link KYC'd account which has CDD "required"
  4. Confirm you get modal on brave://rewards page
  5. Confirm link on modal directs to https://wallet.uphold.com/customer-due-diligence (staging or production env, both link to the same place)
  6. Confirm close closes the modal
  7. Open the panel
  8. Confirm that no notification is shown on the panel
Settings Page Panel
1 2
Scenario 2: Upgrade - VERIFIED ==> DISCONNECTED_VERIFIED (brave://rewards tab active) - PASSED

Pre-req: Use Charles Proxy to simulate CDD required or ask for your Uphold sandbox account to be put into this state.

  1. Clean install 1.35.x Nightly version or 1.36.x prior to this fix w/ staging parameters
  2. Enable Rewards
  3. Link KYC'd account which has CDD "required"
  4. Confirm you are logged in without any problem (UI reflects this, your balance is displayed on settings and panel, etc)
  5. Have brave://rewards page open and as the active tab
  6. Upgrade to 1.36.58
  7. Confirm you get modal on brave://rewards page
  8. Confirm link on modal directs to https://wallet.uphold.com/customer-due-diligence (staging or production env, both link to the same place)
  9. Confirm close closes the modal
  10. Open the panel
    ---> notification is not displayed, see [Android] Add Logged out toast notification in Rewards panel when user goes into Logged out state brave-browser#20603

Note - different UI on settings page and panel for disconnected state is logged and will be handled separately, known issue not related to this PR.

Settings Page before upgrade Panel before upgrade Settings page after upgrade - modal Settings page after upgrade - modal closed Panel after upgrade
1 2 3 4 5
Scenario 3: Upgrade - VERIFIED ==> DISCONNECTED_VERIFIED (brave://rewards tab not active) - PASSED

Pre-req: Use Charles Proxy to simulate CDD required or ask for your Uphold sandbox account to be put into this state.

  1. Clean install 1.35.x Nightly version or 1.36.x prior to this fix w/ staging parameters
  2. Enable Rewards
  3. Link KYC'd account which has CDD "required"
  4. Confirm you are logged in without any problem (UI reflects this, your balance is displayed on settings and panel, etc)
  5. Close brave://rewards page if open
  6. Upgrade to 1.36.58
  7. Open the panel
    ---> notification is not displayed, see [Android] Add Logged out toast notification in Rewards panel when user goes into Logged out state brave-browser#20603
  8. Navigate to brave://settings
  9. Confirm no modal shown
Settings Page before upgrade Panel before upgrade Panel after upgrade Settings page after upgrade
1 2 3 4

Encountered brave/brave-browser#20529 (comment) while testing scenario 3

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
4 participants