Add to your application’s Gemfile:
gem "clabe_mx", require: "clabe"
And execute bundle
.
Successful validation:
validation = Clabe.validate("002114016003269412")
validation.is_valid? # => true
validation.bank_tag # => "BANAMEX"
validation.bank_name # => "Banco Nacional de México, S.A."
validation.bank_code # => "002"
validation.city # => "Huixtla"
Invalid validation:
validation = Clabe.validate("002010077777777779")
validation.is_valid? # => false
validation.errors # => ["must have a valid control digit"]
The gem is available as open source under the terms of the MIT License.
Bug reports and pull requests are welcome on GitHub at yellowme/clabe.
After checking out the repo. run rake spec
to run the tests.
Strongly based on this JS version center-key/clabe-validator