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: 9.3.70-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: https://test-management.browserstack.com/projects/2219752/folder/13176725/test-cases/41237082
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: MacBook Air 15.7.4 Chrome
App Component: Notifications
Action Performed:
Preconditions:
User A and User B have wallet enabled and positive balance
User B is logged out
User B's email can be accessed
- As user A, navigate to the chat with User B
- Send a message to user B
- Click on the + button in the compose box, select "Pay User B"
- Enter the amount, select "Pay with Wallet"
- Open the emails in User B's Inbox
Verify the other email is be a receipt that has a IOU preview at the top and should also have a footer that includes more detailed transaction information and a list of legal disclosures
Expected Result:
The email with the subject "User A paid User B" includes more detailed transaction information and a list of legal disclosures
The email with the subject "Chat with User A" User A's payment preview is not shown as an expense, sent by User B
Actual Result:
The email with the subject "User A paid User B" doesn't include detailed transaction information and a list of legal disclosures
The email with the subject "Chat with User A" User A's payment preview is shown as an expense, sent by User B
In Prod: 1st issue is the same, 2nd issue - "Chat" email is not received
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Video.mp4
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022054157174317289380
- Upwork Job ID: 2054157174317289380
- Last Price Increase: 2026-05-12
Issue Owner
Current Issue Owner: @KioCoanMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
MelvinBot commentedon May 12, 2026
Proposal
Problem: Two issues with P2P payment notification emails:
Root Cause: This appears to be a backend/internal issue. A separate internal investigation is needed.
The App frontend triggers payments via API commands (
PayMoneyRequest,PayMoneyRequestWithWallet,SendMoneyElsewhere,SendMoneyWithWallet) and sends only transaction data (amount, currency, reportIDs, payment method). It contains no email template code or email content logic — all payment notification email rendering, including transaction detail formatting and legal disclosure inclusion, is handled entirely server-side.Recommended Fix: The fix needs to be applied to the backend email generation and templating system, not in the App repo. Specifically:
Next Steps: Reply with
@MelvinBot <your feedback>to refine this analysis.David-2002065 commentedon May 12, 2026
Proposal
What is the root cause of that problem?
I traced the P2P "Pay with Wallet" path end-to-end on the App side and the two defects described in this issue are not produced by anything
Expensify/Appwrites to Onyx or ships to the server. Both come out of the server-side email-rendering layer.1. The payload
sendMoneyWithWalletactually sends. The+ → Pay → Pay with Walletflow lands insendMoneyWithWallet, which fires a single API command —SEND_MONEY_WITH_WALLET— with theparamsreturned bygetSendMoneyParams:App/src/libs/actions/IOU/SendMoney.ts
Lines 530 to 560 in cfeaadd
The parameter type for that command is intentionally narrow — IDs + a small JSON details blob, nothing else:
App/src/libs/API/parameters/SendMoneyParams.ts
Lines 6 to 20 in cfeaadd
There is no rendered HTML, no receipt footer copy, no legal-disclosure text, and no chat-preview body in this payload. The
newIOUReportDetailsJSON is just{amount, currency, requestorEmail, requestorAccountID, comment, idempotencyKey, created?, merchant?}— built atApp/src/libs/actions/IOU/SendMoney.ts
Lines 91 to 103 in cfeaadd
paymentMethodType === EXPENSIFY).2. The optimistic IOU report and report-preview action NewDot writes locally are correct. I want to rule out the possibility that the App is mis-attributing the actor and that mis-attribution is leaking into the email.
buildOptimisticIOUReportsetsmanagerID = payerAccountID(User A, the payer) andownerAccountID = payeeAccountID(User B, the payee):App/src/libs/ReportUtils.ts
Lines 6553 to 6560 in cfeaadd
buildOptimisticReportPreviewthen computes the preview actor by branching on report type — for a P2P IOU (not invoice, not expense report) it returnsiouReport?.managerID, i.e., User A. That value is then assigned to bothactorAccountIDandaccountIDon theREPORT_PREVIEWaction:App/src/libs/ReportUtils.ts
Lines 7492 to 7522 in cfeaadd
So the
REPORT_PREVIEWaction that gets sent up hasactorAccountID = User AandaccountID = User A— which is what the chat-notification email should label the preview by. The "an expense, sent by User B" rendering inverts this; the App is not the source of that inversion.3. Optimistic chat text written to Onyx is just the local chat message, not email body.
lastMessageText/lastMessageHtmlon the IOU report are set from the IOU report action's message ("sent $X.XX with Expensify") atApp/src/libs/actions/IOU/SendMoney.ts
Lines 183 to 194 in cfeaadd
Conclusion. Both defects are server-side rendering bugs in Web-Expensify:
User A paid User Breceipt template underSEND_MONEY_WITH_WALLETis omitting the transaction-detail block (amount, currency, date, merchant, comment, transaction ID) and the wallet-payment legal-disclosure footer, despite the payload providing every field needed.Chat with User Anotification composer is reading the wrong field on the IOUREPORT_PREVIEWaction — likelyownerAccountID(User B) instead ofactorAccountID/managerID(User A) — and labelling the preview as an expense from the payee.What changes do you think we should make in order to solve the problem?
No code change in
Expensify/Appis required. The fix belongs in the server-side email-rendering layer (Web-Expensify):User A paid User B): restore the transaction-details block and the legal-disclosures footer for theSEND_MONEY_WITH_WALLETpath. Every field needed is already innewIOUReportDetails+ the persisted IOU report.Chat with User A): for aREPORT_PREVIEWaction linked to a P2P IOU report (i.e., not invoice, not expense report), render the preview body fromactorAccountID/managerID(the payer) rather thanownerAccountID(the payee). The App already writes the correct actor on the action.I'd route this to the backend/email team. I'm happy to capture the exact
SEND_MONEY_WITH_WALLETrequest payload and the resultingREPORT_PREVIEWaction JSON from a fresh repro and attach them here if that speeds the backend investigation.What alternative solutions did you explore? (Optional)
lastMessageHtmlleak into the email body? No — the email is composed by the server from canonical report/action state after the write completes, and the optimisticlastMessageHtmlwritten atApp/src/libs/actions/IOU/SendMoney.ts
Lines 183 to 194 in cfeaadd
lastMessageHtmldoesn't contain anyway).ownerAccountID/managerIDon the optimistic IOU report so the backend's current reader produces the right actor? Rejected — that field assignment matches OldDot forSendMoney(payer = manager, payee = owner) and is consumed by many other call sites (report rendering, balance computation, settlement). Inverting it to paper over an email bug would regress everything else. The correct field for "actor of the preview" already exists on the action (actorAccountID); the backend should read that.yusufdeveloper2903 commentedon May 12, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-12 11:14:13 UTC.
Proposal
What is the root cause of that problem?
I traced the full P2P "Pay with Wallet" path on the App side and the email content described in this issue isn't produced by anything NewDot sends.
The user takes the
+ → Pay → Pay with Walletflow, which hitssendMoneyWithWalletand writes a single API command:App/src/libs/actions/IOU/SendMoney.ts
Lines 530 to 560 in 3a13517
The payload shape for that command is just IDs + a small JSON details blob — there is no rendered HTML, no receipt footer, no legal-disclosure copy, and no chat-preview body in it:
App/src/libs/API/parameters/SendMoneyParams.ts
Lines 6 to 21 in 3a13517
The optimistic IOU report and the report-preview action that NewDot writes locally also look correct for User A paying User B:
buildOptimisticIOUReportsetsmanagerID = payerAccountID(User A) andownerAccountID = payeeAccountID(User B):App/src/libs/ReportUtils.ts
Lines 6554 to 6577 in 3a13517
buildOptimisticReportPreviewthen setsreportActorAccountID = iouReport.managerIDfor a P2P (non-invoice/expense) IOU — i.e., User A is the actor of the preview, which matches expected behavior:App/src/libs/ReportUtils.ts
Lines 7479 to 7528 in 3a13517
Both observed defects — (1) the
User A paid User Breceipt missing the detailed transaction block and the legal-disclosure footer, and (2) theChat with User Anotification rendering the IOU preview as "an expense, sent by User B" — are produced by the email-composition layer on the server (Web-Expensify), which builds the receipt template and the chat-notification body from canonical report state at send time. None of that text originates in or is forwarded throughSEND_MONEY_WITH_WALLET.What changes do you think we should make in order to solve the problem?
No code change in
Expensify/Appis required for this regression. The fix belongs in the email-rendering layer on the backend:User A paid User B) — the transaction-details block and the legal-disclosures footer need to be restored for theSEND_MONEY_WITH_WALLETpath.Chat with User A) — forREPORT_PREVIEWactions linked to a P2P IOU report, the rendered body is inverting actor/recipient and labelling the preview as an expense from the receiver.I'd recommend routing this to the backend/email team. I'm happy to capture the exact
SEND_MONEY_WITH_WALLETpayload from a fresh repro and attach it here if that speeds the backend investigation.What alternative solutions did you explore? (Optional)
I considered whether NewDot's optimistic data could leak into the email content (e.g., via
lastMessageHtmlon the chat report being read by the email service), but the email is composed from the canonical IOU/chat state on the server after the write completes, and the optimisticlastMessageHtml/lastMessageTextwritten here is the same as what OldDot would produce:App/src/libs/actions/IOU/SendMoney.ts
Lines 183 to 194 in 3a13517
melvin-bot commentedon May 12, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (
External)[-]P2P - Transaction details and legal disclosures are missing in the payment email[/-][+][$250] P2P - Transaction details and legal disclosures are missing in the payment email[/+]melvin-bot commentedon May 12, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022054157174317289380
Abdulloh0109 commentedon May 12, 2026
Proposal
What is the root cause of that problem?
This bug has two halves; the App repo is responsible for only one of them.
Half 1 — "User A paid User B" receipt email is missing transaction details and legal disclosures. That email is rendered server-side by the backend (Web-Expensify / Mobile-Expensify email templates). The App repo is a React Native client and does not generate the HTML body, the footer, or the legal/disclosure block of receipt emails. No frontend code in
Expensify/Appcontrols the email layout or what gets stitched into its footer — that template lives outside this repo.Half 2 — In the "Chat with User A" email, the embedded payment preview is shown "as an expense, sent by User B". This half is influenced by the App repo because the optimistic data the App sends to the backend determines the shape of the
REPORT_PREVIEWaction that the email renderer later embeds.Tracing the P2P-wallet flow:
getSendMoneyParamsinsrc/libs/actions/IOU/SendMoney.ts:115callsbuildOptimisticIOUReport(recipientAccountID, managerID, ...). Looking at the function signature insrc/libs/ReportUtils.ts:6543-6572, the first arg becomesownerAccountIDand the second becomesmanagerID. For the send flow the values resolve toownerAccountID = User B (the recipient)andmanagerID = User A (the sender).buildOptimisticReportPreviewis then called insrc/libs/actions/IOU/SendMoney.ts:149. Inside that builder,src/libs/ReportUtils.ts:7505computes the report-preview actor by branching onisInvoiceReport/isExpenseReport: for an IOU it returnsiouReport?.managerID. The adjacentaccountIDon line 7528 is also set frommanagerID, andchildOwnerAccountID/childManagerAccountIDon lines 7537–7538 are copied straight from the IOU report. The backend email template renders the embedded preview by readingchildOwnerAccountID(= User B), interprets it as "the submitter of the expense", and labels the preview "an expense, sent by User B". The discrepancy: for a P2P SEND, the IOU report'sownerAccountIDis the recipient of the money rather than the originator of the action, so any consumer that treatschildOwnerAccountIDas "actor" inverts the perspective.What changes do you think we should make in order to solve the problem?
Two-part fix, with explicit acknowledgment that only part B is in this repo:
(A) Backend, NOT in this repo: Add the detailed transaction info + legal disclosures footer to the P2P receipt email template, and fix the production delivery of the "Chat with User A" email. These live in
Web-Expensify/Mobile-Expensifyemail templates and SMTP/delivery infra. A C+ on this issue should hand part A to the Notifications team. I am not proposing a change to email-template source here because it does not exist inExpensify/App.(B) In this repo — fix the actor attribution on the optimistic
REPORT_PREVIEWaction so the backend email renderer (and any other consumer that readschildOwnerAccountIDas "actor") sees the payment from the correct side. Insrc/libs/actions/IOU/SendMoney.ts:149the call tobuildOptimisticReportPreview(chatReport, optimisticIOUReport)is made with no explicit actor; insidesrc/libs/ReportUtils.ts:7492-7541the function derives the actor fromiouReport.managerIDfor IOU reports — accidentally correct for SEND but only because of the waySendMoneyhappens to populatemanagerID.Concrete change: extend
buildOptimisticReportPreviewwith an optionalactorAccountIDparameter (defaulting to today's derivation so other call sites are unaffected). InSendMoney.tspasscurrentUserAccountIDexplicitly. Inside the builder, when that parameter is provided, use it foractorAccountIDand mirror it intochildLastActorAccountIDand theaccountIDfield on line 7528. LeavechildOwnerAccountID/childManagerAccountIDalone (they still reflect the underlying IOU report relationship), but treat the explicitactorAccountIDas authoritative for "who created this preview" wherever the renderer asks that question.Scope:
src/libs/actions/IOU/SendMoney.ts(one call site, one new arg) andsrc/libs/ReportUtils.ts(one function signature, ~3 lines inside the builder).buildOptimisticReportPreviewcallers (MoneyRequestBuilder.ts,Split.ts,PerDiem.ts,Hold.ts) — they keep the current derivation by passing nothing.Web-Expensify.What alternative solutions did you explore? (Optional)
SendMoney.ts:115so thatownerAccountID = sender (User A)andmanagerID = recipient (User B). Would fix the email perspective for free, but inverts conventions that many other call sites rely on (getIOUPayerAndReceiverinTransactionPreviewUtils.ts:61-74, the IOU message-text builder aroundReportUtils.ts:7014-7022, search/preview components). Net regression risk is much higher than threading an explicit actor through.actorAccountIDinstead ofchildOwnerAccountID. Cleaner long-term, but not in this repo and requires a backend PR + deploy. The proposed App-side change makes both paths agree without waiting on that.github-actions commentedon May 12, 2026
Marshall7777 commentedon May 12, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
7 remaining items
Beamanator commentedon May 13, 2026
@KioCoan interested in picking this one up? :D
KioCoan commentedon May 14, 2026
I'm investigating the BE today.
melvin-bot commentedon May 19, 2026
@KioCoan Eep! 4 days overdue now. Issues have feelings too...
KioCoan commentedon May 20, 2026
PRs in review.
melvin-bot commentedon May 27, 2026
@KioCoan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
KioCoan commentedon May 27, 2026
Not overdue, it's in staging.
Can we do it internally @Beamanator?
https://github.com/Expensify/Web-Expensify/pull/52925#issuecomment-4550533666
Beamanator commentedon May 27, 2026
I think we're good to go with the automatic tests for that one