Is there a way in the code to find out the number of address component is needed for a particular country code?
For example, for US, it needs 4 and for UK, it needs 3.
Thanks.
Country Codes under new Devnet resources:
On the server (using private APIs):
AddressStructureHelper addrStructHelper = AddressConfigCacheManager.getAddressStructureHelper(CountryCodes.fromValue("US"));
AddressStructure addrStructure = addrStructHelper.getAddressStructure();
The resulting AddressStructure
is a JAXB object that corresponds to the element in
server/cfg/address/META-INF/AddressConfig.xml
.
On the client:
You can use One.AddressStructureCache.getAddressStructure()
to fetch the same structure in Javascript. The class is marked private in the documentation but the API is old and unlikely to change. If you're trying to access this information on the client, let me know and I can improve the documentation.