Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/railsmechanic/bankster
An IBAN account numbers and BIC validation tool for Elixir.
https://github.com/railsmechanic/bankster
banking elixir iban validate-bics
Last synced: about 1 month ago
JSON representation
An IBAN account numbers and BIC validation tool for Elixir.
- Host: GitHub
- URL: https://github.com/railsmechanic/bankster
- Owner: railsmechanic
- License: mit
- Created: 2016-02-21T15:32:31.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-28T05:19:08.000Z (8 months ago)
- Last Synced: 2024-11-01T09:35:12.248Z (3 months ago)
- Topics: banking, elixir, iban, validate-bics
- Language: Elixir
- Homepage: https://hex.pm/packages/bankster
- Size: 52.7 KB
- Stars: 31
- Watchers: 3
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - A IBAN account number and BIC validation library for Elixir. (Validations)
- fucking-awesome-elixir - bankster - A IBAN account number and BIC validation library for Elixir. (Validations)
- awesome-elixir - bankster - A IBAN account number and BIC validation library for Elixir. (Validations)
README
# Bankster
An easy to use Elixir validator for IBAN account and BIC numbers. It includes IBAN rules for 115 countries and validation for BIC numbers.
- IBAN validation is done using format, country, length and checksum.
- BIC validation is done using format.## Installation
The package can be installed as Hex package:
1. Add bankster to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:bankster, "~> 0.4.0"}]
end
```2. Run `mix deps.get` to fetch the package from hex
## Usage
### Validate IBANs
You can either use `Bankster.iban_valid?/1` or `Bankster.Iban.valid?/1` to validate IBANs.```elixir
iex> Bankster.iban_valid?("NOTVALID")
falseiex> Bankster.Iban.valid?("NOTVALID")
false
```### Validation with errors
Beside the boolean validation function, Bankster offers a validation function which returns the corresponding error.
Like the other validation, you can use `Bankster.iban_validate/1` or `Bankster.Iban.validate/1` to validate IBANs.```elixir
iex> Bankster.iban_validate("NOTVALID")
{:error, :invalid_country}iex> Bankster.Iban.validate("DK8387188644726815223423423423423423423")
{:error, :invalid_length}iex> Bankster.Iban.validate("DK83 8718 8644 7268 15")
{:ok, "DK8387188644726815"}
```### Validate BICs
Validating BICs works the same way as already shown for IBANs.
So you can either use `Bankster.bic_valid?/1` or `Bankster.Bic.valid?/1` to validate BICs.```elixir
iex> Bankster.bic_valid?("NOTVALID")
falseiex> Bankster.Bic.valid?("NOTVALID")
false
```## License
Bankster source code is released under MIT License. Check LICENSE file for more information.