Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -52,13 +54,8 @@ 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();
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that navigateBack was added from #68749. @MonilBhavsar if the user inputs a wrong magic code, they will be navigated back.

web.mp4

This is the previous behavior. The user stays on the magic code page.

web.mp4

In this PR, we want to keep the user on the magic code page and show any errors on the magic code page. Does that fine with you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine with me, we implemented the fix because there was no error to display on the magic code page cc @joekaufmanexpensify

Copy link
Contributor

Choose a reason for hiding this comment

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

@ryntgh can you test #68749 on this PR and see if the error shown correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bernhardoj I couldn't really test this since I can't connect with an EU/UK bank account. But I noticed that the latest change in the PR was to automatically redirect to ROUTES.SETTINGS_WALLET_CARD_MISSING_DETAILS for EU/UK cards (I hardcoded this to US)

MacOS-Chrome.mp4

Since I can't use an EU/UK bank account, I couldn't confirm whether the missing personal details error message is shown correctly

Copy link
Contributor

Choose a reason for hiding this comment

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

@MonilBhavsar do you know how can I add a EU/UK bank account?

Copy link
Contributor

@bernhardoj bernhardoj Nov 25, 2025

Choose a reason for hiding this comment

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

@ryntgh Btw, can you merge with main, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, merged with the latest main!

Copy link
Contributor

Choose a reason for hiding this comment

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

@ryntgh I get this error when trying to simulate the missing details error.

image

You can try rejecting the promise in revealVirtualCardDetails.
reject('cardPage.missingPrivateDetails');

Copy link
Contributor

@bernhardoj bernhardoj Nov 25, 2025

Choose a reason for hiding this comment

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

@ryntgh after thinking more about it, I think it's better to keep the previous logic if the error is 'cardPage.missingPrivateDetails' because it's not a magic code error. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bernhardoj Yeah, I agree. Keeping the previous logic for that case seems like the better approach

.catch((error: TranslationPaths) => {
setValidateError(getMicroSecondOnyxErrorWithTranslationKey(error));
})
.finally(() => {
setIsCardDetailsLoading((prevState: Record<number, boolean>) => ({...prevState, [cardID]: false}));
Expand Down
Loading