@@ -6,6 +6,7 @@ import RadioListItem from '@components/SelectionList/RadioListItem';
66import useDebouncedState from '@hooks/useDebouncedState' ;
77import useLocalize from '@hooks/useLocalize' ;
88import useNetwork from '@hooks/useNetwork' ;
9+ import useOnyx from '@hooks/useOnyx' ;
910import useThemeStyles from '@hooks/useThemeStyles' ;
1011import Navigation from '@libs/Navigation/Navigation' ;
1112import searchOptions from '@libs/searchOptions' ;
@@ -16,6 +17,7 @@ import {fetchCorpayFields} from '@userActions/BankAccounts';
1617import Text from '@src/components/Text' ;
1718import CONST from '@src/CONST' ;
1819import type { TranslationPaths } from '@src/languages/types' ;
20+ import ONYXKEYS from '@src/ONYXKEYS' ;
1921import ROUTES from '@src/ROUTES' ;
2022
2123function CountrySelection ( { isEditing, onNext, formValues, resetScreenIndex} : CustomSubStepProps ) {
@@ -24,10 +26,15 @@ function CountrySelection({isEditing, onNext, formValues, resetScreenIndex}: Cus
2426 const styles = useThemeStyles ( ) ;
2527 const [ searchValue , debouncedSearchValue , setSearchValue ] = useDebouncedState ( '' ) ;
2628 const [ currentCountry , setCurrentCountry ] = useState ( formValues . bankCountry ) ;
29+ const [ isUserValidated ] = useOnyx ( ONYXKEYS . ACCOUNT , { selector : ( account ) => account ?. validated , canBeMissing : false } ) ;
2730
2831 const onCountrySelected = useCallback ( ( ) => {
2932 if ( currentCountry === CONST . COUNTRY . US ) {
30- Navigation . navigate ( ROUTES . SETTINGS_ADD_US_BANK_ACCOUNT ) ;
33+ if ( isUserValidated ) {
34+ Navigation . navigate ( ROUTES . SETTINGS_ADD_US_BANK_ACCOUNT ) ;
35+ } else {
36+ Navigation . navigate ( ROUTES . SETTINGS_CONTACT_METHOD_VERIFY_ACCOUNT . getRoute ( Navigation . getActiveRoute ( ) , ROUTES . SETTINGS_ADD_US_BANK_ACCOUNT ) ) ;
37+ }
3138 return ;
3239 }
3340 if ( isEditing && formValues . bankCountry === currentCountry ) {
@@ -36,7 +43,7 @@ function CountrySelection({isEditing, onNext, formValues, resetScreenIndex}: Cus
3643 }
3744 fetchCorpayFields ( currentCountry ) ;
3845 resetScreenIndex ?.( CONST . CORPAY_FIELDS . INDEXES . MAPPING . BANK_ACCOUNT_DETAILS ) ;
39- } , [ currentCountry , formValues . bankCountry , isEditing , onNext , resetScreenIndex ] ) ;
46+ } , [ currentCountry , formValues . bankCountry , isEditing , onNext , resetScreenIndex , isUserValidated ] ) ;
4047
4148 const onSelectionChange = useCallback ( ( country : Option ) => {
4249 setCurrentCountry ( country . value ) ;
0 commit comments