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

Improve VBA logic #6230

Merged
merged 20 commits into from
Dec 1, 2021
Merged

Improve VBA logic #6230

merged 20 commits into from
Dec 1, 2021

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Nov 5, 2021

Details

Clean up for Free Plan - improving the VBA API logic and breaking things down into more digestible parts

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/173363

Tests

  • Automated tests should cover some of the changes. The logic should not have changed.
  • We should run through the VBA flow once to be sure there are no regressions

QA Steps

  • Regression test for adding a bank account via New Expensify

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Mobile Web

Desktop

iOS

Android

@marcaaron marcaaron self-assigned this Nov 5, 2021
@marcaaron marcaaron changed the title [WIP][HOLD] Improve VBA logic [HOLD] Improve VBA logic Nov 11, 2021
@marcaaron
Copy link
Contributor Author

Gonna leave this on HOLD til the 19th because the changes are significant, but will open for reviews.

@marcaaron marcaaron marked this pull request as ready for review November 11, 2021 15:40
@marcaaron marcaaron requested a review from a team as a code owner November 11, 2021 15:40
@MelvinBot MelvinBot requested review from joelbettner and removed request for a team November 11, 2021 15:40
@luacmartins luacmartins self-requested a review November 12, 2021 14:06
@marcaaron marcaaron changed the title [HOLD] Improve VBA logic [HOLD 11/19] Improve VBA logic Nov 12, 2021
Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

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

LGTM! Still need to test it though. Left one comment. Great job!

return hasTriedToUpgrade ? CONST.BANK_ACCOUNT.STEP.VALIDATION : CONST.BANK_ACCOUNT.STEP.COMPANY;
}

return CONST.BANK_ACCOUNT.STEP.ENABLE;
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the logic hasn't changed, but I feel like we should probably default to the bank account step just to be safe.

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'm unsure about defaulting to the BankAccountStep because if we miss a case where the user should be passed to the enable step then they'll get stuck and we won't might not realize that we missed this case.

Maybe we can leave the logic intact and log an alert when we end up navigating to this step for an unexpected reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like

if (!shouldGoToEnableStep) {
    Log.alert('Unexpectedly sent user to EnableStep', params);
}

return CONST.BANK_ACCOUNT.STEP.ENABLE;

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah actually, thought about it some more and I think the only possibility is that the bank account is not in an open state, but we are already returning early above when we don't have a bank account and it is not in an open state. So I think it might just be redundant to do anything else.

Can you think of a case where we end up here and it would not be safe to go to the enable step?

Maybe it would be best to wait for that day to arrive...

Copy link
Contributor

Choose a reason for hiding this comment

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

I can't think of any. Given that this would be a rare edge case, if it exists at all, I'm ok keeping it as is.

@luacmartins
Copy link
Contributor

Tests well 👍

@marcaaron marcaaron changed the title [HOLD 11/19] Improve VBA logic Improve VBA logic Nov 22, 2021
luacmartins
luacmartins previously approved these changes Nov 23, 2021
@luacmartins
Copy link
Contributor

I did some more testing and have two comments:

  1. I'm hitting a wall when going through the flow. When I use the information to trigger the Onfido step, I somehow always get redirected back to the Personal information step. That is working well on main so maybe something being introduced here.

  2. Another thing that I noticed is that the Incorporation date and DOB fields are no longer being populated with the draft, but that's also the case on main. I think it's because the value stored in draft might be in the wrong format, e.g. "1990-01-01T07:00:00.000Z"

@luacmartins
Copy link
Contributor

Fixing the date issue here - #6524. Onfido is still a problem though.

@marcaaron
Copy link
Contributor Author

I'm hitting a wall when going through the flow. When I use the information to trigger the Onfido step, I somehow always get redirected back to the Personal information step

Ok I'll need to check this again after the Plaid OAuth stuff is done. Or maybe you have some ideas about why the redirect happens.

@luacmartins
Copy link
Contributor

From a quick glance, it seems that sdkToken is not being set in achData so we never render the Onfido component.

@marcaaron
Copy link
Contributor Author

From a quick glance, it seems that sdkToken is not being set in achData so we never render the Onfido component.

Ah, yes, I see my mistake now. Thanks!!!

@marcaaron
Copy link
Contributor Author

Updated and re-tested

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

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

Code LGTM! The Onfido issue is gone 🎉
As always, great work @marcaaron!

@marcaaron marcaaron merged commit 0360fd7 into main Dec 1, 2021
@marcaaron marcaaron deleted the marcaaron-vbaRefactor branch December 1, 2021 15:37
@OSBotify
Copy link
Contributor

OSBotify commented Dec 1, 2021

✋ 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

OSBotify commented Dec 7, 2021

🚀 Deployed to staging by @marcaaron in version: 1.1.17-8 🚀

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

@marcaaron
Copy link
Contributor Author

Regression test for adding a bank account via New Expensify

Something is super wrong with this flow.. getting caught in an infinite loop after the CompanyStep and looking into it now.

Unsure if this is because of these changes or some of the Plaid changes.

@marcaaron
Copy link
Contributor Author

Hmm so I think not. Tried reverting and the issue is still there 😬

@OSBotify
Copy link
Contributor

OSBotify commented Dec 8, 2021

🚀 Deployed to production by @roryabraham in version: 1.1.18-3 🚀

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.

None yet

3 participants