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

feat: add enable wallet button #29573

Merged
merged 28 commits into from
Oct 19, 2023
Merged

feat: add enable wallet button #29573

merged 28 commits into from
Oct 19, 2023

Conversation

samh-nl
Copy link
Contributor

@samh-nl samh-nl commented Oct 13, 2023

Details

Present an 'Enable wallet' button that allows the user to upgrade to a Gold wallet.

Fixed Issues

$ #29320
PROPOSAL: N/A, assigning was discussed via Slack here

Tests

Preconditions: The user must not have enabled the wallet yet and must have no payment method.

  1. Go to Settings
  2. Go to Wallet
  3. Press 'Add payment method'
  4. Press 'Bank account'
  5. Add the 'Plaid Checking' or 'Plaid Saving' bank account
  6. Verify an 'Enable wallet' button is present in the wallet page
  7. Press the 'Enable wallet' button
  8. Verify the user is navigated to a page requesting additional details to be provided
  9. Successfully complete the steps
  10. Verify you are navigated back to the 'Wallet' page
  11. Verify the wallet page does not show an 'Enable wallet' button, but instead a link stating 'Transfer balance'
  • Verify that no errors appear in the JS console

Offline tests

Preconditions: The user must not have enabled the wallet yet but must have added a payment method.

  1. Go to Settings
  2. Go to Wallet
  3. Verify an 'Enable wallet' button is present in the wallet page
  4. Verify the button is disabled

QA Steps

Preconditions: The user must not have enabled the wallet yet and must have no payment method.

  1. Go to Settings
  2. Go to Wallet
  3. Press 'Add payment method'
  4. Press 'Bank account'
  5. Add the 'Plaid Checking' or 'Plaid Saving' bank account
  6. Verify an 'Enable wallet' button is present in the wallet page
  7. Press the 'Enable wallet' button
  8. Verify the user is navigated to a page requesting additional details to be provided
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
Android.Native.Screen.Recording.2023-10-19.at.19.16.29.mov
Android: mWeb Chrome
mWeb.Chrome.Screen.Recording.2023-10-19.at.19.20.44.mov
iOS: Native
iOS.Native.Screen.Recording.2023-10-19.at.19.23.41.mov
iOS: mWeb Safari
mWeb.Safari.Screen.Recording.2023-10-19.at.19.27.06.mov
MacOS: Chrome / Safari
Web.Screen.Recording.2023-10-19.at.19.05.40.mov
MacOS: Desktop
Desktop.Screen.Recording.2023-10-19.at.19.32.34.mov

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 13, 2023

@kevinksullivan @MariaHCD

  1. Regarding testing steps, I cannot get past the enable payments page to test the complete flow. Upon clicking 'Save & continue', the UpdatePersonalDetailsForWallet endpoint returns this error (no error is made visible in UI, though), please see below.
Screenshot 2023-10-13 at 17 31 09
  1. To verify a comment:

we'd want to redirect them to setup their bank account first.

The KYC wall currently checks if there is either a bank account or a debit card. Are both valid options for allowing upgrading the wallet or should there specifically be a bank account?

  1. The description on the enable payments page indicates that a payment will be processed. However, the intention here seems to only be to upgrade to a gold wallet and not to initiate any payments, or am I wrong?

@samh-nl samh-nl marked this pull request as ready for review October 15, 2023 09:01
@samh-nl samh-nl requested a review from a team as a code owner October 15, 2023 09:01
@melvin-bot melvin-bot bot removed the request for review from a team October 15, 2023 09:01
@melvin-bot
Copy link

melvin-bot bot commented Oct 15, 2023

@robertKozik Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MariaHCD
Copy link
Contributor

Regarding testing steps, I cannot get past the enable payments page to test the complete flow. Upon clicking 'Save & continue', the UpdatePersonalDetailsForWallet endpoint returns this error (no error is made visible in UI, though), please see below.

We've got an internal fix for this: https://github.com/Expensify/Web-Expensify/pull/39205

The KYC wall currently checks if there is either a bank account or a debit card. Are both valid options for allowing upgrading the wallet or should there specifically be a bank account?

Let's restrict this to just bank accounts, debit cards are not allowed for now.

The description on the enable payments page indicates that a payment will be processed. However, the intention here seems to only be to upgrade to a gold wallet and not to initiate any payments, or am I wrong?

Could you clarify which messaging? There will be no payments initiated (automatically) but the user can now start initiating payments. Could we also change the default text in the ContinueButton to common.continue

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 16, 2023

I will make the adjustments shortly.

Could you clarify which messaging?

Sure, I was referring to this text (defined here). If it needs to be changed for this flow, please provide the updated text.
Screenshot 2023-10-16 at 12 12 54

@robertKozik
Copy link
Contributor

@samh-nl I assume I should wait for the fix and your adjustment before C+ review?

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 16, 2023

Yes, please wait indeed

@MariaHCD
Copy link
Contributor

MariaHCD commented Oct 16, 2023

If it needs to be changed for this flow, please provide the updated text.

Nice catch. Going to add the Waiting for copy label on the issue along with context.

Update: #29320 (comment)

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 17, 2023

I've resolved conflicts and I believe it's ready to be reviewed.

There's a problem but possibly outside the scope of this PR (though I'd be happy to look into it): the Wallet page does not refresh when it transitions away from the empty state (i.e. after adding a payment method). This causes the Expensify Wallet section to not immediately appear. Please see the video below.

Screen.Recording.2023-10-17.at.11.22.00.mov

@MariaHCD
Copy link
Contributor

This causes the Expensify Wallet section to not immediately appear.

Nice catch, I think this can be outside the scope of your PR. We are looking to redirect the user to the KYC flow after adding a PBA instead of back to the Wallet page: #29726

@MariaHCD MariaHCD self-requested a review October 17, 2023 12:49
@MariaHCD
Copy link
Contributor

@robertKozik feel free to start on the review for this one 🙏🏼

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 19, 2023

@MariaHCD with the details you mentioned, I'm unable to proceed. Is there anything that I'm missing?

Same error.

@getusha
Copy link
Contributor

getusha commented Oct 19, 2023

Issue have been logged with QA team for Save and Continue button is not responding https://github.com/Expensify/Web-Expensify/pull/39174#issuecomment-1765391356

I saw this, i think this is a known issue @MariaHCD

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 19, 2023

To skip these steps so you can check if it redirects correctly when finishing the 'enable payments' flow, you can do:

  1. This brings you to the last step:
window.Onyx.merge('userWallet', {shouldShowWalletActivationSuccess: true});
  1. This then upgrades your wallet to gold:
window.Onyx.merge('userWallet', {tierName: 'GOLD'});

Ideally of course we can go through the flow fully.

@MariaHCD
Copy link
Contributor

MariaHCD commented Oct 19, 2023

Looking at the BE logs to see why you both are getting blocked at the additional details step.

Update: Got an internal fix - https://github.com/Expensify/Web-Expensify/pull/39314

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 19, 2023

Thanks, let us know when it's deployed. I can't see the status of PRs in that repository.

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 19, 2023

@MariaHCD Check has been added (I've defined a new method getPendingAction to make it more in line with the rest).

BUG Option to enable wallet does not appear immediately after adding a bank account. You have to go back and then to the wallet page again in order to see the enable button.
Screen.Recording.2023-10-19.at.3.21.09.PM.mov

See #29573 (comment), thoughts?

Didn't see that. Thanks for this!

Worth mentioning that an issue has already been created for this here. Perhaps that issue should be expedited? There's a couple proposals.

@MariaHCD
Copy link
Contributor

@samh-nl @allroundexperts The fix has been deployed to staging, please let me know if you're still getting blocked at the additional details step 🙏🏼

@MariaHCD
Copy link
Contributor

I realized you both won't be able to test steps 9 - 11 because we do not allow test activated wallets on staging. I will test on dev. @allroundexperts feel free to do the final code review, I'll do the reviewer checklist.

Copy link
Contributor

@allroundexperts allroundexperts left a comment

Choose a reason for hiding this comment

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

Code wise, this looks good!

@melvin-bot melvin-bot bot requested a review from joelbettner October 19, 2023 16:30
@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 19, 2023

I've pushed a proptype fix: walletTerms.source should not be required.

walletTerms is used in the Indicator component, which is rendered prior to the user interacting with KYCWall, so walletTerms is still empty at that point.

@samh-nl
Copy link
Contributor Author

samh-nl commented Oct 19, 2023

I've updated the checklist and added videos for all platforms.

@MariaHCD
Copy link
Contributor

MariaHCD commented Oct 19, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web

Screenshot 2023-10-19 at 8 37 55 PM

Screen.Recording.2023-10-19.at.8.36.59.PM.mov
Mobile Web - Chrome
Screen.Recording.2023-10-19.at.8.41.08.PM.mov
Screen.Recording.2023-10-19.at.8.40.27.PM.mov
Mobile Web - Safari

Screenshot 2023-10-19 at 8 38 26 PM

Screenshot 2023-10-19 at 9 39 08 PM

Desktop
Screen.Recording.2023-10-19.at.8.39.56.PM.mov

Screenshot 2023-10-19 at 8 39 22 PM

Screen.Recording.2023-10-19.at.8.39.07.PM.mov
iOS

Screenshot 2023-10-19 at 9 41 06 PM

Screenshot 2023-10-19 at 9 41 33 PM

Android
XRecorder_19102023_212302.mp4

@MariaHCD
Copy link
Contributor

Really don't know why the reviewer checklist check is failing when I clearly have it here. I've retried it multiple times.

Found the reviewer checklist!
You completed 0 out of 54 checklist items with 54 unfinished items
Make sure you are using the most up to date checklist found here: https://raw.githubusercontent.com/Expensify/App/main/contributingGuides/REVIEWER_CHECKLIST.md
Error: PR Reviewer Checklist is not completely filled out. Please check every box to verify you've thought about the item.

Going to merge anyway...

@MariaHCD MariaHCD merged commit 35920b6 into Expensify:main Oct 19, 2023
11 of 14 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

OSBotify pushed a commit that referenced this pull request Oct 20, 2023
feat: add enable wallet button
(cherry picked from commit 35920b6)
@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.3.87-7 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@kevinksullivan
Copy link
Contributor

been trying to test this here but have run into unrelated issues.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/francoisl in version: 1.3.87-12 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

selectPaymentMethod(paymentMethod) {
this.props.onSelectPaymentMethod(paymentMethod);
if (paymentMethod === CONST.PAYMENT_METHODS.BANK_ACCOUNT) {
Navigation.navigate(this.props.addBankAccountRoute);
Copy link
Contributor

Choose a reason for hiding this comment

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

Coming from #32906, we should have callled BankAccounts.openPersonalBankAccountSetupView(); to ensure that Plaid data is cleared before Plaid view gets rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants