Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers#6851
Conversation
16be3ed to
1e8f545
Compare
1e8f545 to
0190208
Compare
| const nextStep = getNextStep(updatedACHData); | ||
|
|
||
| // Some steps require several substeps based on some data. | ||
| // This logic is done php side: when we need to display a specific step with specific data, php add them in the response in nextStepValues |
| // Some steps require several substeps based on some data. | ||
| // This logic is done php side: when we need to display a specific step with specific data, php add them in the response in nextStepValues | ||
| // Example 1: When forcing manual step after adding Chase bank account via Plaid, so we can ask for the real numbers instead of the plaid substitutes | ||
| // Example 2: When on the requestor step, showing Onfido view after submitting the identity and retrieving the sdkToken |
There was a problem hiding this comment.
Has the information about whether or not a user needs to do onFido always been determined/processed/returned by php?
There was a problem hiding this comment.
no, but now it will be since https://github.com/Expensify/Web-Secure/pull/2121
marcaaron
left a comment
There was a problem hiding this comment.
LGTM just left a clarifying question and still need to run the tests.
| ); | ||
|
|
||
| return differentiatorQuestion ? [differentiatorQuestion] : []; | ||
| } |
There was a problem hiding this comment.
Oh wow, amazing we don't need any of this stuff anymore.
| navigation.goToWithdrawalAccountSetupStep(_.get(responseACHData.nextStepValues, 'currentStep') || nextStep, { | ||
| ...updatedACHData, | ||
| ...responseACHData, | ||
| ...responseACHData.nextStepValues, |
There was a problem hiding this comment.
I haven't checked out the other PR yet, but is the intention to have the nextStepValues overwrite the achData (because nextStepValues are similar to achData)? And if so should we remove the nextStepValues after they are copied here? Or is that not necessary?
There was a problem hiding this comment.
Yes, that's the intention. Removing nextStepValues then is not necessary, but might be cleaner, so I can do it :)
| const isFromPlaid = this.props.achData.setupType === CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID; | ||
| const shouldDisableInputs = Boolean(this.props.achData.bankAccountID) || isFromPlaid; | ||
| const shouldReinitializePlaidLink = this.props.plaidLinkOAuthToken && this.props.receivedRedirectURI; | ||
| const shouldReinitializePlaidLink = this.props.plaidLinkOAuthToken && this.props.receivedRedirectURI && this.props.achData.subStep !== 'manual'; |
There was a problem hiding this comment.
| const shouldReinitializePlaidLink = this.props.plaidLinkOAuthToken && this.props.receivedRedirectURI && this.props.achData.subStep !== 'manual'; | |
| const shouldReinitializePlaidLink = this.props.plaidLinkOAuthToken && this.props.receivedRedirectURI && this.props.achData.subStep !== CONST.BANK_ACCOUNT.SUBSTEP.MANUAL; |
|
updated |
marcaaron
left a comment
There was a problem hiding this comment.
Code LGTM ✅
I don't have a Chase account - but did a run through the VBA flow using the "Platypus OAuth" account and everything seems to be working still.
|
|
||
| // Go to next step | ||
| navigation.goToWithdrawalAccountSetupStep(getNextStep(updatedACHData), responseACHData); | ||
| // Note: php sometimes returns code 200 with no achData, just to indicate that we should keep whatever the JS values are. |
There was a problem hiding this comment.
Contributors who work on this code might not connect that when we refer to "php" we mean the API (though it's not hard to figure out from the context).
There was a problem hiding this comment.
NAB, this note seems important, but I had some trouble understanding when it could happen. Is it important to know not just that it can happen but when?
Anyway, not sure if this is really valuable but maybe we can log something instead of leave this comment
if (_.isEmpty(responseACHData)) {
Log.info('[SetupWithdrawalAccount] No achData in response. Navigating to next step based on currently stored values.');
}There was a problem hiding this comment.
Some steps don't need to verify or save anything (like here), and we early return, just to say that the JS needs to go to the next step with whatever data they already have.
|
updated |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
Tested on https://staging.new.expensify.com/bank-account/, all good! |
|
🚀 Deployed to production by @francoisl in version: 1.1.24-8 🚀
|
Details
Allow to show manual account numbers form after choosing Plaid Oauth Chase accounts, while refactoring using nextStepValues as all the logic moved php side in this PR: https://github.com/Expensify/Web-Secure/pull/2121/files
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/188463
Tests
Made sure I could add a business bank account via Plaid OAuth Chase, entering account numbers manually.
To test it, pull the web-secure branch
nat-chaseoauthand then follow https://docs.google.com/document/d/1_E2pxPGzp2UjVOPHqVHUj09dvWyzSYWbBOy8pbsMORc/edit#QA Steps
Add a business bank account using Plaid Chase. Make sure that after you connect to Chase, you're still asked to add your account numbers manually. Make sure you can complete the rest of the flow.
Tested On
Screenshots
Web
If you enter a wrong account number (not ending with the mask), you'll see an error

Make sure you can finish the flow.

