App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Expensify Card - Settlement account is blank when second admin accesses the page

Open IuliiaHerets opened this issue 1 year ago • 35 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.65-4 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Expensify Card feature is enabled.
  • Bank account is set up in the workspace.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Members.
  3. Invite another user and promote to admin.
  4. Log in as admin.
  5. Go to workspace settings > Expensify Card.
  6. Click Settings.
  7. Click Settlement account.

Expected Result:

Settlement account will not be blank.

Actual Result:

Settlement account is blank when second admin accesses the page.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/d7bd26a6-98f5-44c6-9dc6-8e0a764f467d

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861520764980845600
  • Upwork Job ID: 1861520764980845600
  • Last Price Increase: 2024-12-03
  • Automatic offers:
    • DylanDylann | Contributor | 105192011
Issue OwnerCurrent Issue Owner: @mountiny

IuliiaHerets avatar Nov 22 '24 10:11 IuliiaHerets

Triggered auto assignment to @JmillsExpensify (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 Nov 22 '24 10:11 melvin-bot[bot]

Proposal

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

Settlement account is blank when second admin accesses the page

What is the root cause of that problem?

Currently on the expensify cards settings page, we get the current users personal bank account details: https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/pages/workspace/expensifyCard/WorkspaceCardSettingsPage.tsx#L31 https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/ONYXKEYS.ts#L262-L263

Hence we do not see current bank selected.

But here we need the current policy account details and not individual, hence from admin account the field is shown as blank.

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

To fix it, firstly we should get the bank account data from policy?.achAccount and then display that in the settings page:

  1. So in WorkspaceCardSettingsPage: https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/pages/workspace/expensifyCard/WorkspaceCardSettingsPage.tsx#L25 https://github.com/Expensify/App/blob/51e25af3df2eef49c2ac87e0aef816099f9d3747/src/pages/workspace/expensifyCard/WorkspaceCardSettingsPage.tsx#L38

We need to get the achAccount data and get the bank account number from there:

const bankAccountNumber = policy?.achAccount?.accountNumber ?? '';
  1. Then in WorkspaceSettlementAccountPage, we have multiple options.

a) Either disable this page for admins, This is because now we will get the admin's bank accounts rather than the owners. b) If we want to allow the settlement accounts to be changed to the admins bank account then the current implementation works, but with a catch that if there is no bank account added by the admin then we should show an empty RHP stating that please add a bank account.

I think option A is more appropriate here given that we do not want the admin to add their own bank account

What alternative solutions did you explore? (Optional)

twilight2294 avatar Nov 25 '24 10:11 twilight2294

@JmillsExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 26 '24 09:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 26 '24 21:11 melvin-bot[bot]

Opening up to the community

JmillsExpensify avatar Nov 26 '24 21:11 JmillsExpensify

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

melvin-bot[bot] avatar Nov 26 '24 21:11 melvin-bot[bot]

@JmillsExpensify, @eh2077 Huh... This is 4 days overdue. Who can take care of this?

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

@eh2077 can you please review my proposal here

twilight2294 avatar Dec 02 '24 12:12 twilight2294

@twilight2294 I have trouble to setup Expensify Card. Can you share steps to setup Expensify Card?

eh2077 avatar Dec 02 '24 14:12 eh2077

Connect this bank account and then assign expensify cards from workspace. that's all i did to reproduce this issue Screenshot 2024-12-03 at 6 47 17 PM

twilight2294 avatar Dec 03 '24 13:12 twilight2294

I managed to reproduce the bug.

@twilight2294 's proposal looks good to me. Let's go with their proposal!

🎀👀🎀 C+ reviewed

eh2077 avatar Dec 03 '24 15:12 eh2077

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

melvin-bot[bot] avatar Dec 03 '24 15:12 melvin-bot[bot]

@eh2077 Sorry, I am not sure that policy?.achAccount is existing

DylanDylann avatar Dec 03 '24 15:12 DylanDylann

Coincidentally I'm also following this because it's part of the Expensify Card feature which I've been in charge of since the beginning.

DylanDylann avatar Dec 03 '24 15:12 DylanDylann

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

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

achAccount

@DylanDylann don't worry i have checked thoroughly it exists below: https://github.com/Expensify/App/blob/01d5233e80a4d4dbe87e6b1e85fdea5dc3c10136/src/types/onyx/Policy.ts#L1801-L1802

We already use a similar check here: https://github.com/Expensify/App/blob/01d5233e80a4d4dbe87e6b1e85fdea5dc3c10136/src/libs/NextStepUtils.ts#L96

My solutions solves this bug efficiently , @Beamanator can you assign me here please as per summary by C+. Also if you have any doubts then let me know, i can answer then

twilight2294 avatar Dec 03 '24 17:12 twilight2294

@DylanDylann don't worry i have checked thoroughly it exists below:

I don't see it in my workspace. Could you screenshot achAccount data?

Screenshot 2024-12-04 at 00 19 58

DylanDylann avatar Dec 03 '24 17:12 DylanDylann

I think that the verified bank account linked to the policy doesn't mean a settled bank account on an Expensify card.Please correct me If I am wrong

DylanDylann avatar Dec 03 '24 17:12 DylanDylann

I don't see it in my workspace. Could you screenshot achAccount data?

You should check if your workspace is connected to bank account first in order to see achAccount

Screenshot 2024-12-03 at 10 58 23 PM

I tested the solution locally and it works great, so maybe a problem with your setup

twilight2294 avatar Dec 03 '24 17:12 twilight2294

@DylanDylann I'm definitely interested in your expertise here if you've been working on Expensify Card features / fixes for a while - do you know an internal Expensify coder who could help us resolve this matter?

Beamanator avatar Dec 03 '24 19:12 Beamanator

cc @mountiny

DylanDylann avatar Dec 03 '24 19:12 DylanDylann

@twilight2294 I think that @DylanDylann is right, you could have different bank accounts as the reimbursement account setup in the workflows page and as the settlement bank account for the Expensify card.

@Beamanator I can assign to myself if that is ok since I was leading this project

I think that its expected that if you are admin who is not owner of any vbba, you do not see the bank accounts there. So maybe we could show something like you do not have access to any VBBA

mountiny avatar Dec 04 '24 14:12 mountiny

So maybe we could show something like you do not have access to any VBBA

Where exactly ? on the settings page ? or we should hide it completely ?

twilight2294 avatar Dec 04 '24 14:12 twilight2294

Hiding it completely would be appropriate right ? as we do not have the value present, we can only display the text below it and hide option above it:

Screenshot 2024-12-04 at 7 55 02 PM

We can check if the current user has BANK_ACCOUNT_LIST (VBBA account) present and then conditionally render the option (have to check if that is allowed on the backend

twilight2294 avatar Dec 04 '24 14:12 twilight2294

Started a thread here

mountiny avatar Dec 04 '24 14:12 mountiny

@twilight2294 we need to discuss this internally first to know the right expectations

mountiny avatar Dec 04 '24 14:12 mountiny

Thank you for taking over, kind sir @mountiny 🙏

Beamanator avatar Dec 04 '24 14:12 Beamanator

@DylanDylann Would you like take over this as C+ as you have more context about the feature? Thanks 🙏

eh2077 avatar Dec 04 '24 14:12 eh2077

@eh2077 IMO, this issue may need to be fixed on the BE side, I can help to take over it and follow the discussion

DylanDylann avatar Dec 04 '24 14:12 DylanDylann

@twilight2294 we need to discuss this internally first to know the right expectations

Okay, I will update the proposal when the expected result is updated, thanks

twilight2294 avatar Dec 04 '24 14:12 twilight2294