From 3c3eb17d8c1077072e6acaff991f6ccfb16d2702 Mon Sep 17 00:00:00 2001 From: MelvinBot Date: Fri, 20 Feb 2026 18:36:18 +0000 Subject: [PATCH 1/3] Fix: Remove generic error from failureData and move public domain check before disable toggle Remove the hardcoded generic error message from toggleTravelInvoicing failureData so server-provided error messages are preserved. Move the public domain check to the top of handleToggle so it runs for both enable and disable actions. Co-authored-by: Ishpaul Singh --- src/libs/actions/TravelInvoicing.ts | 1 - .../travel/WorkspaceTravelInvoicingSection.tsx | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/TravelInvoicing.ts b/src/libs/actions/TravelInvoicing.ts index 563afc05da738..c0d31587e1622 100644 --- a/src/libs/actions/TravelInvoicing.ts +++ b/src/libs/actions/TravelInvoicing.ts @@ -288,7 +288,6 @@ function toggleTravelInvoicing(policyID: string, workspaceAccountID: number, ena isEnabled: !enabled, }, pendingAction: null, - errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'), }, }, ]; diff --git a/src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx b/src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx index a2486c9e34e52..faad6eb8e160d 100644 --- a/src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx +++ b/src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx @@ -115,6 +115,12 @@ function WorkspaceTravelInvoicingSection({policyID}: WorkspaceTravelInvoicingSec * When turning OFF: show confirmation modal, then call toggleTravelInvoicing(false). */ const handleToggle = (isEnabled: boolean) => { + // Check if user is on a public domain - Travel Invoicing requires a private domain + if (account?.isFromPublicDomain) { + Navigation.navigate(ROUTES.TRAVEL_PUBLIC_DOMAIN_ERROR.getRoute(Navigation.getActiveRoute())); + return; + } + if (!isEnabled) { // Trying to disable - check for outstanding balance first if (hasOutstandingTravelBalance(cardSettings)) { @@ -127,12 +133,6 @@ function WorkspaceTravelInvoicingSection({policyID}: WorkspaceTravelInvoicingSec return; } - // Check if user is on a public domain - Travel Invoicing requires a private domain - if (account?.isFromPublicDomain) { - Navigation.navigate(ROUTES.TRAVEL_PUBLIC_DOMAIN_ERROR.getRoute(Navigation.getActiveRoute())); - return; - } - // Turning ON - check if bank account setup is needed first if (!eligibleBankAccounts.length || isSetupUnfinished) { // No bank accounts - start add bank account flow From 9a567cf8962d2024c109ae98cdcd3dbe3f4b73d5 Mon Sep 17 00:00:00 2001 From: MelvinBot Date: Fri, 20 Feb 2026 18:49:46 +0000 Subject: [PATCH 2/3] Remove generic error expectation from toggleTravelInvoicing test The errors field was removed from failureData in the source code so that the backend-provided error is preserved. Update the test to no longer expect errors in failureData. Co-authored-by: Ishpaul Singh --- tests/unit/TravelInvoicingTest.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/TravelInvoicingTest.ts b/tests/unit/TravelInvoicingTest.ts index f4227a3abfd8c..ee4e4da15e070 100644 --- a/tests/unit/TravelInvoicingTest.ts +++ b/tests/unit/TravelInvoicingTest.ts @@ -250,7 +250,6 @@ describe('TravelInvoicing', () => { isEnabled: !enabled, }), pendingAction: null, - errors: expect.anything() as unknown, }), }), ]), From e2dabea09295f247e42c41bc6944032688da9728 Mon Sep 17 00:00:00 2001 From: MelvinBot Date: Fri, 20 Feb 2026 18:51:02 +0000 Subject: [PATCH 3/3] Fix: Update TravelInvoicingTest to match removal of errors from failureData Co-authored-by: Ishpaul Singh --- tests/unit/TravelInvoicingTest.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/TravelInvoicingTest.ts b/tests/unit/TravelInvoicingTest.ts index f4227a3abfd8c..ee4e4da15e070 100644 --- a/tests/unit/TravelInvoicingTest.ts +++ b/tests/unit/TravelInvoicingTest.ts @@ -250,7 +250,6 @@ describe('TravelInvoicing', () => { isEnabled: !enabled, }), pendingAction: null, - errors: expect.anything() as unknown, }), }), ]),