Skip to content

cults/tin_valid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

50 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TinValid ๐Ÿ‡ช๐Ÿ‡บ

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.

Installation

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

Usage

Check a TIN by providing the country code.

Also accepts the following optional arguments:

  • birth_date: Date
  • kind: "individual" or "company"
TinValid::Tin.new(country_code: "fr", tin: "3023217600053").valid?

You can also call countries individually:

Austria ๐Ÿ‡ฆ๐Ÿ‡น (at)

TinValid::AustriaTin.new(
  tin: "931736581",
).valid?

Belgium ๐Ÿ‡ง๐Ÿ‡ช (be)

birth_date is optional

TinValid::BelgiumTin.new(
  tin: "00012511119",
  birth_date: Date.new(1900, 1, 25),
).valid?

Bulgaria ๐Ÿ‡ง๐Ÿ‡ฌ (bg)

birth_date is optional

TinValid::BulgariaTin.new(
  tin: "7501010010",
  birth_date: Date.new(1975, 1, 1),
).valid?

Croatia ๐Ÿ‡ญ๐Ÿ‡ท (hr)

TinValid::CroatiaTin.new(
  tin: "94577403194",
).valid?

Cyprus ๐Ÿ‡จ๐Ÿ‡พ (cy)

kind is optional and can be "individual" or "company"

TinValid::CyprusTin.new(tin: "00123123T", kind: "individual").valid?

Czechia ๐Ÿ‡จ๐Ÿ‡ฟ (cz)

birth_date is optional

TinValid::CzechiaTin.new(
  tin: "420901/999",
  birth_date: Date.new(1942, 9, 1),
).valid?

Denmark ๐Ÿ‡ฉ๐Ÿ‡ฐ (dk)

birth_date is optional

TinValid::DenmarkTin.new(
  tin: "0101111113",
  birth_date: Date.new(1911, 1, 1),
).valid?

Estonia ๐Ÿ‡ช๐Ÿ‡ช (ee)

birth_date is optional

TinValid::EstoniaTin.new(
  tin: "37102250382",
  birth_date: Date.new(1971, 2, 25),
).valid?

Finland ๐Ÿ‡ซ๐Ÿ‡ฎ (fi)

birth_date is optional

TinValid::FinlandTin.new(
  tin: "131052-308T",
  birth_date: Date.new(1952, 10, 13),
).valid?

France ๐Ÿ‡ซ๐Ÿ‡ท (fr)

TinValid::FranceTin.new(tin: "3023217600053").valid?
TinValid::FranceTin.new(tin: "732829320").siren?
TinValid::FranceTin.new(tin: "73282932000074").siret?

Germany ๐Ÿ‡ฉ๐Ÿ‡ช (de)

TinValid::GermanyTin.new(tin: "5133081508159").valid?

Greece ๐Ÿ‡ฌ๐Ÿ‡ท (gr)

TinValid::GreeceTin.new(tin: "999999999").valid?

Hungary ๐Ÿ‡ญ๐Ÿ‡บ (hu)

TinValid::HungaryTin.new(tin: "8071592153").valid?

Ireland ๐Ÿ‡ฎ๐Ÿ‡ช (ie)

TinValid::IrelandTin.new(tin: "1234567T").valid?

Italy ๐Ÿ‡ฎ๐Ÿ‡น (it)

birth_date is optional

TinValid::ItalyTin.new(
  tin: "DMLPRY77D15H501F",
  birth_date: Date.new(1977, 4, 15),
).valid?

Latvia ๐Ÿ‡ฑ๐Ÿ‡ป (lv)

birth_date is optional

TinValid::LatviaTin.new(
  tin: "01011012345",
  birth_date: Date.new(1910, 1, 1),
).valid?

Lithuania ๐Ÿ‡ฑ๐Ÿ‡น (lt)

birth_date is optional

TinValid::LithuaniaTin.new(
  tin: "10101010005",
  birth_date: Date.new(2001, 1, 1),
).valid?

Luxembourg ๐Ÿ‡ฑ๐Ÿ‡บ (lu)

birth_date is optional

TinValid::LuxembourgTin.new(
  tin: "1893120105732",
  birth_date: Date.new(1893, 12, 1),
).valid?

Malta ๐Ÿ‡ฒ๐Ÿ‡น (mt)

TinValid::MaltaTin.new(tin: "1234567A").valid?

Netherlands ๐Ÿ‡ณ๐Ÿ‡ฑ (nl)

TinValid::NetherlandsTin.new(tin: "174559434").valid?

Poland ๐Ÿ‡ต๐Ÿ‡ฑ (pl)

birth_date is optional

TinValid::PolandTin.new(
  tin: "02070803628",
  birth_date: Date.new(1902, 7, 8),
).valid?

Portugal ๐Ÿ‡ต๐Ÿ‡น (pt)

TinValid::PortugalTin.new(tin: "299999998").valid?

Romania ๐Ÿ‡ท๐Ÿ‡ด (ro)

birth_date is optional

TinValid::RomaniaTin.new(
  tin: "8001011234567",
  birth_date: Date.new(2000, 10, 11),
).valid?

Slovakia ๐Ÿ‡ธ๐Ÿ‡ฐ (sk)

birth_date is optional

TinValid::SlovakiaTin.new(
  tin: "7711167420",
  birth_date: Date.new(1977, 11, 16),
).valid?

Slovenia ๐Ÿ‡ธ๐Ÿ‡ฎ (si)

TinValid::SloveniaTin.new(tin: "15012557").valid?

Spain ๐Ÿ‡ช๐Ÿ‡ธ (es)

TinValid::SpainTin.new(tin: "54237A").valid?

Sweden ๐Ÿ‡ธ๐Ÿ‡ช (se)

birth_date is optional

TinValid::SwedenTin.new(
  tin: "640823-3234",
  birth_date: Date.new(1964, 8, 23),
).valid?

United Kingdom ๐Ÿ‡ฌ๐Ÿ‡ง (gb)

TinValid::UnitedKingdomTin.new(tin: "9234567890").valid?

Development

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.

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the TinValid project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Validate European Tax Identification Numbers (TINs) in Ruby ๐Ÿ‡ช๐Ÿ‡บ

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published