Skip to content

[CP Staging] Add payer admin logic for manual reimbursement payers #95547

Merged
mjasikowski merged 7 commits into
mainfrom
nikki-add-payeradmin-exception
Jul 8, 2026
Merged

[CP Staging] Add payer admin logic for manual reimbursement payers #95547
mjasikowski merged 7 commits into
mainfrom
nikki-add-payeradmin-exception

Conversation

@NikkiWines

@NikkiWines NikkiWines commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #95561
PROPOSAL:

Tests

Same as QA

  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

Setup

  1. Create a Control workspace
  2. Invite User B as payments admin (not full admin)
  3. Workflows → enable payments (manual/indirect, no bank account)
  4. Workflows → Payer = User B (payments admin)

Repro / verify

  1. Create a Control workspace.

  2. Invite user as payments admin to the workspace.

  3. Change Payer to payments admin in workspace settings > Workflows > Payer.

  4. Go to staging.new.expensify.com

  5. [Payments admin] Create an expense in workspace chat.

  6. [Payments admin] Click Submit.

  7. [Owner] Approve payments admin's report.

  8. [Payments admin] Open the report.

  • 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 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)
  • 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)
  • 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.
  • 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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-07-08.at.00.34.32.mov

@NikkiWines NikkiWines requested a review from mjasikowski July 7, 2026 22:51
@NikkiWines NikkiWines self-assigned this Jul 7, 2026
@NikkiWines NikkiWines requested review from a team as code owners July 7, 2026 22:51
@melvin-bot melvin-bot Bot requested review from FitseTLT, bernhardoj and joekaufmanexpensify and removed request for a team July 7, 2026 22:51
@NikkiWines NikkiWines requested review from a team and dmkt9 and removed request for FitseTLT and joekaufmanexpensify July 7, 2026 22:51
@melvin-bot melvin-bot Bot requested review from a team, abzokhattab, heyjennahay and rojiphil and removed request for a team July 7, 2026 22:51
@NikkiWines NikkiWines requested review from a team and removed request for bernhardoj July 7, 2026 22:51
@melvin-bot melvin-bot Bot requested review from JmillsExpensify and removed request for a team July 7, 2026 22:51
@melvin-bot

melvin-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

@dmkt9 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 July 7, 2026 22:51
@mjasikowski

Copy link
Copy Markdown
Contributor

@NikkiWines we have TS and ESLint failures here
@dmkt9 can you review this as a priority?

@dmkt9

dmkt9 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Sure, I'm working on it

@dmkt9

dmkt9 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
2026-07-08.17-37-51.mp4

@dmkt9

dmkt9 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@NikkiWines My payment admins aren't receiving any expenses to pay. Does this happen on your side as well?

2026-07-08.16-56-59.mp4

@NikkiWines

Copy link
Copy Markdown
Contributor Author

@dmkt9 hmm no, my payments admin sees the report under For you on the home page and in the Spend page - like in the video in the OP

@dmkt9

dmkt9 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@dmkt9 hmm no, my payments admin sees the report under For you on the home page and in the Spend page - like in the video in the OP

In your video, you use the payments admin as the submitter, right?

However, I think the bug reported in #95537 is different. In that case, the owner of the policy submits and approves an expense, but the expense does not appear on the payments admin's side for payment. So I think this could be a backend bug.

Our PR is actually fixing #95561 instead.

@NikkiWines

NikkiWines commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

In your video, you use the payments admin as the submitter, right?

no in my video the submitter is just a normal member on the policy.

Then there are two admins: admin@dev.com who is the policy owner and admin2@dev.com who is the payments admin

@NikkiWines

Copy link
Copy Markdown
Contributor Author

So I think this could be a backend bug.

hmmm possibly 🤔

@dmkt9

dmkt9 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

In your video, you use the payments admin as the submitter, right?

no in my video the submitter is just a normal member on the policy.

Then there are two admins: admin@dev.com who is the policy owner and admin2@dev.com who is the payments admin

I just tried with a regular member, and the issue still happens on my side. Could you please recheck one more time?

@dmkt9

dmkt9 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@mjasikowski @NikkiWines This PR looks good to me. However, we need to update the QA steps to reflect that it fixes #95561.

I've tried reverting #92787, but the issue in #95537 still occurs on my side.

@mjasikowski

Copy link
Copy Markdown
Contributor

thanks @dmkt9, edited the OP, will look into #95537 separately

@mjasikowski mjasikowski merged commit 31e0bcf into main Jul 8, 2026
36 checks passed
@mjasikowski mjasikowski deleted the nikki-add-payeradmin-exception branch July 8, 2026 14:22
@OSBotify

OSBotify commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚧 mjasikowski has triggered a test Expensify/App build. You can view the workflow run here.

OSBotify pushed a commit that referenced this pull request Jul 8, 2026
[CP Staging] Add payer admin logic for manual reimbursement payers

(cherry picked from commit 31e0bcf)

(cherry-picked to staging by roryabraham)
@OSBotify OSBotify added the CP Staging marks PRs that have been CP'd to staging label Jul 8, 2026
@OSBotify

OSBotify commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.29-1 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Help site review: no changes required

I reviewed the changes in this PR against the help site articles under docs/articles, and I don't believe any documentation updates are needed.

Why: This PR is a bug fix (a DeployBlockerCash on a new feature, Expensify/App#95561) that restores the Pay button for a Payments Admin who is designated as the workspace payer in manual reimbursement mode. It corrects internal payer/reimburser authorization logic (isPolicyPayer / isPayer now also honor policy.reimburser and allow a non-admin member with WORKFLOWS_PAYMENTS write access to pay). It does not introduce or rename any feature, tab, setting, or button, and it doesn't change any user-facing workflow.

The existing docs already describe payers/reimbursers generically and don't state that a Payments Admin can't be a designated payer, so they remain accurate:

Because no changes are required, I did not create a draft help site PR.

@NikkiWines, please confirm this assessment reflects the current behavior. If you feel the Payer / Payments Admin permissions should be documented more explicitly on the help site, let me know and I'll open a draft PR for it.

@OSBotify

OSBotify commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.31-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Help site review: no changes required.

I reviewed the changes in this PR against the existing help-site articles under docs/articles, and no updates are needed.

Why: This PR is a permissions bug fix (issue #95561) — it makes the Pay button appear for a Payments Admin who has been designated as the Payer in Workflows while using manual reimbursement (Mark as Paid). It corrects who is recognized as an authorized payer (isPayer / isPolicyPayer now honor policy.reimburser and members with WORKFLOWS_PAYMENTS write access); it does not add or change any user-facing feature, setting, label, or flow that the help site describes.

The relevant articles already document the underlying behavior accurately at the appropriate level of detail:

None of these describe Pay-button visibility rules at the granularity this fix touches, so they remain correct as written. No draft docs PR was created.

@NikkiWines, please confirm you agree no help-site changes are required. If you'd like me to add or adjust any article to call out that a Payments Admin can be set as the Payer, reply with @MelvinBot and I'll open a draft PR.

@OSBotify

OSBotify commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.4.31-0 🚀

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

Bundle Size Analysis (Sentry):

@OSBotify

OSBotify commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.32-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Re-reviewed on re-trigger — determination unchanged: no help-site changes required, no draft PR created.

I re-checked the diff against the help-site articles and the authoring guidelines (HELP_AUTHORING_GUIDELINES.md, HELPSITE_NAMING_CONVENTIONS.md, TEMPLATE.md).

This PR is a permissions bug fix for issue #95561: it makes the Pay button appear for a Payments Admin who is set as the Payer in Workflows while using Mark as Paid (manual reimbursement). It restores already-shipped, intended behavior — it does not introduce or change any user-facing feature, setting, label, or flow that the help site documents. Pay-button visibility at this per-role granularity isn't something the public articles describe, so they remain accurate as written:

The one adjacent gap I noticed is that the Workflows article describes the payer narrowly as "a Workspace Admin," without noting a Payments Admin can also be designated as the payer. That gap predates this PR (the payer-designation feature shipped earlier) and isn't caused by this change, so I didn't open a PR for it here.

@NikkiWines, if you'd like me to update the Workflows article to explicitly state that a Payments Admin can be set as the Payer, reply with @MelvinBot open that docs PR and I'll create the draft PR, apply HelpDot, and assign it to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CP Staging marks PRs that have been CP'd to staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants