Validate Tax Identification Numbers (TINs) for the following European countries:
- Austria ๐ฆ๐น
- Belgium ๐ง๐ช
- Bulgaria ๐ง๐ฌ
- Croatia ๐ญ๐ท
- Cyprus ๐จ๐พ
- Czechia ๐จ๐ฟ
- Denmark ๐ฉ๐ฐ
- Estonia ๐ช๐ช
- Finland ๐ซ๐ฎ
- France ๐ซ๐ท
- Germany ๐ฉ๐ช
- Greece ๐ฌ๐ท
- Hungary ๐ญ๐บ
- Ireland ๐ฎ๐ช
- Italy ๐ฎ๐น
- Latvia ๐ฑ๐ป
- Lithuania ๐ฑ๐น
- Luxembourg ๐ฑ๐บ
- Malta ๐ฒ๐น
- Netherlands ๐ณ๐ฑ
- Poland ๐ต๐ฑ
- Portugal ๐ต๐น
- Romania ๐ท๐ด
- Slovakia ๐ธ๐ฐ
- Slovenia ๐ธ๐ฎ
- Spain ๐ช๐ธ
- Sweden ๐ธ๐ช
- United Kingdom ๐ฌ๐ง
See also the TIN check, the TIN specifications (link from the Technical information page) and the descriptions of the structure provided by the European Union.
Add the gem to your applicationโs Gemfile by executing:
bundle add tin_valid
If bundler is not being used to manage dependencies, install the gem by executing:
gem install tin_valid
Check a TIN by providing the country code.
Also accepts the following optional arguments:
birth_date
: Datekind
:"individual"
or"company"
TinValid::Tin.new(country_code: "fr", tin: "3023217600053").valid?
You can also call countries individually:
TinValid::AustriaTin.new(
tin: "931736581",
).valid?
birth_date
is optional
TinValid::BelgiumTin.new(
tin: "00012511119",
birth_date: Date.new(1900, 1, 25),
).valid?
birth_date
is optional
TinValid::BulgariaTin.new(
tin: "7501010010",
birth_date: Date.new(1975, 1, 1),
).valid?
TinValid::CroatiaTin.new(
tin: "94577403194",
).valid?
kind
is optional and can be "individual"
or "company"
TinValid::CyprusTin.new(tin: "00123123T", kind: "individual").valid?
birth_date
is optional
TinValid::CzechiaTin.new(
tin: "420901/999",
birth_date: Date.new(1942, 9, 1),
).valid?
birth_date
is optional
TinValid::DenmarkTin.new(
tin: "0101111113",
birth_date: Date.new(1911, 1, 1),
).valid?
birth_date
is optional
TinValid::EstoniaTin.new(
tin: "37102250382",
birth_date: Date.new(1971, 2, 25),
).valid?
birth_date
is optional
TinValid::FinlandTin.new(
tin: "131052-308T",
birth_date: Date.new(1952, 10, 13),
).valid?
TinValid::FranceTin.new(tin: "3023217600053").valid?
TinValid::FranceTin.new(tin: "732829320").siren?
TinValid::FranceTin.new(tin: "73282932000074").siret?
TinValid::GermanyTin.new(tin: "5133081508159").valid?
TinValid::GreeceTin.new(tin: "999999999").valid?
TinValid::HungaryTin.new(tin: "8071592153").valid?
TinValid::IrelandTin.new(tin: "1234567T").valid?
birth_date
is optional
TinValid::ItalyTin.new(
tin: "DMLPRY77D15H501F",
birth_date: Date.new(1977, 4, 15),
).valid?
birth_date
is optional
TinValid::LatviaTin.new(
tin: "01011012345",
birth_date: Date.new(1910, 1, 1),
).valid?
birth_date
is optional
TinValid::LithuaniaTin.new(
tin: "10101010005",
birth_date: Date.new(2001, 1, 1),
).valid?
birth_date
is optional
TinValid::LuxembourgTin.new(
tin: "1893120105732",
birth_date: Date.new(1893, 12, 1),
).valid?
TinValid::MaltaTin.new(tin: "1234567A").valid?
TinValid::NetherlandsTin.new(tin: "174559434").valid?
birth_date
is optional
TinValid::PolandTin.new(
tin: "02070803628",
birth_date: Date.new(1902, 7, 8),
).valid?
TinValid::PortugalTin.new(tin: "299999998").valid?
birth_date
is optional
TinValid::RomaniaTin.new(
tin: "8001011234567",
birth_date: Date.new(2000, 10, 11),
).valid?
birth_date
is optional
TinValid::SlovakiaTin.new(
tin: "7711167420",
birth_date: Date.new(1977, 11, 16),
).valid?
TinValid::SloveniaTin.new(tin: "15012557").valid?
TinValid::SpainTin.new(tin: "54237A").valid?
birth_date
is optional
TinValid::SwedenTin.new(
tin: "640823-3234",
birth_date: Date.new(1964, 8, 23),
).valid?
TinValid::UnitedKingdomTin.new(tin: "9234567890").valid?
After checking out the repo, run bin/setup
to install dependencies. Then, run
bin/rspec
to run the tests. You can also run bin/console
for an interactive
prompt that will allow you to experiment.
To install this gem onto your local machine, run bin/rake install
. To
release a new version, update the version number in version.rb
, call bundle
and then create a commit using:
git commit -m "v`ruby -r./lib/tin_valid/version <<< 'puts TinValid::VERSION + \" ๐\"'`"
Finally, call bin/rake release
, which will create a git tag for the version,
push git commits and the created tag, and add the .gem
file to
rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/cults/tin_valid. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the TinValid project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.