diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx index 0bbdd493767e1..f679cba73677a 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx @@ -4,9 +4,11 @@ import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import {revealVirtualCardDetails} from '@libs/actions/Card'; import {requestValidateCodeAction, resetValidateActionCodeSent} from '@libs/actions/User'; +import {getMicroSecondOnyxErrorWithTranslationKey} from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {DomainCardNavigatorParamList, SettingsNavigatorParamList} from '@libs/Navigation/types'; +import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; @@ -52,13 +54,16 @@ function ExpensifyCardVerifyAccountPage({route}: ExpensifyCardVerifyAccountPageP })); navigateBack(); }) - .catch((error: string) => { - // Displaying magic code errors is handled in the modal, no need to set it on the card - setCardsDetailsErrors((prevState) => ({ - ...prevState, - [cardID]: error, - })); - navigateBack(); + .catch((error: TranslationPaths) => { + if (error === 'cardPage.missingPrivateDetails') { + setCardsDetailsErrors((prevState) => ({ + ...prevState, + [cardID]: error, + })); + navigateBack(); + return; + } + setValidateError(getMicroSecondOnyxErrorWithTranslationKey(error)); }) .finally(() => { setIsCardDetailsLoading((prevState: Record) => ({...prevState, [cardID]: false}));