feat: Allow admins to pay with any business bank account they have access to#83638
Conversation
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.
|
There was a problem hiding this comment.
Pull request overview
Enables admins to pay expense reports using any business bank account they have access to (not just the workspace-linked one), and propagates the selected bank account through the pay + KYC flows down to the PayMoneyRequest API call.
Changes:
- Add a shared helper to derive “valid business bank account” options and use it in the SettlementButton and bulk-pay flows.
- Persist selected bank-account data through KYC in Search bulk actions and include the selected
bankAccountIDin payment payloads. - Extend PayMoneyRequest API params and IOU pay logic to support passing
bankAccountID.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/PaymentUtilsTest.ts | Updates unit test wording for renamed input concept. |
| src/libs/actions/Search.ts | Threads selected bank account additionalData through KYC for bulk pay selection. |
| src/libs/actions/IOU/index.ts | Adds methodID input and forwards it as bankAccountID for VBBA payments. |
| src/libs/PaymentUtils.ts | Adds getBusinessBankAccountOptions() and updates getActivePaymentType() to use it. |
| src/libs/API/parameters/PayMoneyRequestParams.ts | Adds optional bankAccountID to PayMoneyRequest params. |
| src/hooks/useSearchBulkActions.ts | Builds payment data with selected business bank account id for expense reports. |
| src/hooks/useBulkPayOptions.ts | Builds bulk pay menu items that include all eligible business bank accounts. |
| src/components/SettlementButton/index.tsx | Updates pay dropdown to show all eligible business bank accounts (with submenu when multiple). |
| src/components/SelectionListWithSections/Search/ActionCell/PayActionCell.tsx | Includes bankAccountID in pay request for VBBA payments. |
| src/components/Search/types.ts | Introduces BulkPaySelectionData shape for bulk-pay additional data. |
| src/components/Search/SearchBulkActionsButton.tsx | Stores pending selected bank account data across KYC completion. |
| src/components/MoneyReportHeader.tsx | Passes selected methodID into IOU pay request for VBBA payments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dac9cdb3ff
ℹ️ 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".
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-hybrid.mp4Android: mWeb Chromeandroid-mweb.mp4iOS: HybridAppios-hybrid.moviOS: mWeb Safariios-mweb.movMacOS: Chrome / Safariweb.mov |
🔴 MANUAL TESTING BLOCKER REGRESSIONS @samranahm
Note for author on how to replicate this locally if you only have 2 BA options, is to apply this diff in order to duplicate the 2 accounts multiple times: DIFFdiff --git a/src/components/SettlementButton/index.tsx b/src/components/SettlementButton/index.tsx
index 1323285b1cb..e25a1c3fda1 100644
--- a/src/components/SettlementButton/index.tsx
+++ b/src/components/SettlementButton/index.tsx
@@ -311,24 +311,25 @@ function SettlementButton({
});
}
} else {
+ const xyx = businessBankAccountOptionList.map((account) => ({
+ text: account.text,
+ description: account.description,
+ icon: account.icon,
+ iconStyles: account.iconStyles,
+ iconHeight: account.iconSize,
+ iconWidth: account.iconSize,
+ onSelected: () => {
+ if (checkForNecessaryAction()) {
+ return;
+ }
+ onPress(CONST.IOU.PAYMENT_TYPE.VBBA, true, account.methodID, CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT);
+ },
+ }))
buttonOptions.push({
text: translate('iou.settleBusiness', formattedAmount),
icon: icons.Building,
value: CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT,
- subMenuItems: businessBankAccountOptionList.map((account) => ({
- text: account.text,
- description: account.description,
- icon: account.icon,
- iconStyles: account.iconStyles,
- iconHeight: account.iconSize,
- iconWidth: account.iconSize,
- onSelected: () => {
- if (checkForNecessaryAction()) {
- return;
- }
- onPress(CONST.IOU.PAYMENT_TYPE.VBBA, true, account.methodID, CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT);
- },
- })),
+ subMenuItems: [...xyx, ...xyx, ...xyx, ...xyx, ...xyx, ...xyx, ...xyx, ...xyx, ...xyx, ...xyx],
});
}
}
Following the PRs test steps, this issue happens at step 6 which is failing (see video below).
bug-3.movCould be related to payment action not receiving the correct bank account ID from the UI selection. Important Should be resolved with the suggested fix from this comment.
Following the PRs test steps, this issue happens at steps 9-10 which are failing (see video below on issue contrast between this PR and staging).
bug-2.movNotes: Bulk Pay button not showing right side caret with options when clicked. This is because // useBulkPayOptions.ts (Line 150)
bulkPayButtonOptions.push({
text: translate('iou.settleBusiness', formattedAmount),
icon: icons.Building,
key: CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT,
subMenuItems: businessBankAccountOptionList.map(...) // <--- The Nested Items
});Notice what is missing ? There is no |
🧪 Test Coverage AnalysisAuthor's Diff Coverage Added: Checking the
@samranahm Besides the 3 bugs mentioned here which are blockers, all AI reviewer comments are also valid / blockers + a few from me found during code review. 🟢 I completed the PR Reviewer Checklist. Once all blocker issues are addressed please tag me and I'll test the PR again to verify everything works as expected 🙌 |
|
Thanks for the review @ikevin127! I’ll tag you once I’ve addressed all potential blockers and review comments. |
There was a problem hiding this comment.
Big fan of this PR! It's part of an existing product initiative, so approving. cc @joekaufmanexpensify in case you want to test more thoroughly.
|
I am interested to test. Will do that in a bit! |
|
Falling checks are not related to this PR. |
|
@samranahm, there are some comflicts |
|
@Gonals I've resolved the conflicts. |
|
More conflicts 🤣 |
|
Resolving merge conflicts |
This comment was marked as resolved.
This comment was marked as resolved.
|
@Gonals All yours |
|
🚧 @Gonals has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Gonals in version: 9.3.37-0 🚀
|
|
Deploy Blocker #85159 was identified to be related to this PR. |
No related to this PR. Issue still persist after reverting locally. |
|
Deploy Blocker #85180 was identified to be related to this PR. |
|
Deploy Blocker #85191 was identified to be related to this PR. |

Explanation of Change
Fixed Issues
$ #82853
PROPOSAL: #82853 (comment)
Tests
Prerequisites
**Test 01 - Single workspace **
Test 02 - Multiple workspaces
Prerequisites
Offline tests
QA Steps
Same as test
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android.Native.mp4
Android: mWeb Chrome
Android.mWeb.Chrome.mp4
iOS: Native
IOS.Native.mp4
iOS: mWeb Safari
IOS.mWeb.Safari.mp4
MacOS: Chrome / Safari
macOS.Chrome.mp4