PhoenixKit.Modules.Billing.IbanData (phoenix_kit v1.7.71)

Copy Markdown View Source

IBAN specifications by country.

Provides IBAN length and SEPA membership data for banking validation. Data sourced from IBAN.com/structure.

Examples

iex> IbanData.get_iban_length("EE")
20

iex> IbanData.sepa_member?("EE")
true

iex> IbanData.country_uses_iban?("US")
false

Summary

Functions

Get all IBAN specifications.

Check if a country uses IBAN.

Get IBAN length for a country.

Get the IBAN specification for a country.

Check if a country is a SEPA member.

Types

t()

@type t() :: %PhoenixKit.Modules.Billing.IbanData{
  length: pos_integer(),
  sepa: boolean()
}

Functions

all_specs()

Get all IBAN specifications.

Returns a map of country codes to %IbanData{} structs.

country_uses_iban?(country_code)

Check if a country uses IBAN.

Examples

iex> IbanData.country_uses_iban?("EE")
true

iex> IbanData.country_uses_iban?("US")
false

get_iban_length(country_code)

Get IBAN length for a country.

Returns the expected IBAN length for the country code, or nil if the country does not use IBAN.

Examples

iex> IbanData.get_iban_length("EE")
20

iex> IbanData.get_iban_length("DE")
22

iex> IbanData.get_iban_length("US")
nil

get_spec(country_code)

Get the IBAN specification for a country.

Returns a %IbanData{} struct or nil if the country does not use IBAN.

sepa_member?(country_code)

Check if a country is a SEPA member.

Examples

iex> IbanData.sepa_member?("EE")
true

iex> IbanData.sepa_member?("TR")
false

iex> IbanData.sepa_member?("US")
false