[Payment due @daledah] [No QA] Report managed card transactions to employee's default policy#94768
Conversation
…ses as source of truth
…y policyID to backend
|
@marcochavezf 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] |
|
Does this need C+ review? |
| const policyForMovingExpenses = policyForMovingExpensesID ? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyForMovingExpensesID}`] : undefined; | ||
| const [betas] = useOnyx(ONYXKEYS.BETAS); | ||
| const [transactions] = useTransactionsByID(transactionIDs); | ||
| const hasUnreportedManagedCardTransactions = transactions.some((transaction) => isExpenseUnreported(transaction) && isManagedCardTransaction(transaction)); |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The predicate isExpenseUnreported(transaction) && isManagedCardTransaction(transaction) is duplicated here and in SearchTransactionsChangeReport.tsx and IOURequestStepReport.tsx. Consolidate this single concept into one util so it stays consistent.
Add isUnreportedManagedCardTransaction(transaction) to TransactionUtils and reuse it:
const hasUnreportedManagedCardTransactions = transactions.some(isUnreportedManagedCardTransaction);Reviewed at: e280d03 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e280d034aa
ℹ️ 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: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
The code looks good overall, and I don't see any issues. @s77rt how can I create an |
|
@daledah Not really sure, can you please ask in Slack cc @DylanDylann in case you have some link to share as you tested #76000 |
|
@daledah can you try the following?
|
|
thanks @luacmartins, i have |
|
@s77rt could you please resolve conflict? and I'm having trouble with this branch, error: dev.movOn staging, I'm able to create a report, and the new report is created in the employee workspace. staging.mov |
Nice! Glad it worked |
|
@daledah Thanks for testing! So when I tested this I tested it on a private domain and that worked ( Not really sure how to handle this but can you test on OD too? (in OD there are two options to report unreported transaction, either by creating a new report or use the auto-report option) |
web.mov@s77rt I tested it on OD as well with a public domain
|
|
@daledah Thanks for testing. The I'm checking this now... |
|
Okay I don't have a good solution for this yet. I can update the CreateReport API to accept another parameter @luacmartins Do you think we can proceed here and handle the case where admin/employee are on different domains? That case is broken on OD too |
|
I think we can proceed if both conditions below are true:
It seems like that's the case, but I just want to make sure before we continue here. |
|
Yeah it's the case, just wanted to get this unblocked so we can keep making progress |
|
Cool, in that case, let's continue with review @daledah |
|
🎯 @daledah, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
🚧 luacmartins has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.32-0 🚀
|
|
🤖 I reviewed the changes and checked the help site articles under Conclusion: No help site changes are required. The existing documentation already describes the exact behavior this PR enforces, so no draft PR was created. This PR is a bug fix: when a Workspace Admin reports an employee's unreported managed card transaction, the code now omits the The article that documents this flow — Create and Submit Reports — already states the correct, post-fix behavior:
This is a case of the code catching up to already-accurate docs, not a doc-impacting behavior change. I also confirmed there is no contradicting statement elsewhere (e.g. Since no articles needed updating, there is no linked help site PR to review, label (
|
|
🚀 Deployed to production by https://github.com/grgia in version: 9.4.32-3 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Payment issue created: #95816 |
Explanation of Change
Modified the
usePolicyForMovingExpenseshook that we use to select the targetpolicyIDwhen moving expenses, if we are moving an unreported managed card transaction then it should be moved to the employee's default policy (and not ours) and since we don't know that info, we will returnundefinedand this will omit sending thepolicyIDto the backend.In the backend, when no explicit
policyIDis provided, it will automatically find and use the preferred policy.Fixed Issues
#87954
PROPOSAL:
Tests
companydomain.comCreate reportoption does not display any workspace name under it i.e. no supporting textScreen.Recording.2026-06-27.at.11.46.24.AM.mov
Offline tests
n/a
QA Steps
n/a
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari