Skip to content

[$175] Expense report - No cancel payment option after pay with business bank account #104535

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.15-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: #102489
Email or phone of affected tester (no customers): applausetester+dk65@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 Chrome
App Component: Money Requests

Action Performed:

Preconditions:

  • Account A invite Account B to workspace as member
  • Add a bank account to worksace: 1111
  • Add a reimbursable bank account to Account B Wallet: 0000
  1. Open https://staging.new.expensify.com/
  2. Account B submit an expense to workspace
  3. Account A approves the expense
  4. Account A pay expense with business account
  5. Account Clicks on More button

Expected Result:

There should be a cancel payment option

Actual Result:

There is no cancel payment option

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7291700_1792567720649.bandicam_2026-10-21_11-37-59-319.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7291700

Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 21, 2026
  2. applause-bot commented on Oct 21, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/9abfbd2e6543f5f7e5fe02996775ce624f34c643359231e1abab63869cf409f3

  3. changed the title [-]Expense report- No cancel payment option after pay with business bank account[/-] [+]Expense report - No cancel payment option after pay with business bank account[/+] on Oct 21, 2026
  4. MelvinBot commented on Oct 21, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause: This looks like expected behavior, not a regression. The repro pays with the staging test business bank account (1111). The backend never marks test bank account payments as cancellable, so Cancel payment stays hidden. Since Fix cancel payment showing after the NACHA cutoff has passed (merged 2026-09-21), the App shows Cancel payment for a bank-paid expense report only when the server sends canCancelReimbursement: true (ReportSecondaryActionUtils.ts:505-506).

    Recommended Fix: No App code change. Close this issue as expected behavior, or ask QA to retest with a real, verified bank account and a non-fast ACH payment. If Cancel payment is still missing in that case, the fix is on the backend, and an internal engineer needs to look into it.

    Investigation details

    Why the option is hidden

    • For expense reports, isCancelPaymentAction returns true early only for "paid elsewhere" payments (L498-503). For bank payments it relies entirely on report.canCancelReimbursement.
    • Account A is the payer, so it passes the payer check. The caller adds no other conditions (L1125-1127).
    • The pay flow never sets canCancelReimbursement (PayMoneyRequest.ts:335-391). The value comes only from the server.

    Why this is intended

    • PR Fix cancel payment showing after the NACHA cutoff has passed #97556 removed the old client-side guess (show the option before the daily ACH cutoff). That guess offered Cancel payment for payments the backend couldn't cancel, and clicking it showed "Auth CancelReimbursement returned an error".
    • The same PR flipped the unit test for "bank payment in APPROVED + REIMBURSED state" from showing the option to hiding it.
    • The PR's test steps say: with a test bank account, the backend "skips the reimbursements row… so canCancel is always false and the option stays hidden for every bank payment" (comment).
    • Fast ACH payments credit the employee right away, so they can never be cancelled, even with a real account.
    • The bug also reproduces on production. That fits a deliberate change from September, not something caused by [Payment due @huult] Hide Pay and Unapprove while a cancelled payment is processing, which doesn't touch the cancel logic.

    Possible gap to watch (separate from this report)

    • The App doesn't re-fetch the report after paying (PayMoneyRequest.ts:940-947).
    • For a real, cancellable payment, the option appears right away only if the pay response includes canCancelReimbursement. A reviewer flagged that it was missing from that response (comment). A backend change to add it was opened, but I couldn't confirm it has been deployed. If it hasn't, the payer has to reopen the report to see the option.

    Not verified: I didn't reproduce this in a browser, because the flow needs a verified business bank account and a wallet bank account.


    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 21, 2026
  6. melvin-bot commented on Oct 21, 2026

    @melvin-bot

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

  7. changed the title [-]Expense report - No cancel payment option after pay with business bank account[/-] [+][$175] Expense report - No cancel payment option after pay with business bank account[/+] on Oct 21, 2026
  8. melvin-bot commented on Oct 21, 2026

    @melvin-bot
  9. camesenin commented on Oct 21, 2026

    @camesenin
  10. melvin-bot commented on Oct 21, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  11. j3ffffff commented on Oct 21, 2026

    @j3ffffff
  12. mukhrr commented on Oct 21, 2026

    @mukhrr
    Contributor

    I think this is expected. #97556 (comment) cc @iwiznia

  13. khizzcr7 commented on Oct 21, 2026

    @khizzcr7

    Proposal

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

    After paying an expense report with a business bank account, the "Cancel payment" option no longer appears in the More menu, even though the payment is a standard ACH transfer that should be cancellable.

    What is the root cause of that problem?

    In src/libs/ReportSecondaryActionUtils.ts, isCancelPaymentAction (line 450) ends with return !!report.canCancelReimbursement; (line 506) as the final gate for bank-account payments. canCancelReimbursement is a server-sent field that was only wired through the day before this issue was filed (PR #102489). When the server omits the field for a standard ACH transfer, !!undefined evaluates to false, silently suppressing the Cancel Payment option for every such report. The comment on line 505 shows the field's real purpose: only Auth knows whether a queued/in-flight reimbursement can still be cancelled, because fast ACH posts the credit right away.

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

    Change the final gate from opt-in to opt-out, one line:

    return report.canCancelReimbursement !== false;
    

    An absent/undefined field means cancellable (the safe default for a standard ACH transfer that has not posted); only an explicit false from the server (the fast-ACH case the field was designed for) suppresses the button. The mirrored pay gate above (lines 483-487) and the paid-elsewhere branch (lines 500-503) are untouched.

    What alternative solutions did you explore?

    Backend-only fix: ensure Auth always sends canCancelReimbursement: true for standard ACH. Valid long-term, but the frontend should not break when a server field is absent - the opt-out read is robust to both.

    I will verify: reproduce the issue flow (expense submitted, approved, paid with a business bank account) and confirm the Cancel Payment option renders again; confirm it stays hidden when the server explicitly returns canCancelReimbursement: false; confirm the existing cancel-payment flow and isWaitingForCancelledReimbursement state are unchanged; and run the ReportSecondaryActionUtils unit tests.

  14. bonnhatnguyen commented on Oct 21, 2026

    @bonnhatnguyen

    Contributor details
    Your Expensify account email: bonnhatnguyen0@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0139ed4098bdc50182

    Proposal

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

    When paying an expense report using a business bank account, clicking the "More" overflow menu on the report immediately after payment does not display the "Cancel payment" option.

    What is the root cause of that problem?

    1. In src/libs/ReportSecondaryActionUtils.ts:494-508:
      isCancelPaymentAction checks whether a report payment can be cancelled:
    const isPaidViaBankAccount = !!latestPaymentType && latestPaymentType !== CONST.IOU.PAYMENT_TYPE.ELSEWHERE;
    
    if (report.stateNum === CONST.REPORT.STATE_NUM.APPROVED && report.statusNum === CONST.REPORT.STATUS_NUM.REIMBURSED && !isPaidViaBankAccount) {
        return true;
    }
    
    return !!report.canCancelReimbursement;

    For business bank account payments (VBBA), isPaidViaBankAccount is true. The check therefore falls through to report.canCancelReimbursement.
    2. In src/libs/actions/IOU/PayMoneyRequest.ts:334-354:
    When payMoneyRequest executes, optimisticData merges:

    value: {
        statusNum: CONST.REPORT.STATUS_NUM.REIMBURSED,
        stateNum: CONST.REPORT.STATE_NUM.APPROVED,
        ...
    }

    However, it omits canCancelReimbursement: true for bank payments (paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA).
    Because canCancelReimbursement is not optimistically set to true, report.canCancelReimbursement evaluates to false/undefined in isCancelPaymentAction, hiding the "Cancel payment" option from the overflow menu.

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

    In src/libs/actions/IOU/PayMoneyRequest.ts:337:
    Include canCancelReimbursement: isPaidViaBankAccount (or paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA) in the optimistic report update:

    value: {
        lastMessageText: getReportActionText(optimisticIOUReportAction),
        lastMessageHtml: getReportActionHtml(optimisticIOUReportAction),
        lastVisibleActionCreated: optimisticIOUReportAction.created,
        hasOutstandingChildRequest: false,
        statusNum: CONST.REPORT.STATUS_NUM.REIMBURSED,
        stateNum: CONST.REPORT.STATE_NUM.APPROVED,
        canCancelReimbursement: paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA,
        pendingFields: {
            ...

    This ensures that immediately upon initiating a business bank account payment, the report state reflects that the reimbursement is pending and can be cancelled before settlement.

    What alternative solutions did you explore? (Optional)

    • Deriving bank payment cancellation solely from isProcessingReport: Rejected because canCancelReimbursement is the single source of truth across both optimistic states and backend responses for ACH reimbursement cancellation.

    Testing

    1. In a workspace with an active business bank account, approve a member's submitted expense report.
    2. Pay the expense report using the business bank account.
    3. Click on the "More" overflow menu in the report header.
    4. Verify that the "Cancel payment" option is visible and selectable.
    5. Click "Cancel payment" and verify the cancellation modal prompts and cancels the pending reimbursement.
  15. melvin-bot commented on Oct 21, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  16. iwiznia commented on Oct 21, 2026

    @iwiznia
    Contributor

    I think this is expected. #97556 (comment) cc @iwiznia

    @mukhrr it depends on the dates the reimbursement was started and tried to cancel, no? Or was this due to the fake reimbursements never being able to be cancelled?

  17. mukhrr commented on Oct 22, 2026

    @mukhrr
    Contributor

    18. > I think this is expected. #97556 (comment) cc @iwiznia

     [@mukhrr](https://github.com/mukhrr) it depends on the dates the reimbursement was started and tried to cancel, no? Or was this due to the fake reimbursements never being able to be cancelled?
    

    @iwiznia it's fake reimbursement case. seems the same with this

  18. Abdallah-1551 commented on Oct 22, 2026

    @Abdallah-1551

    Proposal

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

    QA paid an approved expense report from a workspace with a business bank account (1111) to a member's reimbursable wallet bank account (0000) on staging. Afterward, the report's "More" menu has no "Cancel payment" option. QA expected the option to appear. We need to decide whether this is a real regression, and what, if anything, to change.

    What is the root cause of that problem?

    This is most likely expected behavior, not an App regression.

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

    No App code change is needed for the reported scenario. Recommended actions:

    1. Close the issue as expected behavior. Add a note for QA that Cancel payment is not available for test or fake bank account reimbursements.
    2. Update the QA test case (the regression test linked from PR [Payment due @huult] Hide Pay and Unapprove while a cancelled payment is processing #102489) to use a real, verified business bank account and a non-fast ACH payment, if the case is meant to verify cancelling.
    3. Optional follow-up for a real, cancellable payment. PayMoneyRequest.ts (around lines 940-947) does not re-fetch the report after paying. If the PayMoneyRequest response lacks canCancelReimbursement, the payer must reopen the report to see the option.
      • Confirm with the backend team (@iwiznia) that the pay response, or a follow-up Onyx update, includes canCancelReimbursement.
      • If it does not, fix it on the backend by adding the field to the response. As a fallback, call openReport or a report refresh after a successful bank payment.
      • Do not set the field optimistically on the client, because the client cannot know whether Auth will allow cancellation.
    4. Keep the existing unit test in tests/unit/ReportSecondaryActionUtilsTest.ts. It asserts that a bank payment in APPROVED + REIMBURSED state without canCancelReimbursement: true hides the option. Optionally add a test that canCancelReimbursement: true shows it.

    What alternative solutions did you explore? (Optional)

    Testing

    1. Reproduce the issue steps with the staging test bank account. Confirm Cancel payment stays hidden, which is the expected outcome.
    2. With a real verified business bank account and a standard (non-fast) ACH reimbursement, pay an approved report. Confirm the server sends canCancelReimbursement: true, and that Cancel payment appears in More, immediately or after reopening the report.
    3. If a pay-response or re-fetch fix is made, verify the option appears right after paying without reopening the report.
    4. Confirm that cancelling puts the report in the "waiting for cancelled reimbursement" state, with Pay and Unapprove hidden as in PR [Payment due @huult] Hide Pay and Unapprove while a cancelled payment is processing #102489.
    5. Run npm test -- ReportSecondaryActionUtilsTest to confirm the unit tests pass.
  19. melvin-bot commented on Oct 22, 2026

    @melvin-bot

    📣 @Abdallah-1551! 📣
    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>
    
  20. iwiznia commented on Oct 22, 2026

    @iwiznia
    Contributor

    @iwiznia it's fake reimbursement case. seems the same with #97556 (comment)

    Ah ok then we can close

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions