diff --git a/src/CONST.ts b/src/CONST.ts index ab81786145ec..045bbbba7c12 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -6490,6 +6490,8 @@ const CONST = { }, CORPAY_FIELDS: { + EXCLUDED_COUNTRIES: ['IR', 'CU', 'SY', 'UA', 'KP', 'RU'] as string[], + EXCLUDED_CURRENCIES: ['IRR', 'CUP', 'SYP', 'UAH', 'KPW', 'RUB'] as string[], BANK_ACCOUNT_DETAILS_FIELDS: ['accountNumber', 'localAccountNumber', 'routingCode', 'localRoutingCode', 'swiftBicCode'] as string[], ACCOUNT_TYPE_KEY: 'BeneficiaryAccountType', BANK_INFORMATION_FIELDS: ['bankName', 'bankAddressLine1', 'bankAddressLine2', 'bankCity', 'bankRegion', 'bankPostal', 'BeneficiaryBankBranchName'] as string[], diff --git a/src/components/CurrencyPicker.tsx b/src/components/CurrencyPicker.tsx index 6d2f4826fbc5..843c085900b0 100644 --- a/src/components/CurrencyPicker.tsx +++ b/src/components/CurrencyPicker.tsx @@ -24,9 +24,12 @@ type CurrencyPickerProps = { /** Form Error description */ errorText?: string; + + /** List of currencies to exclude from the list */ + excludeCurrencies?: string[]; }; -function CurrencyPicker({value, errorText, headerContent, onInputChange = () => {}}: CurrencyPickerProps) { +function CurrencyPicker({value, errorText, headerContent, excludeCurrencies, onInputChange = () => {}}: CurrencyPickerProps) { const {translate} = useLocalize(); const [isPickerVisible, setIsPickerVisible] = useState(false); const styles = useThemeStyles(); @@ -75,6 +78,7 @@ function CurrencyPicker({value, errorText, headerContent, onInputChange = () => initiallySelectedCurrencyCode={value} onSelect={updateInput} searchInputLabel={translate('common.search')} + excludedCurrencies={excludeCurrencies} /> diff --git a/src/components/CurrencySelectionList/index.tsx b/src/components/CurrencySelectionList/index.tsx index 1e8b5294286f..4d9bb0fdf9be 100644 --- a/src/components/CurrencySelectionList/index.tsx +++ b/src/components/CurrencySelectionList/index.tsx @@ -17,6 +17,7 @@ function CurrencySelectionList({ selectedCurrencies = [], canSelectMultiple = false, recentlyUsedCurrencies, + excludedCurrencies = [], }: CurrencySelectionListProps) { const [currencyList] = useOnyx(ONYXKEYS.CURRENCY_LIST); const [searchValue, setSearchValue] = useState(''); @@ -25,7 +26,7 @@ function CurrencySelectionList({ const {sections, headerMessage} = useMemo(() => { const currencyOptions: CurrencyListItem[] = Object.entries(currencyList ?? {}).reduce((acc, [currencyCode, currencyInfo]) => { const isSelectedCurrency = currencyCode === initiallySelectedCurrencyCode || selectedCurrencies.includes(currencyCode); - if (isSelectedCurrency || !currencyInfo?.retired) { + if (!excludedCurrencies.includes(currencyCode) && (isSelectedCurrency || !currencyInfo?.retired)) { acc.push({ currencyName: currencyInfo?.name ?? '', text: `${currencyCode} - ${CurrencyUtils.getCurrencySymbol(currencyCode)}`, @@ -86,7 +87,7 @@ function CurrencySelectionList({ } return {sections: result, headerMessage: isEmpty ? translate('common.noResultsFound') : ''}; - }, [currencyList, searchValue, translate, initiallySelectedCurrencyCode, selectedCurrencies, getUnselectedOptions, recentlyUsedCurrencies]); + }, [currencyList, recentlyUsedCurrencies, searchValue, getUnselectedOptions, translate, initiallySelectedCurrencyCode, selectedCurrencies, excludedCurrencies]); return ( {Object.values(fieldsMap[CONST.CORPAY_FIELDS.STEPS_NAME.BANK_ACCOUNT_DETAILS] ?? {}).map((field) => ( diff --git a/src/pages/settings/Wallet/InternationalDepositAccount/substeps/CountrySelection.tsx b/src/pages/settings/Wallet/InternationalDepositAccount/substeps/CountrySelection.tsx index dc16737a5dbc..fee2dddbfb50 100644 --- a/src/pages/settings/Wallet/InternationalDepositAccount/substeps/CountrySelection.tsx +++ b/src/pages/settings/Wallet/InternationalDepositAccount/substeps/CountrySelection.tsx @@ -43,16 +43,18 @@ function CountrySelection({isEditing, onNext, formValues, resetScreenIndex}: Cus const countries = useMemo( () => - Object.keys(CONST.ALL_COUNTRIES).map((countryISO) => { - const countryName = translate(`allCountries.${countryISO}` as TranslationPaths); - return { - value: countryISO, - keyForList: countryISO, - text: countryName, - isSelected: currentCountry === countryISO, - searchValue: StringUtils.sanitizeString(`${countryISO}${countryName}`), - }; - }), + Object.keys(CONST.ALL_COUNTRIES) + .filter((countryISO) => !CONST.CORPAY_FIELDS.EXCLUDED_COUNTRIES.includes(countryISO)) + .map((countryISO) => { + const countryName = translate(`allCountries.${countryISO}` as TranslationPaths); + return { + value: countryISO, + keyForList: countryISO, + text: countryName, + isSelected: currentCountry === countryISO, + searchValue: StringUtils.sanitizeString(`${countryISO}${countryName}`), + }; + }), [translate, currentCountry], );