Repository navigation
Description
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: v9.0.99-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: None
Email or phone of affected tester (no customers): tom+vbbaod2nd@trj.chat
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL: None
Issue reported by: @trjExpensify
Slack conversation (hyperlinked to channel name): None, found when I was testing something else.
Action Performed:
Prerequisites:
- USD workspace with ACH reimbursement enabled
- Admin is the workspace's payer, add one more normal member to the workspace.
- Both payer and submitter haven't added a personal bank account yet.
- As the payer, create an expense > submit it to the workspace
- Approve it
- Click "Pay with Expensify"
- Click the report header
- Observe there's no "Cancel payment" button and the
Unapprovebutton shows. - Go to OldDot (use Settings > Domains as a shortcut) > Reports > click into the report
- Observe there's no
Unapprovebutton showing on the report in OldDot - Click "Cancel reimbursement" on the top of the report
- Switch back to NewDot > refresh
- Observe the incorrect
canceledRequestsystem message is added to the report:canceled the $0.00 payment, because tom+vbbaod2nd@trj.chat did not enable their Expensify Wallet within 30 days - As the normal member submitter on the workspace, create an expense and submit it.
- As the payer, repeat steps 2-10 and observe the same outcomes.
Expected Result:
- The Cancel payment button should be shown to the workspace's payer up until the ACH cut off time for the day (@Gonals that logic for the cut off should be derived from the BE already I take it?)
- The
Unapprovebutton shouldn't show on a report that is queued for reimbursement via ACH (as the payment hasn't been canceled yet). - The
adminCanceledRequestsystem message should be shown when canceling payments on a workspace.
Actual Result:
- No Cancel Payment button in the report details screen.
Unapprovebutton incorrectly shows on a report that's queued to be reimbursed via ACH.- Incorrect system message is added to the report after taking the action in OldDot.
Workaround:
You can use OldDot to action on canceling the payment at least.
Platforms:
Which of our officially supported platforms is this issue occurring on?
- Android: Standalone
- Android: HybridApp
- Android: mWeb Chrome
- iOS: Standalone
- iOS: HybridApp
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- MacOS: Desktop
Screenshots/Videos
2025-02-18_01-54-48.mp4
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021891677107780037168
- Upwork Job ID: 1891677107780037168
- Last Price Increase: 2025-02-25
Issue Owner
Current Issue Owner: @trjExpensifyMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Feb 18, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021891677107780037168
[-]Unapprove button is showing instead of Cancel payment button on reports queued for ACH reimbursement (and incorrect sys message when actioned on from OldDot)[/-][+][$250] Unapprove button is showing instead of Cancel payment button on reports queued for ACH reimbursement (and incorrect sys message when actioned on from OldDot)[/+]melvin-bot commentedon Feb 18, 2025
Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new.
melvin-bot commentedon Feb 18, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-d (
External)trjExpensify commentedon Feb 18, 2025
CC'ing @Gonals for vis here, as I believe you worked on the initial implementation of
Cancel payment~1 year ago. This has regressed pretty badly it seems.NJ-2020 commentedon Feb 18, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Unapprove button is showing instead of Cancel payment button on reports queued for ACH reimbursement (and incorrect sys message when actioned on from OldDot)
What is the root cause of that problem?
The cancel payment will be shown based on this condition
App/src/pages/ReportDetailsPage.tsx
Line 380 in 1eb00b0
The
isSettledfunction is returning false because we're returning false ifisWaitingOnBankAccountis trueApp/src/pages/ReportDetailsPage.tsx
Line 378 in 1eb00b0
App/src/libs/ReportUtils.ts
Lines 1256 to 1276 in 1eb00b0
The
Unapproveoption is displayed because we're not checking here if the money report is settled or not or specificallyreport.statusNum !== CONST.REPORT.STATUS_NUM.REIMBURSEDApp/src/pages/ReportDetailsPage.tsx
Line 307 in 1eb00b0
For the report action message saying
canceled the $0.00 paymentit's BE issue, because the BE doesn't return any amount or currency inside reportAction originalMessage/messageSo when we're getting right here it will return null or
$0.00App/src/libs/ReportUtils.ts
Lines 2927 to 2936 in 1eb00b0
What changes do you think we should make in order to solve the problem?
isSettledwe can check if the statusNum is reimbursed, so it will be:App/src/libs/ReportUtils.ts
Lines 1265 to 1267 in 1eb00b0
Note
If we change the isSettled function inside the ReportUtils to return true even if

isWaitingOnBankAccountit will cause many bugs/issues as shown in this pictureUnapproveoption, we need to check if the money report is not settled or the money report status num is not equal to reimbursedcanceled the $0.00 payment, I think we should fix this in the BE side because if we use this FE solution by using thereport?.totaland then use thegetMoneyRequestSpendBreakdownto get the totalDisplaySpend, the report action message will appear correctly but when we Unapprove the report, the report.total value is gone, and the report action message become incorrect againWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We should create unit test function to cover this cases
isWaitingOnBankAccountis trueUnapproveoption we can use the ReportDetailsPage testID and make sure it doesn't contain any Unapprove option textcanceled the $0.00 payment, we need to check thegetReimbursementDeQueuedActionMessageto return the correct messageWhat alternative solutions did you explore? (Optional)
bernhardoj commentedon Feb 18, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-02-24 03:36:31 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When paying an expense with a pending bank account, unapprove is shown instead of cancel payment.
What is the root cause of that problem?
When we are waiting for bank account, the report status is APPROVED. The cancel payment will show if the report is settled. In
isSettledfunction, we already have a logic to return true if the status is APPROVED and is currently waiting for bank account.App/src/pages/ReportDetailsPage.tsx
Line 380 in 0b6d1a0
App/src/libs/ReportUtils.ts
Lines 1265 to 1273 in 011fd6c
However, the logic is never reached because we return false if
isWaitingOnBankAccountis true, so the cancel payment is not shown. On the other hand, since the status is APPROVED,isReportApprovedis true, so the unapprove button is shown.App/src/pages/ReportDetailsPage.tsx
Line 307 in 0b6d1a0
App/src/libs/ReportUtils.ts
Lines 1213 to 1217 in 011fd6c
What changes do you think we should make in order to solve the problem?
First of all, this logic shouldn't be put inside the
isSettledfunction becauseisSettledis currently used to check whether the report is completely paid or not. But the condition is never true, so it never causes an issue, so we can just remove it too.App/src/libs/ReportUtils.ts
Lines 1269 to 1273 in 0b6d1a0
To fix this issue, we need to update
shouldShowCancelPaymentButtonso it returns true if the report is either settled or waiting on bank account.App/src/pages/ReportDetailsPage.tsx
Line 380 in 0b6d1a0
This is consistent with other parts of the app.
App/src/components/ReportActionItem/ReportPreview.tsx
Lines 389 to 390 in 0b6d1a0
App/src/libs/ReportUtils.ts
Lines 3993 to 3994 in 0b6d1a0
Second, we need to update
canUnapproveRequestso it returns false if we are waiting for bank account.App/src/pages/ReportDetailsPage.tsx
Line 307 in 0b6d1a0
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
To be able to test it, we can move
canUnapproveRequestandshouldShowCancelPaymentButtonto a util function and test both functions.melvin-bot commentedon Feb 21, 2025
@trjExpensify, @rayane-d Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
22 remaining items
melvin-bot commentedon Mar 6, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.9-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-03-13. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Mar 6, 2025
@rayane-d @trjExpensify @rayane-d The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
rayane-d commentedon Mar 7, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/34719/files#r1985359043
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
trjExpensify commentedon Mar 13, 2025
Nice one, regression test created. Payment summary as follows:
Go ahead and request. Closing, thanks!
bernhardoj commentedon Mar 13, 2025
Requested in ND.
JmillsExpensify commentedon Mar 17, 2025
$250 approved for @bernhardoj
rayane-d commentedon Mar 18, 2025
Requested in ND
garrettmknight commentedon Mar 24, 2025
$250 approved for @rayane-d