ABA (aba v0.4.0)

ABA is an Elixir library for performing validation and lookups on ABA routing numbers. It stores all routing numbers and bank information in an ETS table. Therefore, you should initialize the application in a supervision tree.

Installation

Add aba to your list of dependencies in mix.exs:

def deps do
  [
    {:aba, "~> 0.1.0"}
  ]
end

Usage

To perform routing number validation without an ETS table lookup:

iex> ABA.routing_number_valid?("111900659")
true

Otherwise, performing lookups can be done with:

iex> ABA.get_bank("111900659")
{:ok, %ABA.Bank{routing_number: "111900659", name: "WELLS FARGO BANK",
                address: "255 2ND AVE SOUTH", city: "MINNEAPOLIS",
                state: "MN", zip: "55479"}}

Link to this section Summary

Functions

Looks up bank info via the routing number passed.

Validates the routing number. Can be passed any Elixir term.

Link to this section Functions

Link to this function

get_bank(routing_number)

Specs

get_bank(any()) :: {:ok, ABA.Bank.t()} | {:error, :not_found | :invalid}

Looks up bank info via the routing number passed.

Examples

iex> ABA.get_bank("111900659")
{:ok, %ABA.Bank{routing_number: "111900659", name: "WELLS FARGO BANK",
                       address: "255 2ND AVE SOUTH", city: "MINNEAPOLIS",
                       state: "MN", zip: "55479"}}

iex> ABA.get_bank("111XXX659")
{:error, :invalid}
Link to this function

routing_number_valid?(routing_number)

Validates the routing number. Can be passed any Elixir term.

Examples

iex> ABA.routing_number_valid?("111900659")
true

iex> ABA.routing_number_valid?("111900658")
false