Skip to content

[Payment due @dmkt9] Allow manual reimbursement workspaces to set and use a preferred payer#92787

Open
NikkiWines wants to merge 45 commits into
mainfrom
nikki-adjust-payer-gbr
Open

[Payment due @dmkt9] Allow manual reimbursement workspaces to set and use a preferred payer#92787
NikkiWines wants to merge 45 commits into
mainfrom
nikki-adjust-payer-gbr

Conversation

@NikkiWines

@NikkiWines NikkiWines commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Updates the UI so that manual/indirect payment workspaces (reimburseManual) can now use a preferred payer, the same way direct payment workspaces (reimburseYes) already could.

Fixed Issues

$ Part 2 of 2 for https://github.com/Expensify/Expensify/issues/637864
PROPOSAL: N/A internal

Tests

Setup

  1. Create a workspace with 2+ admins (Admin A, Admin B) and 1 employee
  2. Ensure "Make or track payments" is enabled
  3. Ensure no bank account is connected

Test 1: Payer picker in manual mode

  1. Log in as Admin A and navigate to Workspace Settings → Workflows
  2. Under "Payments" confirm that a Payer field appears (no bank account needed)
  3. Tap Payer → confirmadmins list shows
  4. Select Admin B → confirm Payer field updates Admin B's name

Test 2: Only the designated payer sees Pay GBR

  1. Have the employee submit an expense report and have Admin A approve it
  2. Log in as Admin B (designated payer)
  3. Confirm they see a GBR on the Inbox page and a Pay button next to the workspace chat
  4. Confirm they see a Pay option on the report preview
  5. Log in as Admin A (non-payer)
  6. Confirm they do not see a GBR on the Inbox pay and a Pay button next to the workspace chat
  7. Confirm the do see a Pay option on the report preview, like the payer does.

(Payer left, Non-Payer right)
Screenshot 2026-06-26 at 13 48 26

  1. Open the report as Admin B (payer) and confirm the Next Steps message says: Waiting for you to pay expenses. and the option to pay the report
  2. Open the report as Admin A (non-payer) and confirm the Next Steps message says Waiting for <Admin B> to pay expenses. and confirm they do see the option to pay the report

(Payer left, Non-Payer right)
Screenshot 2026-06-26 at 13 49 08

Test 3: Home Action Items

  1. Log in as Admin B (payer) and open the Home page
  2. Confirm you see an item under For you notifying you to pay the report
  3. Log in as Admin A (non-payer) and open the Home Page
  4. Confirm you do not see an item under For you to pay the report

(Payer left, Non-Payer right)
Screenshot 2026-06-26 at 13 48 08

Test 4: Spend Page Action Items

  1. Log in as Admin B (payer) and open the Spend page
  2. Confirm you see an item under Ready to Pay notifying you to pay the report
  3. Log in as Admin A (non-payer) and open the Home Page
  4. Confirm you do not see an item under Ready to pay to pay the report

(Payer left, Non-Payer right)
Screenshot 2026-06-26 at 13 48 48

Test 5: Switching payers with bank account requires sharing

  1. Log in as Admin A and set yourself as the payer for the workspace
  2. Connect a bank account
  3. Switch the payer to Admin B (who has not had the bank account shared) and press "Save"
  4. Confirm you see the modal stating that you'll need to share the bank account to continue
  5. Disconnect the bank account under Workflows
  6. Refresh the page
  7. Set Admin B as the payer and confirm no modal appears
  8. Reconnect to the bank account
  9. Confirm the payer is automatically switched to Admin A
  • Verify that no errors appear in the JS console

Offline tests

Offline behaviors are unchanged from current behaviors

QA Steps

Same as test steps

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

MacOS: Chrome / Safari
Screen.Recording.2026-06-17.at.18.30.07.mov

@NikkiWines NikkiWines self-assigned this Jun 5, 2026
@NikkiWines NikkiWines requested review from a team as code owners June 5, 2026 17:11
@melvin-bot melvin-bot Bot requested review from joekaufmanexpensify and removed request for a team June 5, 2026 17:11
@NikkiWines NikkiWines changed the title [HOLD]Nikki adjust payer gbr [HOLD] Allow manual reimbursement workspaces to set and use a preferred payer Jun 5, 2026
@melvin-bot melvin-bot Bot requested a review from mjasikowski June 5, 2026 17:11
@melvin-bot

melvin-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

@mjasikowski Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot removed the request for review from a team June 5, 2026 17:12
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/hooks/useResetBankAccountModal.tsx 0.00% <ø> (ø)
src/libs/PolicyUtils.ts 76.52% <100.00%> (+0.30%) ⬆️
src/libs/ReportPreviewActionUtils.ts 92.92% <100.00%> (+0.06%) ⬆️
src/libs/ReportPrimaryActionUtils.ts 93.10% <100.00%> (-2.57%) ⬇️
src/libs/ReportUtils.ts 85.77% <100.00%> (-0.10%) ⬇️
src/libs/actions/IOU/ReportWorkflow.ts 78.80% <100.00%> (-0.33%) ⬇️
...ges/workspace/workflows/WorkspaceWorkflowsPage.tsx 77.13% <83.33%> (+0.15%) ⬆️
...ctions/ReimbursementAccount/resetUSDBankAccount.ts 58.82% <50.00%> (-2.72%) ⬇️
...c/pages/workspace/upgrade/WorkspaceUpgradePage.tsx 39.36% <0.00%> (-0.22%) ⬇️
...ons/ReimbursementAccount/resetNonUSDBankAccount.ts 69.56% <50.00%> (-11.69%) ⬇️
... and 1 more
... and 85 files with indirect coverage changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6bac69bd50

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/ReportUtils.ts Outdated
@NikkiWines

Copy link
Copy Markdown
Contributor Author

Let's have a C+ review this too, I'll ask in the room

@NikkiWines NikkiWines requested review from a team and stephanieelliott as code owners June 5, 2026 19:10
@NikkiWines NikkiWines force-pushed the nikki-adjust-payer-gbr branch from d71ac35 to 3768f72 Compare June 5, 2026 19:13
mjasikowski
mjasikowski previously approved these changes Jun 12, 2026
@NikkiWines

Copy link
Copy Markdown
Contributor Author

@dmkt9 @mjasikowski this has been updated and is ready for a re-review please 🙇

@dmkt9

dmkt9 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7066ee9fb4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/actions/ReimbursementAccount/resetNonUSDBankAccount.ts Outdated
Comment thread src/libs/ReportPrimaryActionUtils.ts Outdated
Comment thread src/libs/ReportPrimaryActionUtils.ts Outdated
@NikkiWines

Copy link
Copy Markdown
Contributor Author

Thanks for the review @dmkt9 🙇 updated!

@NikkiWines

Copy link
Copy Markdown
Contributor Author

@codex review 🙇

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8e82af49b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +59 to +62
achAccount: policyOwner
? {
reimburser: policyOwner,
bankAccountID: null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the selected payer when resetting the bank account

When a workspace has a preferred payer different from the owner and its bank account is reset/disconnected, this optimistic update overwrites achAccount.reimburser with policyOwner instead of the current achAccount?.reimburser. That makes the manual-reimbursement payer revert to the owner (and routes payer-only badges/next steps to the wrong admin) until a later refresh/server update, even though removing the bank account should not discard the workspace’s selected payer.

Useful? React with 👍 / 👎.

@NikkiWines NikkiWines requested review from dmkt9 and mjasikowski June 29, 2026 22:14
@dmkt9

dmkt9 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

I'm on it now

@dmkt9

dmkt9 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

I can no longer disconnect my bank account. Additionally, I noticed a display bug:

P.S. It looks like this is a backend bug, since it can also be reproduced in production. It only occurs with one of my accounts, though.

2026-06-30.10-33-45.mp4
image

@dmkt9

dmkt9 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 81030ed181

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/ReportUtils.ts
Comment on lines +63 to +67
bankAccountID: null,
accountNumber: null,
addressName: null,
bankName: null,
state: null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear all ACH fields when preserving the payer

Because this update is applied with Onyx.METHOD.MERGE, replacing achAccount: null with a partial object only clears the listed keys; existing fields omitted from the old ACH account, such as routingNumber and sharees, remain in Onyx after a USD bank-account reset. That leaves stale bank details/share access attached to the policy while the account is considered removed, so clear the whole achAccount first or include every nested ACH field as null when preserving only the reimburser.

Useful? React with 👍 / 👎.

@dmkt9

dmkt9 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Bug: Duplicate bank account disconnection confirmation modal appears.

2026-06-30.11-21-10.mp4

@NikkiWines

Copy link
Copy Markdown
Contributor Author

@dmkt9 thanks for the review:

I can no longer disconnect my bank account. Additionally, I noticed a display bug:
P.S. It looks like this is a backend bug, since it can also be reproduced in production. It only occurs with one of my accounts, though.

I think that's out of scope of this PR if it's happening on prod, and I'm also unable to reproduce this locally

Bug: Duplicate bank account disconnection confirmation modal appears.

I'm unable to reproduce this locally, can you confirm this doesn't happen for you on main?

Screen.Recording.2026-06-30.at.12.08.29.mov

@dmkt9

dmkt9 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

I'm unable to reproduce this locally, can you confirm this doesn't happen for you on main?

I just tested this on main, and I couldn't reproduce the issue.

I also retested it on our PR, but I couldn't reproduce it there either. That's really strange.

@dmkt9

dmkt9 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@codex review

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.

4 participants