From 6a7a65885e84d5ab8ffd03f183c513a8344ac6f7 Mon Sep 17 00:00:00 2001
From: Scott Deeter <scott@expensify.com>
Date: Fri, 9 May 2025 16:41:00 -0700
Subject: [PATCH 1/3] Add the framework for the RECEIPTSCANFAILED action

---
 src/CONST.ts            | 1 +
 src/languages/en.ts     | 1 +
 src/libs/ReportUtils.ts | 3 +++
 3 files changed, 5 insertions(+)

diff --git a/src/CONST.ts b/src/CONST.ts
index 448af0b44569..a8c0cf40b193 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -1380,6 +1380,7 @@ const CONST = {
                     CORPORATE_UPGRADE: 'POLICYCHANGELOG_CORPORATE_UPGRADE',
                     TEAM_DOWNGRADE: 'POLICYCHANGELOG_TEAM_DOWNGRADE',
                 },
+                RECEIPTSCANFAILED: 'RECEIPTSCANFAILED',
                 RESOLVED_DUPLICATES: 'RESOLVEDDUPLICATES',
                 ROOM_CHANGE_LOG: {
                     INVITE_TO_ROOM: 'INVITETOROOM',
diff --git a/src/languages/en.ts b/src/languages/en.ts
index b5adf3db2d2e..7645694cd264 100755
--- a/src/languages/en.ts
+++ b/src/languages/en.ts
@@ -897,6 +897,7 @@ const translations = {
         deleteReceipt: 'Delete receipt',
         deleteConfirmation: 'Are you sure you want to delete this receipt?',
         addReceipt: 'Add receipt',
+        scanFailed: "The receipt couldn't be scanned, as it's missing a merchant, date, or amount.",
     },
     quickAction: {
         scanReceipt: 'Scan receipt',
diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index 9d27087b7a1b..d2bbf9bb4bf9 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -4555,6 +4555,9 @@ function getReportActionMessage({
             personalDetails,
         });
     }
+    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPTSCANFAILED) {
+        return translateLocal('receipt.scanFailed');
+    }
 
     return parseReportActionHtmlToText(reportAction, reportID, childReportID);
 }

From ea71e97a3d28ac3f82245cb22de91e5a3ce87034 Mon Sep 17 00:00:00 2001
From: Scott Deeter <scott@expensify.com>
Date: Mon, 12 May 2025 15:56:14 -0700
Subject: [PATCH 2/3] Add getReceiptScanFailedMessage

---
 src/languages/es.ts                            | 1 +
 src/libs/OptionsListUtils.ts                   | 3 +++
 src/libs/ReportActionsUtils.ts                 | 5 +++++
 src/pages/home/report/PureReportActionItem.tsx | 2 ++
 4 files changed, 11 insertions(+)

diff --git a/src/languages/es.ts b/src/languages/es.ts
index dc4cdc9fa59a..260aa3dc93ef 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -892,6 +892,7 @@ const translations = {
         deleteReceipt: 'Eliminar recibo',
         deleteConfirmation: '¿Estás seguro de que quieres borrar este recibo?',
         addReceipt: 'Añadir recibo',
+        scanFailed: 'El recibo no pudo ser escaneado, ya que falta el comerciante, la fecha o el monto.',
     },
     quickAction: {
         scanReceipt: 'Escanear recibo',
diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts
index 251a0db581b9..03cd5d139c18 100644
--- a/src/libs/OptionsListUtils.ts
+++ b/src/libs/OptionsListUtils.ts
@@ -55,6 +55,7 @@ import {
     getMessageOfOldDotReportAction,
     getOneTransactionThreadReportID,
     getOriginalMessage,
+    getReceiptScanFailedMessage,
     getReportActionHtml,
     getReportActionMessageText,
     getSortedReportActions,
@@ -810,6 +811,8 @@ function getLastMessageTextForReport(
         lastMessageTextFromReport = getReportActionMessageText(lastReportAction);
     } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION) {
         lastMessageTextFromReport = getExportIntegrationLastMessageText(lastReportAction);
+    } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPTSCANFAILED) {
+        lastMessageTextFromReport = getReceiptScanFailedMessage();
     } else if (lastReportAction?.actionName && isOldDotReportAction(lastReportAction)) {
         lastMessageTextFromReport = getMessageOfOldDotReportAction(lastReportAction, false);
     } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.LEAVE_ROOM) {
diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts
index b13bca41c964..0b3c3029b75d 100644
--- a/src/libs/ReportActionsUtils.ts
+++ b/src/libs/ReportActionsUtils.ts
@@ -1536,6 +1536,10 @@ function getLeaveRoomMessage() {
     return translateLocal('report.actions.type.leftTheChat');
 }
 
+function getReceiptScanFailedMessage() {
+    return translateLocal('receipt.scanFailed');
+}
+
 function getUpdateRoomDescriptionFragment(reportAction: ReportAction): Message {
     const html = getUpdateRoomDescriptionMessage(reportAction);
     return {
@@ -2519,6 +2523,7 @@ export {
     getWorkspaceReportFieldDeleteMessage,
     getReportActions,
     getLeaveRoomMessage,
+    getReceiptScanFailedMessage,
 };
 
 export type {LastVisibleMessage};
diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx
index b9df0269d1d1..914fc02e5c6f 100644
--- a/src/pages/home/report/PureReportActionItem.tsx
+++ b/src/pages/home/report/PureReportActionItem.tsx
@@ -1098,6 +1098,8 @@ function PureReportActionItem({
             );
         } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION)) {
             children = <ExportIntegration action={action} />;
+        } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.RECEIPTSCANFAILED)) {
+            children = <ReportActionItemBasicMessage message={translate('receipt.scanFailed')} />;
         } else if (isRenamedAction(action)) {
             const message = getRenamedAction(action, isExpenseReport(report));
             children = <ReportActionItemBasicMessage message={message} />;

From 52867d7ad2530ef4d6ef5ed53c4687f3a7fc76d4 Mon Sep 17 00:00:00 2001
From: Scott Deeter <scott@expensify.com>
Date: Thu, 22 May 2025 09:53:22 -0700
Subject: [PATCH 3/3] Style fix

---
 src/libs/OptionsListUtils.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts
index 7054af1f4f80..6b05fc1027ea 100644
--- a/src/libs/OptionsListUtils.ts
+++ b/src/libs/OptionsListUtils.ts
@@ -59,8 +59,8 @@ import {
     getMessageOfOldDotReportAction,
     getOneTransactionThreadReportID,
     getOriginalMessage,
-    getReopenedMessage,
     getReceiptScanFailedMessage,
+    getReopenedMessage,
     getReportActionHtml,
     getReportActionMessageText,
     getSortedReportActions,
