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

[HOLD for payment 2022-07-05] [$500] Android/IOS - Each of the Workspace option setting are unlocked after delete VBA from OldDot #7432

Closed
kbecciv opened this issue Jan 27, 2022 · 45 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Jan 27, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

Precondition: create a new expensifail account

  1. Launce the app
  2. Go to Settings - Enable the Staging Setting
  3. Go to any Workspace and click Connect bank account
  4. Select Connect by Plaid
  5. Use Wells Fargo bank
    Username: user_good | Password: pass_good
    CompanyName: Alberta Bobbeth Charleson
    CompanyTaxID: 123456789
    First Name: Alberta
    Last Name: Charleson
  6. Go to Setting - Payments
  7. Verify the Bank account is displayed
  8. Go to OldDot with the same account
  9. Go to Setting - Account - Payments
  10. Delete the VBA
  11. Go to New Expensify app
  12. Tap on Setting - Workspace
  13. Check each of the Workspace option setting and make sure it locked

Expected Result:

Each of the Workspace option setting are locked after delete VBA from OldDot

Actual Result:

Each of the Workspace option setting are unlocked after delete VBA from OldDot

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • iOS
  • Android

Version Number: 1.1.33.2

Reproducible in staging?: Yes

Reproducible in production?: No

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug5424994_Screen_Recording_20220126-213514_New_Expensify__1_.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause

Slack conversation:

View all open jobs on GitHub

@MelvinBot
Copy link

Triggered auto assignment to @deetergp (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@deetergp
Copy link
Contributor

deetergp commented Feb 1, 2022

I am 95% sure this is be something an external contributor could fix.

@MelvinBot MelvinBot removed the Overdue label Feb 1, 2022
@deetergp deetergp added the External Added to denote the issue can be worked on by a contributor label Feb 1, 2022
@deetergp deetergp removed their assignment Feb 1, 2022
@MelvinBot
Copy link

Triggered auto assignment to @kadiealexander (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@kadiealexander
Copy link
Contributor

Posted to Upwork https://www.upwork.com/jobs/~010dee2324de4cf53e

@botify botify removed the Daily KSv2 label Feb 1, 2022
@MelvinBot MelvinBot added the Weekly KSv2 label Feb 1, 2022
@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (Exported)

@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 1, 2022
@MelvinBot
Copy link

Triggered auto assignment to @pecanoro (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@kadiealexander kadiealexander changed the title Android/IOS - Each of the Workspace option setting are unlocked after delete VBA from OldDot [$500] Android/IOS - Each of the Workspace option setting are unlocked after delete VBA from OldDot Feb 9, 2022
@mananjadhav
Copy link
Collaborator

mananjadhav commented Feb 9, 2022

I am posting this proposal. I've got the root cause and posting a solution. If my understanding for VBA is incorrect and solution is not what is expected, can someone help with some context and I'll correct it accordingly.

Root Cause:

const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', '');
const hasVBA = achState === BankAccount.STATE.OPEN;
const isUsingECard = lodashGet(this.props.user, 'isUsingExpensifyCard', false);
const policyID = lodashGet(this.props.route, 'params.policyID');

The state achState from Onyx.reimbursementAccount is OPEN even after we delete the payment method from the list. Hence all the pages in Workspaces are in an unlocked state.

Now irrespective of whether I delete from the NewDot or OldDot, deleting the BankAccount from Payments -> Select Bank Account -> Delete, only removes the bank account from Onyx.bankAccountList and has no impact on ONYX.reimbursementAccount.

Solution

We already have a function to resetFreePlanBankAccount.

function resetFreePlanBankAccount() {
const bankAccountID = lodashGet(store.getReimbursementAccountInSetup(), 'bankAccountID');
if (!bankAccountID) {
throw new Error('Missing bankAccountID when attempting to reset free plan bank account');

We can update the following BankAccounts.deleteBankAccount action:

function deleteBankAccount(bankAccountID) {
API.DeleteBankAccount({
bankAccountID,
}).then((response) => {

function deleteBankAccount(bankAccountID) {
   const reimbursementBankAccountId = lodashGet(store.getReimbursementAccountInSetup(), 'bankAccountID');
   if(reimbursementBankAccountId === bankAccountID) {
        BankAccounts.resetFreePlanBankAccount();
        return;
   }  

  // Old code as is
  API.DeleteBankAccount({
        bankAccountID,
    }).then((response) => {

...
...

}

Another part about syncing from OldDot, we add another action in BankAccounts, cleanLocalReimbursementData.

This gets called in PaymentMethods.getPaymentMethods, after Onyx.multiSet

.then((response) => {
// Convert bank accounts/cards from an array of objects, to a map with the bankAccountID as the key
const bankAccounts = _.object(_.map(lodashGet(response, 'bankAccountList', []), bankAccount => [bankAccount.bankAccountID, bankAccount]));
const debitCards = _.object(_.map(lodashGet(response, 'fundList', []), fund => [fund.fundID, fund]));
Onyx.multiSet({

function cleanLocalReimbursementData(bankAccounts) {
    const bankAccountID = lodashGet(store.getReimbursementAccountInSetup(), 'bankAccountID');

   // We check if the bank account list doesn't have the reimbursementAccount
    if(!_.find(bankAccounts, bankAccount => bankAccount.bankAccountID === bankAccountID)) { 
        Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {achData: null, shouldShowResetModal: false});
    }
}

@rushatgabhane
Copy link
Member

rushatgabhane commented Feb 10, 2022

Hmm, I'm still trying to understand Manan's proposal, and any regressions that might arise if we go ahead with it.

@pecanoro feel free to take this from me.

@rushatgabhane
Copy link
Member

@pecanoro unassigning myself, don't have the bandwidth for this one

@rushatgabhane rushatgabhane removed their assignment Feb 15, 2022
@pecanoro
Copy link
Contributor

Sorry for the delay!! I think the proposal would work well, I have been trying to find what regressions it could cause but if there is no reimbursement account I don't see why we need to keep it on newDot.

@mananjadhav I have assigned you to the issue, feel free to apply for the job.

@MelvinBot MelvinBot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 17, 2022
@MelvinBot
Copy link

📣 @mananjadhav You have been assigned to this job by @pecanoro!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@kadiealexander
Copy link
Contributor

@pecanoro any thoughts on testing this internally?

@melvin-bot melvin-bot bot removed the Overdue label Apr 27, 2022
@pecanoro
Copy link
Contributor

Oh yeah, we don't have test credentials for contributors. Can you open the PR and I will test it internally?

@melvin-bot melvin-bot bot added the Overdue label May 5, 2022
@kadiealexander
Copy link
Contributor

@mananjadhav were you able to open the PR as per @pecanoro's request above?

@melvin-bot melvin-bot bot removed the Overdue label May 6, 2022
@mananjadhav
Copy link
Collaborator

Hey sorry I missed this.

@pecanoro I have raised the draft PR. Will you need an open PR? I am not sure what I'll fill in the checklist and the screenshots hence I didn't open. If you can check from branch then that'll be great.

@kadiealexander
Copy link
Contributor

@pecanoro did you get a chance to take a look at this one?

@pecanoro
Copy link
Contributor

Is this the PR? #8023 Sorry, since I wasn't tagged there I wasn't sure which PR was the one for me to test the changes.

@kadiealexander
Copy link
Contributor

@mananjadhav could you please confirm which PR to test?

@mananjadhav
Copy link
Collaborator

Something is wrong, I didn't get the notification until @kadiealexander mentioned me again.

Is this the PR? #8023

Yes, @pecanoro that's the PR. I've opened the PR ready for review but added a tag in title [DO NOT MERGE].

@kadiealexander
Copy link
Contributor

@pecanoro just checking in! How's testing going?

@melvin-bot melvin-bot bot added the Overdue label Jun 2, 2022
@pecanoro
Copy link
Contributor

pecanoro commented Jun 6, 2022

I finally found some time to test it! Sorry for the delay

@melvin-bot melvin-bot bot removed the Overdue label Jun 6, 2022
@mananjadhav
Copy link
Collaborator

I am on this one. Adding some code to update certain flags on Onyx. This will need sometime to manually update flags.

@mananjadhav
Copy link
Collaborator

I am just setting up the workspace on the new machine. Old one crashed. I'll have these by tomorrow. Sorry for the delay.

@mananjadhav
Copy link
Collaborator

Hi @pecanoro I had some issues with my new workstation and the last PR ended up having multiple unsigned commits. I've closed the old PR and raised a new one #9490. Please review this (only difference between the old one and new one is that this PR is properly synced with latest main).

Thank you and @kadiealexander for your patience on this one. Appreciate your help in testing and pulling this through.

@pecanoro pecanoro added the Reviewing Has a PR in review label Jun 20, 2022
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 28, 2022
@melvin-bot melvin-bot bot changed the title [$500] Android/IOS - Each of the Workspace option setting are unlocked after delete VBA from OldDot [HOLD for payment 2022-07-05] [$500] Android/IOS - Each of the Workspace option setting are unlocked after delete VBA from OldDot Jun 28, 2022
@melvin-bot
Copy link

melvin-bot bot commented Jun 28, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.78-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2022-07-05. 🎊

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 4, 2022
@kadiealexander
Copy link
Contributor

All paid, thanks @mananjadhav!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

9 participants