Skip to content

Merge - Receipt amount and distance does not match the amount and distance on confirm page #78567

Closed

Description

@jponikarchuk

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.88-5
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #78233
Email or phone of affected tester (no customers): sdonijsdoijsoijsio@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.1 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create a Map distance expense.
  4. Go to workspace chat.
  5. Create a Map distance expense.
  6. Go to Reports > Expenses.
  7. Select both expenses via checkbox.
  8. Click dropdown button > Merge.
  9. Select the second merchant.
  10. Select the first report.
  11. Click Next.
  12. On confirm page, open the receipt.

Expected Result:

Receipt amount and distance will match the amount and distance on confirm page.

Actual Result:

Receipt amount and distance does not match the amount and distance on confirm page.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7039055_1767071228358.12.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    Bug
    on Dec 30, 2025
  2. melvin-bot commented on Dec 30, 2025

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #78233

  3. melvin-bot commented on Dec 30, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. melvin-bot commented on Dec 30, 2025

    @melvin-bot

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

  5. github-actions commented on Dec 30, 2025

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. hoangzinh commented on Dec 30, 2025

    @hoangzinh
    Contributor

    @youssef-lr I found the root cause:

    1. In the Reports page, transactions have receipt.source as an image (.jpg), instead of .pdf
    Image
    1. It causes the AttachmentView to reach this line => and display the old eReceipt view.

    // Distance eReceipts are now generated as a PDF, but to keep it backwards compatible we still show the old eReceipt view for image receipts

  7. hoangzinh commented on Dec 30, 2025

    @hoangzinh
    Contributor

    One solution I can think of is to force building the receipt resource when selecting the merchant here

    if (field === 'merchant' && isDistanceRequest(transaction)) {

    Click here to view diff
    diff --git a/src/libs/MergeTransactionUtils.ts b/src/libs/MergeTransactionUtils.ts
    index 561f922c72f..f3933bf3f40 100644
    --- a/src/libs/MergeTransactionUtils.ts
    +++ b/src/libs/MergeTransactionUtils.ts
    @@ -79,9 +79,9 @@ function getMergeFieldErrorText(translate: LocaleContextProps['translate'], merg
      * @param transaction - The transaction to update the receipt source for
      * @returns The updated transaction with receipt.source filled if it was missing
      */
    -function fillMissingReceiptSource(transaction: Transaction) {
    +function fillMissingReceiptSource(transaction: Transaction, force = false) {
         // If receipt.source already exists, no need to modify
    -    if (!transaction.receipt || !!transaction.receipt.source || !transaction.receipt.filename) {
    +    if (!transaction.receipt || (!!transaction.receipt.source && !force) || !transaction.receipt.filename) {
             return transaction;
         }
     
    @@ -549,14 +549,16 @@ function getMergeFieldUpdatedValues<K extends MergeFieldKey>(
             updatedValues.reportName = reportName.length ? reportName : null;
         }
     
    -    if (field === 'merchant' && isDistanceRequest(transaction)) {
    +    if (field === 'merchant' && isDistanceRequest(transaction) && transaction) {
             const transactionDetails = getTransactionDetails(transaction);
             updatedValues.amount = getMergeFieldValue(transactionDetails, transaction, 'amount') as number;
             updatedValues.currency = getCurrency(transaction);
             updatedValues.customUnit = transaction?.comment?.customUnit;
             updatedValues.iouRequestType = transaction?.iouRequestType;
    -        // For manual distance requests, set waypoints/routes and receipt to null to clear any existing values
    -        updatedValues.receipt = transaction?.receipt ?? null;
    +        // 1. For manual distance requests, set waypoints/routes and receipt to null to clear any existing values
    +        // 2. Distance requests from the Reports page have `receipt.source` set to an image filename, which is incorrect;
    +        // it should be a PDF filename. This ensures we always set `receipt.source` to the correct filename. https://github.com/Expensify/App/issues/78567
    +        updatedValues.receipt = fillMissingReceiptSource(transaction, true)?.receipt ?? null;
             updatedValues.waypoints = getWaypoints(transaction) ?? null;
             updatedValues.routes = transaction?.routes ?? null;
         }
  8. melvin-bot commented on Dec 30, 2025

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  9. added
    Daily
    and removed
    DeployBlockerCash
    Hourly
    on Dec 30, 2025
  10. mountiny commented on Dec 30, 2025

    @mountiny
    Contributor

    This is a new feature and minor edge case so demoting and @youssef-lr is handling it shortly

  11. added
    Reviewing
    on Dec 31, 2025
  12. youssef-lr commented on Jan 2, 2026

    @youssef-lr
    Contributor

    I retested this and it's fixed.

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

Metadata

Metadata

Labels

BugDailyEngineeringReviewing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions