exiban v0.0.3 ExIban.Validators

Set of validation rules to perform on checking IBAN account number.

Summary

Functions

Performs validation checks:

  • length greater or equal to 5 (:too_short)
  • only ilegal chars used [A-Z0-9] (bad_chars)
  • known country code (:unknown_country_code)
  • correct length for given country (:bad_length)
  • correct bban format for given country (:bad_format)
  • checking digits (:bad_check_digits)

Functions

issues(iban)

Specs

issues(binary) :: {list, {bitstring, bitstring, bitstring, integer, bitstring} | nil}

Performs validation checks:

  • length greater or equal to 5 (:too_short)
  • only ilegal chars used [A-Z0-9] (bad_chars)
  • known country code (:unknown_country_code)
  • correct length for given country (:bad_length)
  • correct bban format for given country (:bad_format)
  • checking digits (:bad_check_digits)

Examples

iex> ExIban.Validators.issues("GB82")
{[:too_short], nil}

iex> ExIban.Validators.issues("GB_+)*")
{[:bad_chars, :bad_length, :bad_format, :bad_check_digits], {"GB", "_+", ")*", 6, "GB_+)*"}}

iex> ExIban.Validators.issues("GB82 WEST 1234 5698 7654 32")
{[], {"GB", "82", "WEST12345698765432", 22, "GB82WEST12345698765432"}}