App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Bank Account - After deleting the payment method in Wallet, it is displayed in the WS settings

Open vincdargento opened this issue 1 year ago β€’ 7 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.71-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: n/a Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team

Action Performed:

Preconditions: user must be logged in, have created a collect workspace and have connected a bank account.

  1. Navigate to Wallet
  2. Click on the 3-dot button
  3. Click on Delete

Expected Result:

The payment account is not displayed in the workspace settings after deleting it.

Actual Result:

After deleting the payment method in Wallet, it's displayed in the WS settings

Workaround:

Unknown

Platforms:

  • [ ] Android: Standalone
  • [ ] Android: HybridApp
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Standalone
  • [ ] iOS: HybridApp
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/fe0c4d6a-b27e-41c1-87ee-e71d4e94560d

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021864721429534820736
  • Upwork Job ID: 1864721429534820736
  • Last Price Increase: 2024-12-05
Issue OwnerCurrent Issue Owner: @ishpaul777

vincdargento avatar Dec 04 '24 16:12 vincdargento

Triggered auto assignment to @lschurr (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Dec 04 '24 16:12 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~021864721429534820736

melvin-bot[bot] avatar Dec 05 '24 17:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 05 '24 17:12 melvin-bot[bot]

Edited by proposal-police: This proposal was edited at 2024-12-06 06:08:18 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

After deleting the payment method in Wallet, it is displayed in the WS settings

What is the root cause of that problem?

We do not clear the achAccount on policies where the deleted bank account exist on the FE as well as the BE

What changes do you think we should make in order to solve the problem?

When we delete bank account here, we should get all the policies and check if anywhere achAccount exist and the bank account number is the same as the one being delete, and if so then clear the achAccount data for that policy, we need BE changes as well here, we need to make the following changes here:


Onyx.connect({
    key: ONYXKEYS.COLLECTION.POLICY,
    waitForCollectionCallback: true,
    callback: (value) => (allPolicies = value),
});

    Object.values(allPolicies ?? {}).forEach((policy) => {
        if (policy?.achAccount && policy?.achAccount?.bankAccountID === bankAccountID) {
            onyxData?.optimisticData?.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.POLICY}`,
                value: {
                    ...allPolicies,
                    [policy.id]: {
                        ...policy,
                        achAccount: null,
                    },
                },
            });
            onyxData?.failureData?.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.POLICY}`,
                value: {
                    ...allPolicies,
                },
            })
        }
    });

Note that during PR phase we might have to adjust the mapping a bit but this is the approach we need to follow, we might need to add success data as well, this is just overview, details can be done during PR phase

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A this is related to data change, but we can surely have a unit test if needed, we would just need to mock data and expect appropriate policy data

What alternative solutions did you explore? (Optional)

N/A

twilight2294 avatar Dec 06 '24 06:12 twilight2294

@lschurr, @ishpaul777 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Dec 09 '24 09:12 melvin-bot[bot]

Hi @ishpaul777 - could you review the proposal?

lschurr avatar Dec 09 '24 16:12 lschurr

Sure i'll review in ~couple hours~

update: Will review tmrw..

ishpaul777 avatar Dec 09 '24 17:12 ishpaul777

I think proposal from @twilight2294 should work on FE side but i'll bring a internal engineer to decide if backend changes are plausible.

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed

ishpaul777 avatar Dec 11 '24 22:12 ishpaul777

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

melvin-bot[bot] avatar Dec 11 '24 22:12 melvin-bot[bot]

Sounds good, thanks for the review @ishpaul777, assigning @twilight2294 πŸš€

marcochavezf avatar Dec 13 '24 16:12 marcochavezf

πŸ“£ @ishpaul777 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] avatar Dec 13 '24 16:12 melvin-bot[bot]

πŸ“£ @twilight2294 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer 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 πŸ“–

melvin-bot[bot] avatar Dec 13 '24 16:12 melvin-bot[bot]

@marcochavezf are the BE changes ready for this one ?

Also please take a look at these comments: https://github.com/Expensify/App/pull/54235/files#r1888100521

twilight2294 avatar Dec 17 '24 08:12 twilight2294

I'll send an auth PR for it, so we remove the achAccount from the policy if no other reimburser owning this bank account exit in the policy

nkuoch avatar Dec 27 '24 16:12 nkuoch

any update here?

twilight2294 avatar Jan 10 '25 11:01 twilight2294

Auth PR was merged last week. Can you retest? Bank account should be removed from the workspace when deleted from personal settings (as long as no other workspace admin owns it too).

nkuoch avatar Jan 10 '25 16:01 nkuoch

This issue has not been updated in over 15 days. @nkuoch, @marcochavezf, @lschurr, @ishpaul777, @twilight2294 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

melvin-bot[bot] avatar Jan 20 '25 09:01 melvin-bot[bot]

please close this

twilight2294 avatar Jan 29 '25 05:01 twilight2294