Skip to content

Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers#6851

Merged
nkuoch merged 8 commits into
mainfrom
nat-nextStepValues
Dec 28, 2021
Merged

Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers#6851
nkuoch merged 8 commits into
mainfrom
nat-nextStepValues

Conversation

@nkuoch

@nkuoch nkuoch commented Dec 21, 2021

Copy link
Copy Markdown
Contributor

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-chaseoauth and 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

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

image

image
image
image

image

image

If you enter a wrong account number (not ending with the mask), you'll see an error
image

Make sure you can finish the flow.
image
image

@nkuoch nkuoch requested a review from a team as a code owner December 21, 2021 17:06
@MelvinBot MelvinBot requested review from joelbettner and removed request for a team December 21, 2021 17:06
@nkuoch nkuoch force-pushed the nat-nextStepValues branch from 16be3ed to 1e8f545 Compare December 21, 2021 17:24
@nkuoch nkuoch force-pushed the nat-nextStepValues branch from 1e8f545 to 0190208 Compare December 21, 2021 17:32
@nkuoch nkuoch self-assigned this Dec 21, 2021

@joelbettner joelbettner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This LGTM

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

*adds

// 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Has the information about whether or not a user needs to do onFido always been determined/processed/returned by php?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@nkuoch nkuoch changed the title Refactor BankAccountSetup using nextStepValues so force Chase manual account numbers [WIP] Refactor BankAccountSetup using nextStepValues so force Chase manual account numbers Dec 21, 2021
@nkuoch nkuoch changed the title [WIP] Refactor BankAccountSetup using nextStepValues so force Chase manual account numbers [WIP] Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers Dec 21, 2021
@nkuoch nkuoch requested a review from marcaaron December 22, 2021 13:03
@nkuoch nkuoch changed the title [WIP] Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers Dec 22, 2021
@nkuoch nkuoch changed the title Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers [HOLD] Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers Dec 22, 2021

@marcaaron marcaaron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM just left a clarifying question and still need to run the tests.

);

return differentiatorQuestion ? [differentiatorQuestion] : [];
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh wow, amazing we don't need any of this stuff anymore.

navigation.goToWithdrawalAccountSetupStep(_.get(responseACHData.nextStepValues, 'currentStep') || nextStep, {
...updatedACHData,
...responseACHData,
...responseACHData.nextStepValues,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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;

Comment thread src/libs/actions/ReimbursementAccount/setupWithdrawalAccount.js
@nkuoch

nkuoch commented Dec 23, 2021

Copy link
Copy Markdown
Contributor Author

updated

marcaaron
marcaaron previously approved these changes Dec 23, 2021

@marcaaron marcaaron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.');
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@nkuoch

nkuoch commented Dec 24, 2021

Copy link
Copy Markdown
Contributor Author

updated

@nkuoch nkuoch changed the title [HOLD] Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers Refactor BankAccountSetup using nextStepValues to force Chase manual account numbers Dec 28, 2021
@nkuoch nkuoch merged commit 9a55e51 into main Dec 28, 2021
@nkuoch nkuoch deleted the nat-nextStepValues branch December 28, 2021 17:12
@OSBotify

Copy link
Copy Markdown
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
Copy Markdown
Contributor

🚀 Deployed to staging by @nkuoch in version: 1.1.23-2 🚀

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

@nkuoch

nkuoch commented Dec 29, 2021

Copy link
Copy Markdown
Contributor Author

Tested on https://staging.new.expensify.com/bank-account/, all good!

@OSBotify

OSBotify commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @francoisl in version: 1.1.24-8 🚀

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.

4 participants