Check italian fiscal code
Intentionally this gem does not claim to "calculate" the tax code, which can be issued by the tax authorities of the Italian Republic (Revenue Agency).
The purpose that it intends to achieve is exclusively to check if the personal data of the subject are consistent with the tested code.
Add this line to your application's Gemfile:
gem 'cfita'
And then execute:
bundle
require 'cfita'
p Cfita::CodiceFiscale.new('AAABBB50A50F839X')
=> #<Cfita::CodiceFiscale:0x00007fa4efd09558 @fiscal_code="AAABBB50A50F839X", @birth_place=nil, @birth_date=nil, @name=nil, @surname=nil, @sex=nil, @errors=["Checksum errato"]>
p Cfita::CodiceFiscale.new(
'AAABBB50A50F839U',
birth_place: 'Roma',
birth_date: '19600530',
sex: 'M',
name: 'MARIO',
surname: 'Rossi'
)
=> #<Cfita::CodiceFiscale:0x00007fa4e75abf98 @fiscal_code="AAABBB50A50F839U", @birth_place="ROMA", @birth_date=Mon, 30 May 1960, @name="MARIO", @surname="ROSSI", @sex="M", @errors=["Il nome non corrisponde al codice 'MRA'", "Il cognome non corrisponde al codice 'RSS'", "Luogo di nascita ROMA non coerente, al codice catastale F839 corrisponde a NAPOLI", "Sesso errato"]>
- Fork it ( https://github.com/stefsava/cfita/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request