- Add
gem "clabe"
to your application's Gemfile and then executebundle
. - Or install it yourself as:
gem install clabe
Successfully validation
CLABE = '002114016003269412'
Clabe.validate(CLABE)
# returns { is_valid: true, bank_tag: 'BANAMEX', city: 'Huixtla' }
Invalid validation
CLABE = '002010077777777779'
Clabe.validate(CLABE)
# returns { is_valid: false, error: '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