railsmechanic/bankster

Function for returning the country code should validate

Opened this issue · 0 comments

The function which returns the country code for a given IBAN should check whether the given country code of the IBAN is within the list of supported countries:

def country_code(iban) do
iban
|> format_default()
|> String.slice(0..1)
end

Change from returning a simple string to
{:ok, "DE"} or {:error, :invalid_country}

This is a breaking change!