-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Migrate BankAccount_SetupWithdrawalAccount API #3507
Conversation
…ly respond to Onyx setting the achData
Trying to get through all of my |
Ready for review, but I'm going to run through the rest of the platform testing just to make sure there is nothing unexpected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor comments, overall looking good. Not sure about the TODOs for some of the later account setup steps - esp. the stuff about open bank accounts. I'd like the err on the side of not including it so we don't end up with code we don't need though
src/libs/actions/BankAccounts.js
Outdated
} | ||
} | ||
|
||
// When going from CompanyStep to BankAccountStep, show the manual form instead of Plaid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: When going back to the BankAccountStep from the Company Step
just for clarity in the order of the steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Also this is possibly some logic that can be removed.
} | ||
|
||
/** | ||
* @deprecated Use !isPending instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's deprecated should we even include it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know. Pretty much just copying stuff over from Web-Secure
in this case - but probably we can remove any methods that are not used. Might save this for a follow up.
I definitely agree with this. However, we have infinite time to follow up and remove things we don't need and not much time to get this done. So, I'm thinking that we can create a follow up issue to address some of these odd |
Also kind of separate but related - once this flow is nailed down I think it will be a little easier to tell what is needed and what is not so I was a bit hesitant to remove things right away. |
// Only keep allowed parameters in the additionalData object | ||
const additionalData = _.pick(parameters, allowedParameters); | ||
|
||
requireParameters(['currentStep'], parameters, commandName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another thing we could create a follow-up for, but are there different sets of required parameters for each step? Might be more comprehensible to have something like:
const requiredParameters = [
CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT: [
// the required parameters for this step
],
CONST.BANK_ACCOUNT.STEP.COMPANY: [
// the required parameters for this step
],
...
...
];
And that could help us do better client-side validation 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I think something like that would clean this up maybe. They are also not used anywhere else atm.
src/libs/actions/BankAccounts.js
Outdated
); | ||
const sdkToken = lodashGet(onfidoRes, CONST.BANK_ACCOUNT.ONFIDO_RESPONSE.SDK_TOKEN); | ||
if (sdkToken && !previousACHData.isOnfidoSetupComplete | ||
&& onfidoRes.status !== CONST.BANK_ACCOUNT.ONFIDO_RESPONSE.PASS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&& onfidoRes.status !== CONST.BANK_ACCOUNT.ONFIDO_RESPONSE.PASS | |
&& onfidoRes.status !== CONST.BANK_ACCOUNT.ONFIDO_RESPONSE.PASS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, should this really be using ||
instead of &&
?
if (sdkToken
|| !previousACHData.isOnfidoSetupComplete
|| onfidoResponse.status !== CONST.BANK_ACCOUNT.ONFIDO_RESPONSE.PASS) {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. Why should it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @roryabraham!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! One tiny comment.
I also noticed that I wasn't getting routed to the Company Step ever, I just get re-routed to the beginning of the add VBA flow.
Edit: NVM turns out I set up a VBA with those values already which is why it was re-routing incorrectly 🙃 I retested on a different account and everything works as expected
@NikkiWines I think it's because there are errors - going to swap out the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function goToWithdrawalAccountSetupStep(stepID, achData) { | ||
const newACHData = {...previousACHData}; | ||
|
||
// If we go back to Requestor Step, reset any validation and previously answered questions from expectID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: When going to the Requestor Step, reset any validation and previously answered questions from expectID.
Will do a follow up for the icon colors @shawnborton Spoke with @ctkochan22 who gave this a once over and mentioned not blocking on him so I'm going to merge this to keep things moving. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging in version: 1.0.69-1🚀
|
🚀 Deployed to production in version: 1.0.73-3🚀
|
Details
I tried to keep things familiar here while migrating stuff over from Web-Secure. That means for now, I'm sticking with a single page
ReimbursementAccountPage
+ then conditionally showing views based on theachData.currentStep
so basically it's very similar to what we have inWeb-Secure
.There are some changes that I am proposing that feel more inline with how we are doing things in
Expensify.cash
Web-Secure
used to move between steps, call the withdrawal account API, validate forms, etc. Mostly I found that pattern to be pretty difficult to reason about and the convenience isn't worth the confusion (that's just my opinion, but we don't have any patterns like this in E.cash so far).nextStep()
andpreviousStep()
are no longer triggered in the parent view (addReimbursementPage.jsx
inWeb-Secure
) and instead implemented by each "step". This might be a little more verbose, but I think it's better to be explicit.BankAccountStep
is not included since all the accounts added for the free plan should beUS
.this.achData
to reference we are referencing + storing the data for an account in setup in the Onyx cache /localStorage
. Most of the logic is left intact, but everywhere we refer tothis.achData
is now will refer to Onyx data. This is ideal because it eliminates the need for something likeReimbursementAccountPage.refreshView()
. Instead we can navigate to the next step simply by setting the Onyx data and letting the view which is subscribing to this data update itself in response.Fixed Issues (Part 2)
https://github.com/Expensify/Expensify/issues/166041
Tests
/add-verified-bank-account
BankAccount_SetupWithdrawalAccount
request was made (Web Only)QA Steps
No QA necessary until the e2e flow is ready for testing
Tested On
Screenshots
Web
Not including other screenshot because no UI is being added here. The web flow is provided as a reference.