Skip to content

[WIP] Add card fraud alert#71802

Closed
marcaaron wants to merge 15 commits intomainfrom
marcaaron-actionableFraudAlert
Closed

[WIP] Add card fraud alert#71802
marcaaron wants to merge 15 commits intomainfrom
marcaaron-actionableFraudAlert

Conversation

@marcaaron
Copy link
Copy Markdown
Contributor

@marcaaron marcaaron commented Oct 3, 2025

Explanation of Change

Fixed Issues

$ #70683
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

@marcaaron marcaaron self-assigned this Oct 3, 2025
const {translate} = useLocalize();

const {cardID, maskedCardNumber, triggerAmount, triggerMerchant, resolution} = originalMessage;
const formattedAmount = CurrencyUtils.convertToDisplayString(triggerAmount, 'USD');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PERF-4 Memoize objects and functions passed as props

The CurrencyUtils.convertToDisplayString() function call is executed on every render, creating potential performance overhead. Since triggerAmount is a primitive value that should remain stable, this calculation should be memoized.

const formattedAmount = useMemo(
    () => CurrencyUtils.convertToDisplayString(triggerAmount, 'USD'),
    [triggerAmount]
);

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 3, 2025

Codecov Report

❌ Patch coverage is 29.78723% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pages/home/report/PureReportActionItem.tsx 11.11% 24 Missing ⚠️
src/libs/actions/Card.ts 0.00% 7 Missing ⚠️
src/libs/ReportUtils.ts 77.77% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@OSBotify

This comment has been minimized.

@marcaaron
Copy link
Copy Markdown
Contributor Author

I am going OOO and will look for someone to take this over.

@OSBotify
Copy link
Copy Markdown
Contributor

OSBotify commented Oct 9, 2025

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index cc222c92..8c9d2da5 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -2022,7 +2022,7 @@ const translations = {
             confirmButtonText: 'Ja, das tue ich.',
             reportFraudButtonText: 'Nein, das war ich nicht.',
             clearedMessage: ({cardLastFour}: {cardLastFour: string}) =>
-                `die verdächtige Aktivität geklärt und die Karte x${cardLastFour} reaktiviert. Alles bereit, um weiter Ausgaben zu erfassen!`,
+                `hat die verdächtige Aktivität geklärt und die Karte x${cardLastFour} reaktiviert. Alles bereit, um weiter Ausgaben zu erfassen!`,
             deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `hat die Karte mit den Endziffern ${cardLastFour} deaktiviert`,
             alertMessage: ({
                 cardLastFour,
@@ -2034,7 +2034,7 @@ const translations = {
                 amount: string;
                 merchant: string;
                 date: string;
-            }) => `verdächtige Aktivitäten auf der Karte mit der Endung ${cardLastFour} festgestellt. Erkennen Sie diese Abbuchung?
+            }) => `verdächtige Aktivitäten auf der Karte mit den Endziffern ${cardLastFour} festgestellt. Erkennen Sie diese Belastung?
 
 ${amount} für ${merchant} - ${date}`,
         },
@@ -7167,6 +7167,7 @@ ${amount} für ${merchant} - ${date}`,
             isWaitingForAssigneeToCompleteAction: 'Wartet darauf, dass der Zuständige die Aktion abschließt.',
             hasChildReportAwaitingAction: 'Hat einen untergeordneten Bericht, der auf eine Aktion wartet',
             hasMissingInvoiceBankAccount: 'Fehlendes Rechnungsbankkonto',
+            hasUnresolvedCardFraudAlert: 'Hat einen ungelösten Kartenbetrugsalarm',
         },
         reasonRBR: {
             hasErrors: 'Hat Fehler in den Berichtsdaten oder Berichtsaktionen',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index c3870be3..486c0203 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -2034,7 +2034,7 @@ const translations = {
                 amount: string;
                 merchant: string;
                 date: string;
-            }) => `activité suspecte identifiée sur la carte se terminant par ${cardLastFour}. Reconnaissez-vous cette transaction ?
+            }) => `activité suspecte identifiée sur la carte se terminant par ${cardLastFour}. Reconnaissez-vous cette charge ?
 
 ${amount} pour ${merchant} - ${date}`,
         },
@@ -7174,6 +7174,7 @@ ${amount} pour ${merchant} - ${date}`,
             isWaitingForAssigneeToCompleteAction: "Attend que le responsable termine l'action",
             hasChildReportAwaitingAction: 'Le rapport enfant attend une action',
             hasMissingInvoiceBankAccount: 'Il manque le compte bancaire de la facture',
+            hasUnresolvedCardFraudAlert: 'A une alerte de fraude à la carte non résolue',
         },
         reasonRBR: {
             hasErrors: 'Contient des erreurs dans les données du rapport ou des actions du rapport',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 65aa3389..1ddd7c7c 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -2012,9 +2012,8 @@ const translations = {
         cardFraudAlert: {
             confirmButtonText: 'Sì, lo faccio',
             reportFraudButtonText: 'No, non ero io',
-            clearedMessage: ({cardLastFour}: {cardLastFour: string}) =>
-                `abbiamo eliminato l'attività sospetta e riattivato la carta x${cardLastFour}. Tutto pronto per continuare a registrare le spese!`,
-            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `disattivato la carta che termina con ${cardLastFour}`,
+            clearedMessage: ({cardLastFour}: {cardLastFour: string}) => `ho eliminato l'attività sospetta e riattivato la carta x${cardLastFour}. Tutto pronto per continuare a fare spese!`,
+            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `disattivato la carta terminante in ${cardLastFour}`,
             alertMessage: ({
                 cardLastFour,
                 amount,
@@ -7175,6 +7174,7 @@ ${amount} per ${merchant} - ${date}`,
             isWaitingForAssigneeToCompleteAction: "In attesa che l'assegnatario completi l'azione",
             hasChildReportAwaitingAction: 'Ha un rapporto figlio in attesa di azione',
             hasMissingInvoiceBankAccount: 'Manca il conto bancario della fattura',
+            hasUnresolvedCardFraudAlert: 'Ha un avviso di frode sulla carta non risolto',
         },
         reasonRBR: {
             hasErrors: 'Ha errori nei dati del report o delle azioni del report',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index b84721e2..2756d32e 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -2003,10 +2003,10 @@ const translations = {
         validateCardTitle: 'あなたであることを確認しましょう',
         enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `カードの詳細を表示するには、${contactMethod} に送信されたマジックコードを入力してください。1~2分以内に届くはずです。`,
         cardFraudAlert: {
-            confirmButtonText: 'はい、そうです。',
+            confirmButtonText: 'はい、そうです',
             reportFraudButtonText: 'いいえ、それは私ではありませんでした。',
-            clearedMessage: ({cardLastFour}: {cardLastFour: string}) => `不審な活動をクリアし、カードx${cardLastFour}を再有効化しました。経費精算を続ける準備が整いました!`,
-            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `${cardLastFour}で終わるカードを無効にしました。`,
+            clearedMessage: ({cardLastFour}: {cardLastFour: string}) => `不審な活動をクリアし、カードx${cardLastFour}を再アクティブ化しました。経費精算を続ける準備が整いました!`,
+            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `${cardLastFour}で終わるカードを無効化しました。`,
             alertMessage: ({
                 cardLastFour,
                 amount,
@@ -2017,9 +2017,9 @@ const translations = {
                 amount: string;
                 merchant: string;
                 date: string;
-            }) => `カードの末尾が${cardLastFour}のカードで不審な活動が確認されました。この請求を認識していますか?
+            }) => `カード末尾が${cardLastFour}の不審な活動を確認しました。この請求を認識していますか?
 
-${date} - ${merchant}に${amount}`,
+${date}に${merchant}で${amount}`,
         },
     },
     workflowsPage: {
@@ -7104,6 +7104,7 @@ ${date} - ${merchant}に${amount}`,
             isWaitingForAssigneeToCompleteAction: '担当者がアクションを完了するのを待っています',
             hasChildReportAwaitingAction: '子レポートがアクション待ちです。',
             hasMissingInvoiceBankAccount: '請求書の銀行口座がありません',
+            hasUnresolvedCardFraudAlert: '未解決のカード詐欺警告があります',
         },
         reasonRBR: {
             hasErrors: 'レポートまたはレポートアクションデータにエラーがあります',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 5e80cde0..3dc4ca69 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -1107,7 +1107,7 @@ const translations = {
         totalAmountGreaterThanOriginal: ({amount}: TotalAmountGreaterOrLessThanOriginalParams) => `Het totale bedrag is ${amount} meer dan de oorspronkelijke uitgave.`,
         totalAmountLessThanOriginal: ({amount}: TotalAmountGreaterOrLessThanOriginalParams) => `Het totale bedrag is ${amount} minder dan de oorspronkelijke uitgave.`,
         splitExpenseZeroAmount: 'Voer een geldig bedrag in voordat u doorgaat.',
-        splitExpenseOneMoreSplit: 'Geen splitsing toegevoegd. Voeg er ten minste \u00E9\u00E9n toe om op te slaan.',
+        splitExpenseOneMoreSplit: 'Geen splitsing toegevoegd. Voeg er ten minste één toe om op te slaan.',
         splitExpenseCannotBeEditedModalTitle: 'Deze uitgave kan niet worden bewerkt',
         splitExpenseCannotBeEditedModalDescription: 'Goedgekeurde of betaalde uitgaven kunnen niet worden bewerkt',
         splitExpenseEditTitle: ({amount, merchant}: SplitExpenseEditTitleParams) => `Bewerk ${amount} voor ${merchant}`,
@@ -2010,9 +2010,9 @@ const translations = {
             `Voer de magische code in die naar ${contactMethod} is gestuurd om uw kaartgegevens te bekijken. Het zou binnen een minuut of twee moeten aankomen.`,
         cardFraudAlert: {
             confirmButtonText: 'Ja, dat doe ik.',
-            reportFraudButtonText: 'Nee, dat was ik niet.',
+            reportFraudButtonText: 'Nee, dat was ik niet',
             clearedMessage: ({cardLastFour}: {cardLastFour: string}) =>
-                `verdachte activiteit verwijderd en kaart x${cardLastFour} opnieuw geactiveerd. Alles klaar om door te gaan met declareren!`,
+                `verdachte activiteit gewist en kaart x${cardLastFour} opnieuw geactiveerd. Alles klaar om door te gaan met declareren!`,
             deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `deactiveerde de kaart eindigend op ${cardLastFour}`,
             alertMessage: ({
                 cardLastFour,
@@ -2024,7 +2024,7 @@ const translations = {
                 amount: string;
                 merchant: string;
                 date: string;
-            }) => `verdachte activiteit geïdentificeerd op kaart eindigend op ${cardLastFour}. Herken je deze transactie?
+            }) => `geïdentificeerde verdachte activiteit op kaart eindigend op ${cardLastFour}. Herken je deze transactie?
 
 ${amount} voor ${merchant} - ${date}`,
         },
@@ -7157,6 +7157,7 @@ ${amount} voor ${merchant} - ${date}`,
             isWaitingForAssigneeToCompleteAction: 'Wacht op de verantwoordelijke om de actie te voltooien',
             hasChildReportAwaitingAction: 'Heeft kindrapport wachtend op actie',
             hasMissingInvoiceBankAccount: 'Heeft een ontbrekende factuur bankrekening',
+            hasUnresolvedCardFraudAlert: 'Heeft onopgeloste kaartfraude waarschuwing',
         },
         reasonRBR: {
             hasErrors: 'Heeft fouten in rapport of rapportacties gegevens',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 5f790d2b..5842277c 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -2009,8 +2009,8 @@ const translations = {
             confirmButtonText: 'Tak, robię',
             reportFraudButtonText: 'Nie, to nie byłem ja',
             clearedMessage: ({cardLastFour}: {cardLastFour: string}) =>
-                `usunięto podejrzaną aktywność i ponownie aktywowano kartę x${cardLastFour}. Wszystko gotowe do dalszego rozliczania!`,
-            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `dezaktywowano kartę kończącą się na ${cardLastFour}`,
+                `usunięto podejrzaną aktywność i ponownie aktywowano kartę x${cardLastFour}. Wszystko gotowe do dalszego rozliczania wydatków!`,
+            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `dezaktywował kartę kończącą się na ${cardLastFour}`,
             alertMessage: ({
                 cardLastFour,
                 amount,
@@ -7145,6 +7145,7 @@ ${amount} dla ${merchant} - ${date}`,
             isWaitingForAssigneeToCompleteAction: 'Czeka na przypisanie do wykonania działania',
             hasChildReportAwaitingAction: 'Raport podrzędny oczekuje na działanie',
             hasMissingInvoiceBankAccount: 'Brakuje konta bankowego na fakturze',
+            hasUnresolvedCardFraudAlert: 'Ma nierozwiązane powiadomienie o oszustwie związane z kartą',
         },
         reasonRBR: {
             hasErrors: 'Ma błędy w danych raportu lub działaniach raportu',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 2a42cc8d..0ae3b11e 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -2023,7 +2023,7 @@ const translations = {
                 amount: string;
                 merchant: string;
                 date: string;
-            }) => `atividade suspeita identificada no cartão com final ${cardLastFour}. Você reconhece esta cobrança?
+            }) => `atividade suspeita identificada no cartão terminando em ${cardLastFour}. Você reconhece essa cobrança?
 
 ${amount} para ${merchant} - ${date}`,
         },
@@ -7157,6 +7157,7 @@ ${amount} para ${merchant} - ${date}`,
             isWaitingForAssigneeToCompleteAction: 'Está aguardando o responsável concluir a ação',
             hasChildReportAwaitingAction: 'Tem um relatório infantil aguardando ação',
             hasMissingInvoiceBankAccount: 'Falta a conta bancária da fatura',
+            hasUnresolvedCardFraudAlert: 'Tem alerta de fraude no cartão não resolvido',
         },
         reasonRBR: {
             hasErrors: 'Tem erros nos dados do relatório ou nas ações do relatório',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 67fda00d..54ea0744 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -1982,10 +1982,14 @@ const translations = {
         validateCardTitle: '让我们确认一下身份',
         enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `请输入发送到${contactMethod}的验证码以查看您的卡详细信息。验证码应在一两分钟内到达。`,
         cardFraudAlert: {
-            confirmButtonText: '是的,我愿意。',
+            confirmButtonText: '是的,我愿意',
             reportFraudButtonText: '不,不是我',
-            clearedMessage: ({cardLastFour}: {cardLastFour: string}) => `已清除可疑活动并重新激活卡片 x${cardLastFour}。一切准备就绪,可以继续报销了!`,
-            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `已停用以${cardLastFour}结尾的卡片`,
+            clearedMessage: ({cardLastFour}: {cardLastFour: string}) =>
+                `已清除可疑活动并重新激活卡片 x${
+                    //_/\__/_/  \_,_/\__/\__/\_,_/
+                    cardLastFour
+                }。一切准备就绪,可以继续报销了!`,
+            deactivatedMessage: ({cardLastFour}: {cardLastFour: string}) => `已停用尾号为${cardLastFour}的卡片`,
             alertMessage: ({
                 cardLastFour,
                 amount,
@@ -1996,9 +2000,9 @@ const translations = {
                 amount: string;
                 merchant: string;
                 date: string;
-            }) => `在卡号以${cardLastFour}结尾的卡上发现可疑活动。您是否认可此笔费用?
+            }) => `在卡号末尾为${cardLastFour}的卡上发现可疑活动。您是否认可此笔费用?
 
-${merchant}的${amount} - ${date}`,
+${date},${merchant},金额为${amount}。`,
         },
     },
     workflowsPage: {
@@ -7006,6 +7010,7 @@ ${merchant}的${amount} - ${date}`,
             isWaitingForAssigneeToCompleteAction: '正在等待受让人完成操作',
             hasChildReportAwaitingAction: '有子报告等待处理',
             hasMissingInvoiceBankAccount: '缺少发票银行账户',
+            hasUnresolvedCardFraudAlert: '有未解决的卡片欺诈警报',
         },
         reasonRBR: {
             hasErrors: '报告或报告操作数据中有错误',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

@MariaHCD
Copy link
Copy Markdown
Contributor

MariaHCD commented Oct 9, 2025

Noting that @allgandalf has taken over this PR and created a new one: #72176

@MariaHCD MariaHCD closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants