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

Incorporate Add Bank Account / KYC checks into Send Money + Pay request flow #6659

Merged
merged 26 commits into from
Jan 10, 2022

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Dec 9, 2021

cc @nickmurray47

Details

Tracking issue and additional context: https://github.com/Expensify/Expensify/issues/185320

This PR adds a way to effectively "block" a specific user action that requires a gold wallet and then to "continue" that action once they successfully make it through these flows. Since the flows all happen on different pages/screens it is tricky to enable the "continue" part of whatever user action they were taking. By using a "pay wall" style component we can save a reference to the component whenever it is mounted and call it's defined "continue" callback.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/187804
$ https://github.com/Expensify/Expensify/issues/187803

Tests

  1. Start with an account that has a SILVER wallet
  2. Attempt to Send Money to someone else
  3. Verify you are asked to add a payment method with a popover
  4. Select bank account and verify you are brought to the Plaid flow and go through it
  5. On success verify, you are next brought to the KYC flow and follow the second set of instructions here which explain how to test the ActivateWallet flow on dev -> https://stackoverflow.com/c/expensify/questions/10607
  6. Once you successfully get through this flow the original action you wanted to take (send money) should succeed
  7. Repeat with a new account but this time test paying a request
  8. Logout after adding a bank account + passing KYC checks then log back in and verify that you do not hit the KYC wall anymore.

QA Steps

Internal QA

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

2022-01-07_11-36-01

Mobile Web

Desktop

iOS

2022-01-07_11-52-57
2022-01-07_11-55-13

Android

2022-01-07_12-07-05

@marcaaron marcaaron self-assigned this Dec 9, 2021
@marcaaron
Copy link
Contributor Author

marcaaron commented Dec 10, 2021

I'm at an interesting spot with this stuff. A few things are becoming clear...

  • These two issues are basically the same with the main difference being that when we push one of the 3 screens (enable payments, add bank, add debit) we'll want it to go on top of the correct stack that we're already on:

  • I think that means we'll need unique routes for all of this stuff and need to pass these in to the SettlementButton

  • The logic for the SettlementButton ideally should work independent of the SettlementButton itself so it can also work with the Transfer Balance button. @parasharrajat is working on that over in Feature: Transfer balance #4177

  • There's another tricky part of this to handle which is basically... what happens when we successfully do any of these and need to return to the previous screen and trigger the original event? The possibilities are...

    • add a debit card -> move the user to KYC flow
    • add a bank account -> move the user to KYC flow
    • enable payments -> continue sending money, transferring balance, or paying request
  • Now the fun part... each time we do one of those we will dismiss the page by calling goBack() or navigating away on success or failure.

  • However, the screen underneath will need some logic to continue whatever the user was trying to do before.

I'm unsure the best way to achieve the "continue" logic just yet, but have a few of ideas...

  1. Navigate back to the previous page with some params like {previousRoute: 'bankAccount', success: true} then wait for these route params in componentDidUpdate(), clear them out, and trigger an onContinue() callback which will basically perform the original action again and route us to the next place.

  2. Use some kind of subscription to trigger an event and subscribe to the event where we place the popover then call the onContinue() callback. Instead of "navigating with params" we will navigate() or goBack() and also publish an event like EVENT.CONTINUE_PAYMENTS_SETUP.

  3. Similar to 2 we can set a global onEnablePaymentsContinueCallback() when our component mounts and clear it out when the component unmounts. Then we can simply call this callback whenever we successfully complete any of the three actions.

  4. Onyx based solution. Set some params for the success or failure of any of the actions we tried to take after they are successful or unsuccessful. In the previous screen check to see if these params did not exist before but are now updated in componentDidUpdate(). Handle them once then clear them out.

  5. Navigate to these routes, but use the screen name and params instead of the linkTo() method. This should allow us to pass a callback as a param when navigating.

The last option seems to be the easiest so that's what I'll try first. Actually ended up not liking that last option because ideally there will only ever be one way to "navigate" and we have avoided "navigate with a callback" thus far.

@marcaaron
Copy link
Contributor Author

Solution 3 ended up being the one that makes the most sense to me.

@marcaaron
Copy link
Contributor Author

Found a better solution than everything else that I thought of which is to create a "pay wall" type component where if the user has not completed checks or added payment method we force them to complete the flow and then "continue" whatever the original action is after. The component uses a ref similar to how the Growl component/interface works.

@marcaaron marcaaron changed the title [WIP] Incorporate Add Bank Account / KYC checks into Send Money flow [WIP] Incorporate Add Bank Account / KYC checks into Send Money + Pay request flow Jan 3, 2022
@marcaaron marcaaron changed the title [WIP] Incorporate Add Bank Account / KYC checks into Send Money + Pay request flow [HOLD #6992] Incorporate Add Bank Account / KYC checks into Send Money + Pay request flow Jan 3, 2022
@marcaaron marcaaron changed the title [HOLD #6992] Incorporate Add Bank Account / KYC checks into Send Money + Pay request flow [HOLD PR 6992] Incorporate Add Bank Account / KYC checks into Send Money + Pay request flow Jan 3, 2022
@marcaaron
Copy link
Contributor Author

This is on HOLD still but taking off draft to get some initial thoughts on the overall implementation etc.

@marcaaron marcaaron marked this pull request as ready for review January 4, 2022 21:28
@marcaaron
Copy link
Contributor Author

Before merging @marcaaron, also what is the expectation of how this flow should work when someone already has a GOLD wallet? They shouldn't have to add a bank account, right?

No, you must add a bank account or debit card in order to do any of these things otherwise you can't pay with the wallet.

@nickmurray47
Copy link
Contributor

cool, just wanted to make sure

nickmurray47
nickmurray47 previously approved these changes Jan 7, 2022
Copy link
Contributor

@nickmurray47 nickmurray47 left a comment

Choose a reason for hiding this comment

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

👍 will leave to you @danieldoglas

@danieldoglas
Copy link
Contributor

I'm reviewing and testing this. Not really used to this flow so taking some time.

@marcaaron
Copy link
Contributor Author

Gonna also do some quick tests on the platforms. Just realized this is adding new UI and so should be tested everywhere and have screenshots.

@marcaaron
Copy link
Contributor Author

@danieldoglas please let me know if there are any questions!

Copy link
Contributor

@danieldoglas danieldoglas left a comment

Choose a reason for hiding this comment

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

Leaving this as a comment so we can discuss my two comments before approving, but overall LGTM

Comment on lines +102 to +129
{
Component: AddPersonalBankAccountPage,
name: 'IOU_Send_Add_Bank_Account',
},
{
Component: AddDebitCardPage,
name: 'IOU_Send_Add_Debit_Card',
},
{
Component: EnablePaymentsPage,
name: 'IOU_Enable_Payments',
name: 'IOU_Send_Enable_Payments',
}]);

const IOUDetailsModalStackNavigator = createModalStackNavigator([{
Component: IOUDetailsModal,
name: 'IOU_Details_Root',
},
{
Component: AddPersonalBankAccountPage,
name: 'IOU_Details_Add_Bank_Account',
},
{
Component: AddDebitCardPage,
name: 'IOU_Details_Add_Debit_Card',
},
{
Component: EnablePaymentsPage,
name: 'IOU_Details_Enable_Payments',
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed with @marcaaron , I think we're adding some complexity in the code duplicating the AddDebitCardPage and AddPersonalBankAccountPage in two stacks.

If we duplicate them here, we need to pass them as parameters in IOUConfirmationList, SettlementButtton and IOUDetailsModal instead of just using them in KYCWall.

If we can simplify it using only two routes, that would help us in maintenance in the future.

What do you think @nickmurray47 ?

Also, this is NAB.

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 like the idea of using generic routes for these then they will exist outside of the underlying stack.

But I think in that case we should not have both < and x in their headers because they would both do the same thing.

This wasn't really ironed out in the doc so I followed the existing convention (we already had IOU_Enable_Payments set up with a unique route).

Comment on lines +347 to +348
ADD_PAYMENT_MENU_POSITION_Y: 226,
ADD_PAYMENT_MENU_POSITION_X: 356,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to work with fixed values here independent of the platform and screen size? Just to be sure this will be how we're imagining in every device.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a bit of temp code and a follow up created to address this here

@marcaaron
Copy link
Contributor Author

When testing on iOS seems like the an error appears...

2022-01-07_11-45-38

Kind of confused because I have not added and ScrollView in this PR so going to check against main to see if the issue exists there.

@marcaaron
Copy link
Contributor Author

Hmm yes the VirtualizedList warning exists on main as well. We should maybe create an issue to look into this - but can ignore it as we are still under beta and it wasn't introduced in this PR.

@marcaaron
Copy link
Contributor Author

Ah I found a bug with some of the logic while testing and updated it. If you add a bank account and then log out and then try to send an IOU again after logging in we will not check the most recent list of payment methods and end up asking the user to enter one again.

@nickmurray47 mind re-reviewing?

@nickmurray47
Copy link
Contributor

Yeah, can take another look! catching up on context right now

@marcaaron
Copy link
Contributor Author

The ScrollView thing is being handled here #7088

Copy link
Contributor

@nickmurray47 nickmurray47 left a comment

Choose a reason for hiding this comment

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

Nice, LGTM! Thanks for adding the screenshots in for the other platforms, I should've asked for those in the beginning.

Do you also mind adding just one last step to QA:
8. Logout after adding a bank account, log back in and verify that you do not hit the pay wall

Copy link
Contributor

@danieldoglas danieldoglas left a comment

Choose a reason for hiding this comment

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

LGTM

@danieldoglas danieldoglas merged commit 6803d00 into main Jan 10, 2022
@danieldoglas danieldoglas deleted the marcaaron-checkPaymentMethods branch January 10, 2022 19:43
@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
Copy link
Contributor

🚀 Deployed to staging by @danieldoglas in version: 1.1.27-2 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @danieldoglas in version: 1.1.27-3 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @danieldoglas in version: 1.1.27-3 🚀

platform result
🤖 android 🤖 skipped 🚫
🖥 desktop 🖥 skipped 🚫
🍎 iOS 🍎 skipped 🚫
🕸 web 🕸 skipped 🚫

@mvtglobally
Copy link

@marcaaron @danieldoglas @nickmurray47 PR is ready to be QA-ed internally

@marcaaron
Copy link
Contributor Author

@mvtglobally This can be checked off. It's behind a beta and has been tested on staging.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @Jag96 in version: 1.1.29-5 🚀

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

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.

5 participants