Coder Social home page Coder Social logo

m1dnight / bankster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from railsmechanic/bankster

0.0 0.0 0.0 39 KB

An IBAN account numbers and BIC validation tool for Elixir.

Home Page: https://hex.pm/packages/bankster

License: MIT License

Elixir 100.00%

bankster's Introduction

Bankster Build Status

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:
def deps do
  [{:bankster, "~> 0.3.3"}]
end
  1. 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.

iex> Bankster.iban_valid?("NOTVALID")
false

iex> 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.

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.

iex> Bankster.bic_valid?("NOTVALID")
false

iex> Bankster.Bic.valid?("NOTVALID")
false

License

Bankster source code is released under MIT License. Check LICENSE file for more information.

bankster's People

Contributors

railsmechanic avatar m1dnight avatar maennchen avatar szymon-jez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.