Skip to content

[$250] Reports - Pay with business account is shown when bulk paying negative expense #75655

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.2.61-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #72936
Email or phone of affected tester (no customers): sdoidjnodsjoidjso@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Search

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with negative amount.
  4. Open expense report.
  5. Click Submit and Approve.
    → Mark as paid button is shown without Pay with business account button - Expected.
  6. Go to Reports > Reports.
  7. Select the report with negative expense via checkbox.
  8. Click dropdown button > Pay.

Expected Result:

Pay with business account button should not show up for negative expense.

Actual Result:

Pay with business account button is shown for negative expense when bulk paying.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug7009046_1763628026932.8.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021993077525363528392
  • Upwork Job ID: 1993077525363528392
  • Last Price Increase: 2025-12-01
Issue OwnerCurrent Issue Owner: @RachCHopkins

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 20, 2025
  2. melvin-bot commented on Nov 20, 2025

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (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.

  3. melvin-bot commented on Nov 20, 2025

    @melvin-bot

    📣 @moneymaker-100xo4! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  4. abbasifaizan70 commented on Nov 20, 2025

    @abbasifaizan70
    Contributor

    Proposal:

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

    When bulk paying reports from the Reports page, the "Pay with business account" button incorrectly appears for reports containing negative expenses. However, when paying a negative expense individually from the expense report page, the button correctly does not appear (only "Mark as paid" is shown).

    What is the root cause of that problem?

    The root cause is in the useBulkPayOptions hook at line 73. The hook determines whether to show business bank account payment options based on whether it's an expense report and not a personal-only option, but it does not check if the expense has a negative reimbursable spend amount.

    The issue occurs because:

    1. Missing negative expense check: The shouldShowBusinessBankAccountOptions variable at line 73 is calculated as isExpenseReport && !isPersonalOnlyOption, which doesn't account for negative expenses. This is different from the individual payment flow in SettlementButton component, which correctly handles negative expenses through the canIOUBePaid function.

    2. Inconsistent logic with individual payment: In the individual payment flow, the canIOUBePaid function in src/libs/actions/IOU.ts at line 10182 checks for negative expenses: const canShowMarkedAsPaidForNegativeAmount = onlyShowPayElsewhere && reimbursableSpend < 0;. This ensures that when reimbursableSpend < 0, only the "Pay elsewhere" (Mark as paid) option is shown, not the business bank account option.

    3. Business bank account option added unconditionally: At line 137-139 and line 152-154, the business bank account payment method is added to the button options when shouldShowBusinessBankAccountOptions is true, without checking if the expense has a negative amount.

    4. Missing reimbursable spend calculation: The hook doesn't calculate the reimbursableSpend using getMoneyRequestSpendBreakdown function from src/libs/ReportUtils.ts at line 4174, which is needed to determine if the expense is negative.

    When a report has a negative reimbursable spend, it represents a credit or refund scenario where the company owes the employee money, not the other way around. In such cases, the business bank account payment option should not be available because you cannot "pay" a negative amount using a business account - you can only mark it as paid elsewhere.

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

    File: src/hooks/useBulkPayOptions.ts

    Code Changes:

    --- a/src/hooks/useBulkPayOptions.ts
    +++ b/src/hooks/useBulkPayOptions.ts
    @@ -9,6 +9,7 @@ import {formatPaymentMethods} from '@libs/PaymentUtils';
     import {hasRequestFromCurrentAccount} from '@libs/ReportActionsUtils';
     import {
         getBankAccountRoute,
    +    getMoneyRequestSpendBreakdown,
         isExpenseReport as isExpenseReportUtil,
         isIndividualInvoiceRoom as isIndividualInvoiceRoomUtil,
         isInvoiceReport as isInvoiceReportUtil,
    @@ -70,7 +71,10 @@ function useBulkPayOptions({
         const canUseBusinessBankAccount = isExpenseReport || (isIOUReport && selectedReportID && !hasRequestFromCurrentAccount(selectedReportID, accountID ?? CONST.DEFAULT_NUMBER_ID));
         const canUsePersonalBankAccount = isIOUReport;
         const isPersonalOnlyOption = canUsePersonalBankAccount && !canUseBusinessBankAccount;
    -    const shouldShowBusinessBankAccountOptions = isExpenseReport && !isPersonalOnlyOption;
    +    const {reimbursableSpend} = getMoneyRequestSpendBreakdown(iouReport);
    +    const hasNegativeExpense = isExpenseReport && reimbursableSpend < 0;
    +    const shouldShowBusinessBankAccountOptions = isExpenseReport && !isPersonalOnlyOption && !hasNegativeExpense;
         const formattedPaymentMethods = formatPaymentMethods(bankAccountList ?? {}, fundList ?? {}, styles, translate);
         const canUseWallet = !isExpenseReport && !isInvoiceReport && isCurrencySupportedWallet;
         const hasSinglePolicy = !isExpenseReport && activeAdminPolicies.length === 1;
    @@ -149,7 +153,7 @@ function useBulkPayOptions({
                     buttonOptions.push(paymentMethods[CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT]);
                 }
     
    -            if (activeAdminPolicies.length === 0 && !isPersonalOnlyOption) {
    +            if (activeAdminPolicies.length === 0 && !isPersonalOnlyOption && !hasNegativeExpense) {
                     buttonOptions.push(paymentMethods[CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT]);
                 }
             }
    @@ -215,6 +219,8 @@ function useBulkPayOptions({
             chatReport,
             getPaymentSubitems,
             formattedAmount,
    +        hasNegativeExpense,
    +        iouReport,
         ]);
     
         return {

    What alternative solutions did you explore? (Optional)

    N/A

  5. nkdengineer commented on Nov 21, 2025

    @nkdengineer
    Contributor

    Proposal

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

    Pay with business account button is shown for negative expense when bulk paying.

    What is the root cause of that problem?

    useBulkPayOptions doesn't return only Mark as paid option if onlyShowPayElsewhere is true like we did for usePaymentOptions

    const bulkPayButtonOptions = useMemo(() => {

    if (onlyShowPayElsewhere) {
    return [paymentMethods[CONST.IOU.PAYMENT_TYPE.ELSEWHERE]];
    }

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

    We should add onlyShowPayElsewhere check to useBulkPayOptions like we did here, here

    const onlyShowPayElsewhere = canIOUBePaid(iouReport, chatReport, policy, undefined, true);
    if (onlyShowPayElsewhere) {
                return [paymentMethods[CONST.IOU.PAYMENT_TYPE.ELSEWHERE]];
            }
    

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  6. RachCHopkins commented on Nov 24, 2025

    @RachCHopkins
    Contributor

    Cool, can repro. Confirming a reimbursable credit should not have a payment via bank account option, only mark as paid.

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 24, 2025
  8. changed the title [-]Reports - Pay with business account is shown when bulk paying negative expense[/-] [+][$250] Reports - Pay with business account is shown when bulk paying negative expense[/+] on Nov 24, 2025
  9. melvin-bot commented on Nov 24, 2025

    @melvin-bot
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 24, 2025
  11. 16 remaining items

  12. nkdengineer commented on Jan 12, 2026

    @nkdengineer
    Contributor

    @RachCHopkins The automation failed, please handle the payment.

  13. hoangzinh commented on Jan 12, 2026

    @hoangzinh
    Contributor

    BugZero Checklist:

    Regression Test Proposal

    Test:

    1. Go to workspace chat.
    2. Create an expense with negative amount.
    3. Open that expense report.
    4. Click Submit and Approve.
    5. Go to Reports > Reports.
    6. Select the report with negative expense via checkbox.
    7. Click dropdown button > Pay.
    8. Verify that only Mark as paid option is shown

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-ec08-a796-0ae5-43aa1df15754
  14. melvin-bot commented on Jan 17, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. @hoangzinh, @Julesssss, @RachCHopkins, @nkdengineer 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!

  15. hoangzinh commented on Jan 18, 2026

    @hoangzinh
    Contributor

    @RachCHopkins this issue is ready for payment

  16. melvin-bot commented on Feb 3, 2026

    @melvin-bot

    @hoangzinh 10 days overdue. Is anyone even seeing these? Hello?

  17. hoangzinh commented on Feb 4, 2026

    @hoangzinh
    Contributor
  18. RachCHopkins commented on Feb 4, 2026

    @RachCHopkins
    Contributor

    Payment Summary:

    • Contributor: @nkdengineer to be paid $250 via NewDot manual request
    • Contributor+: @hoangzinh o be paid $250 via NewDot manual request

    Upwork job here

  19. RachCHopkins commented on Feb 4, 2026

    @RachCHopkins
    Contributor

    No one to pay via Upwork, and the Upwork post has been closed.

    🟢 to request payment.

  20. garrettmknight commented on Feb 10, 2026

    @garrettmknight
    Contributor

    $250 approved for @hoangzinh

  21. twisterdotcom commented on Feb 25, 2026

    @twisterdotcom
    Contributor

    @nkdengineer has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-7b8a-ac5e-be2d-713118c9ca54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions