AddressSpec

Per-country address spec — what the merchant's address form should look like for each ISO country code.

Each country has an fmt string that names the fields it collects in render order: %A = street, %C = city, %S = state, %Z = postcode. The presence of a token decides whether that field is rendered:

Countries with no fmt defined fall back to the default of street + city.

Required-field policy. Any field that is visible is required. The upstream data also declares a per-country require set (e.g. street + state for AE), but in practice the validator collects every visible field with a blank check, so the require declaration is intentionally not exposed here.

Functions

Link copied to clipboard
fun hasCity(countryCode: String): Boolean

Whether the city field should be rendered for the given country.

Link copied to clipboard
fun hasPostcode(countryCode: String): Boolean

Whether the postcode field should be rendered for the given country.

Link copied to clipboard
fun hasState(countryCode: String): Boolean

Whether the given country shows a state field at all.

Link copied to clipboard
fun mapState(countryCode: String, stateInput: String): String

Normalize a free-text state to its canonical dropdown value.

Link copied to clipboard
fun postcodeExamples(countryCode: String): List<String>?

Sample postcodes for the country (use the first as a hint/placeholder), or null.

Link copied to clipboard
fun postcodePattern(countryCode: String): Regex?

Anchored, case-insensitive regex for the country's postcode, or null if none.

Link copied to clipboard
fun stateList(countryCode: String): List<Pair<String, String>>?

State dropdown options for the given country, or null when there is no fixed list.