[FEATURE] add a mapping of countries in CountryAlpha2 enum to countries in human readable format for payout links #6083 #1264
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This PR implements country code to human-readable name conversion for the payout widget, allowing users to see country names like "United States of America" instead of ISO codes like "US" in dropdown menus.
Enhanced the existing Country module with mapping functions to convert CountryAlpha2 codes to human-readable country names for display, while maintaining backend compatibility.
Changes Made
src/Country.resgetCountryNameFromAlpha2()- converts ISO alpha-2 codes (e.g., "US") to human-readable names (e.g., "United States of America")getAlpha2FromCountryName()- reverse conversion for form submissiongetAllCountriesWithMapping()utility for complete country data accesssrc/Payments/PaymentMethodsRecord.resgetCountryOptionsFromAlpha2Codes()- batch converts arrays of country codes to names with O(n+m) performance using Set-based lookupsgetAlpha2CodeFromCountryName()- delegates to Country module for consistencyDetails*
Example
Usage
The payout widget can now display country dropdowns with human-readable names while maintaining ISO alpha-2 codes for API communication, matching the pattern used in backend utilities like
list_countries_currencies_for_connector_payment_method_util.Fixes: #6083
How did you test it?
Checklist
npm run re:build