View Source Bankster.Iban (Bankster v0.4.0)
Module provides some IBAN related functions.
Summary
Functions
Returns the BBAN of the given IBAN.
Returns the checksum of the given IBAN.
Returns the country code of the given IBAN.
Formats and returns a given IBAN in compact format.
Formats and returns a given IBAN in pretty format.
Returns the size/length of the given IBAN.
Returns the country codes of the supported countries.
Validates whether the given country code is within the supported countries.
Validates a string whether it's a valid IBAN and returns a boolen value.
Validates a string whether it's a valid IBAN an returns an error tuple on invalid data.
Functions
Returns the BBAN of the given IBAN.
Examples
iex> Bankster.Iban.bban("DK8387188644726815")
"87188644726815"
Returns the checksum of the given IBAN.
Examples
iex> Bankster.Iban.checksum("DK8387188644726815")
83
Returns the country code of the given IBAN.
Examples
iex> Bankster.Iban.country_code("DK8387188644726815")
"DK"
Formats and returns a given IBAN in compact format.
Examples
iex> Bankster.Iban.format_compact("DK8 38 7188 64472 6815 ")
"DK8387188644726815"
Formats and returns a given IBAN in pretty format.
Examples
iex> Bankster.Iban.format_pretty("DK8387188644726815")
"DK838 7188 64472 6815"
Returns the size/length of the given IBAN.
Examples
iex> Bankster.Iban.size("DK 8387 188644 726815")
18
@spec supported_countries() :: [binary()]
Returns the country codes of the supported countries.
Examples
iex> Bankster.Iban.supported_countries()
["SM", "KZ", "SN", "BA", "GA", "KW", "MU", ...]
Validates whether the given country code is within the supported countries.
Examples
iex> Bankster.Iban.supported_country?("DE")
true
iex> Bankster.Iban.supported_country?("XYZ")
false
Validates a string whether it's a valid IBAN and returns a boolen value.
Examples
iex> Bankster.Iban.valid?("INVALIDIBAN")
false
iex> Bankster.Iban.valid?("DK8387188644726815")
true
Validates a string whether it's a valid IBAN an returns an error tuple on invalid data.
Examples
iex> Bankster.Iban.validate("INVALIDIBAN")
{:error, :invalid_country}
iex> Bankster.Iban.validate("DK838718234242342348644726815")
{:error, :invalid_length}
iex> Bankster.Iban.validate("DK8387188644726815")
{:ok, "DK8387188644726815"}