tin_valid 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -13
  3. data/README.md +31 -58
  4. data/doc/algorithms/FS-TIN Algorithms-Public.docx +0 -0
  5. data/doc/tin_by_country/de/TIN_-_country_sheet_AT_de.pdf +0 -0
  6. data/doc/tin_by_country/de/TIN_-_country_sheet_BE_de.pdf +0 -0
  7. data/doc/tin_by_country/de/TIN_-_country_sheet_BG_de.pdf +0 -0
  8. data/doc/tin_by_country/de/TIN_-_country_sheet_CY_de.pdf +0 -0
  9. data/doc/tin_by_country/de/TIN_-_country_sheet_CZ_de.pdf +0 -0
  10. data/doc/tin_by_country/de/TIN_-_country_sheet_DE_de.pdf +0 -0
  11. data/doc/tin_by_country/de/TIN_-_country_sheet_DK_de.pdf +0 -0
  12. data/doc/tin_by_country/de/TIN_-_country_sheet_EE_de.pdf +0 -0
  13. data/doc/tin_by_country/de/TIN_-_country_sheet_EL_de.pdf +0 -0
  14. data/doc/tin_by_country/de/TIN_-_country_sheet_ES_de.pdf +0 -0
  15. data/doc/tin_by_country/de/TIN_-_country_sheet_FI_de.pdf +0 -0
  16. data/doc/tin_by_country/de/TIN_-_country_sheet_FR_de.pdf +0 -0
  17. data/doc/tin_by_country/de/TIN_-_country_sheet_HR_de.pdf +0 -0
  18. data/doc/tin_by_country/de/TIN_-_country_sheet_HU_de.pdf +0 -0
  19. data/doc/tin_by_country/de/TIN_-_country_sheet_IE_de.pdf +0 -0
  20. data/doc/tin_by_country/de/TIN_-_country_sheet_IT_de.pdf +0 -0
  21. data/doc/tin_by_country/de/TIN_-_country_sheet_LT_de.pdf +0 -0
  22. data/doc/tin_by_country/de/TIN_-_country_sheet_LU_de.pdf +0 -0
  23. data/doc/tin_by_country/de/TIN_-_country_sheet_LV_de.pdf +0 -0
  24. data/doc/tin_by_country/de/TIN_-_country_sheet_MT_de.pdf +0 -0
  25. data/doc/tin_by_country/de/TIN_-_country_sheet_NL_de.pdf +0 -0
  26. data/doc/tin_by_country/de/TIN_-_country_sheet_PL_de.pdf +0 -0
  27. data/doc/tin_by_country/de/TIN_-_country_sheet_PT_de.pdf +0 -0
  28. data/doc/tin_by_country/de/TIN_-_country_sheet_RO_de.pdf +0 -0
  29. data/doc/tin_by_country/de/TIN_-_country_sheet_SE_de.pdf +0 -0
  30. data/doc/tin_by_country/de/TIN_-_country_sheet_SI_de.pdf +0 -0
  31. data/doc/tin_by_country/de/TIN_-_country_sheet_SK_de.pdf +0 -0
  32. data/doc/tin_by_country/en/TIN_-_country_sheet_AT_en.pdf +0 -0
  33. data/doc/tin_by_country/en/TIN_-_country_sheet_BE_en.pdf +0 -0
  34. data/doc/tin_by_country/en/TIN_-_country_sheet_BG_en.pdf +0 -0
  35. data/doc/tin_by_country/en/TIN_-_country_sheet_CY_en.pdf +0 -0
  36. data/doc/tin_by_country/en/TIN_-_country_sheet_CZ_en.pdf +0 -0
  37. data/doc/tin_by_country/en/TIN_-_country_sheet_DE_en.pdf +0 -0
  38. data/doc/tin_by_country/en/TIN_-_country_sheet_DK_en.pdf +0 -0
  39. data/doc/tin_by_country/en/TIN_-_country_sheet_EE_en.pdf +0 -0
  40. data/doc/tin_by_country/en/TIN_-_country_sheet_EL_en.pdf +0 -0
  41. data/doc/tin_by_country/en/TIN_-_country_sheet_ES_en.pdf +0 -0
  42. data/doc/tin_by_country/en/TIN_-_country_sheet_FI_en.pdf +0 -0
  43. data/doc/tin_by_country/en/TIN_-_country_sheet_FR_en.pdf +0 -0
  44. data/doc/tin_by_country/en/TIN_-_country_sheet_HR_en.pdf +0 -0
  45. data/doc/tin_by_country/en/TIN_-_country_sheet_HU_en.pdf +0 -0
  46. data/doc/tin_by_country/en/TIN_-_country_sheet_IE_en.pdf +0 -0
  47. data/doc/tin_by_country/en/TIN_-_country_sheet_IT_en.pdf +0 -0
  48. data/doc/tin_by_country/en/TIN_-_country_sheet_LT_en.pdf +0 -0
  49. data/doc/tin_by_country/en/TIN_-_country_sheet_LU_en.pdf +0 -0
  50. data/doc/tin_by_country/en/TIN_-_country_sheet_LV_en.pdf +0 -0
  51. data/doc/tin_by_country/en/TIN_-_country_sheet_MT_en.pdf +0 -0
  52. data/doc/tin_by_country/en/TIN_-_country_sheet_NL_en.pdf +0 -0
  53. data/doc/tin_by_country/en/TIN_-_country_sheet_PL_en.pdf +0 -0
  54. data/doc/tin_by_country/en/TIN_-_country_sheet_PT_en.pdf +0 -0
  55. data/doc/tin_by_country/en/TIN_-_country_sheet_RO_en.pdf +0 -0
  56. data/doc/tin_by_country/en/TIN_-_country_sheet_SE_en.pdf +0 -0
  57. data/doc/tin_by_country/en/TIN_-_country_sheet_SI_en.pdf +0 -0
  58. data/doc/tin_by_country/en/TIN_-_country_sheet_SK_en.pdf +0 -0
  59. data/doc/tin_by_country/es/TIN_-_country_sheet_AT_es.pdf +0 -0
  60. data/doc/tin_by_country/es/TIN_-_country_sheet_BE_es.pdf +0 -0
  61. data/doc/tin_by_country/es/TIN_-_country_sheet_BG_es.pdf +0 -0
  62. data/doc/tin_by_country/es/TIN_-_country_sheet_CY_es.pdf +0 -0
  63. data/doc/tin_by_country/es/TIN_-_country_sheet_CZ_es.pdf +0 -0
  64. data/doc/tin_by_country/es/TIN_-_country_sheet_DE_es.pdf +0 -0
  65. data/doc/tin_by_country/es/TIN_-_country_sheet_DK_es.pdf +0 -0
  66. data/doc/tin_by_country/es/TIN_-_country_sheet_EE_es.pdf +0 -0
  67. data/doc/tin_by_country/es/TIN_-_country_sheet_EL_es.pdf +0 -0
  68. data/doc/tin_by_country/es/TIN_-_country_sheet_ES_es.pdf +0 -0
  69. data/doc/tin_by_country/es/TIN_-_country_sheet_FI_es.pdf +0 -0
  70. data/doc/tin_by_country/es/TIN_-_country_sheet_FR_es.pdf +0 -0
  71. data/doc/tin_by_country/es/TIN_-_country_sheet_HR_es.pdf +0 -0
  72. data/doc/tin_by_country/es/TIN_-_country_sheet_HU_es.pdf +0 -0
  73. data/doc/tin_by_country/es/TIN_-_country_sheet_IE_es.pdf +0 -0
  74. data/doc/tin_by_country/es/TIN_-_country_sheet_IT_es.pdf +0 -0
  75. data/doc/tin_by_country/es/TIN_-_country_sheet_LT_es.pdf +0 -0
  76. data/doc/tin_by_country/es/TIN_-_country_sheet_LU_es.pdf +0 -0
  77. data/doc/tin_by_country/es/TIN_-_country_sheet_LV_es.pdf +0 -0
  78. data/doc/tin_by_country/es/TIN_-_country_sheet_MT_es.pdf +0 -0
  79. data/doc/tin_by_country/es/TIN_-_country_sheet_NL_es.pdf +0 -0
  80. data/doc/tin_by_country/es/TIN_-_country_sheet_PL_es.pdf +0 -0
  81. data/doc/tin_by_country/es/TIN_-_country_sheet_PT_es.pdf +0 -0
  82. data/doc/tin_by_country/es/TIN_-_country_sheet_RO_es.pdf +0 -0
  83. data/doc/tin_by_country/es/TIN_-_country_sheet_SE_es.pdf +0 -0
  84. data/doc/tin_by_country/es/TIN_-_country_sheet_SI_es.pdf +0 -0
  85. data/doc/tin_by_country/es/TIN_-_country_sheet_SK_es.pdf +0 -0
  86. data/doc/tin_by_country/fr/TIN_-_country_sheet_AT_fr.pdf +0 -0
  87. data/doc/tin_by_country/fr/TIN_-_country_sheet_BE_fr.pdf +0 -0
  88. data/doc/tin_by_country/fr/TIN_-_country_sheet_BG_fr.pdf +0 -0
  89. data/doc/tin_by_country/fr/TIN_-_country_sheet_CY_fr.pdf +0 -0
  90. data/doc/tin_by_country/fr/TIN_-_country_sheet_CZ_fr.pdf +0 -0
  91. data/doc/tin_by_country/fr/TIN_-_country_sheet_DE_fr.pdf +0 -0
  92. data/doc/tin_by_country/fr/TIN_-_country_sheet_DK_fr.pdf +0 -0
  93. data/doc/tin_by_country/fr/TIN_-_country_sheet_EE_fr.pdf +0 -0
  94. data/doc/tin_by_country/fr/TIN_-_country_sheet_EL_fr.pdf +0 -0
  95. data/doc/tin_by_country/fr/TIN_-_country_sheet_ES_fr.pdf +0 -0
  96. data/doc/tin_by_country/fr/TIN_-_country_sheet_FI_fr.pdf +0 -0
  97. data/doc/tin_by_country/fr/TIN_-_country_sheet_FR_fr.pdf +0 -0
  98. data/doc/tin_by_country/fr/TIN_-_country_sheet_HR_fr.pdf +0 -0
  99. data/doc/tin_by_country/fr/TIN_-_country_sheet_HU_fr.pdf +0 -0
  100. data/doc/tin_by_country/fr/TIN_-_country_sheet_IE_fr.pdf +0 -0
  101. data/doc/tin_by_country/fr/TIN_-_country_sheet_IT_fr.pdf +0 -0
  102. data/doc/tin_by_country/fr/TIN_-_country_sheet_LT_fr.pdf +0 -0
  103. data/doc/tin_by_country/fr/TIN_-_country_sheet_LU_fr.pdf +0 -0
  104. data/doc/tin_by_country/fr/TIN_-_country_sheet_LV_fr.pdf +0 -0
  105. data/doc/tin_by_country/fr/TIN_-_country_sheet_MT_fr.pdf +0 -0
  106. data/doc/tin_by_country/fr/TIN_-_country_sheet_NL_fr.pdf +0 -0
  107. data/doc/tin_by_country/fr/TIN_-_country_sheet_PL_fr.pdf +0 -0
  108. data/doc/tin_by_country/fr/TIN_-_country_sheet_PT_fr.pdf +0 -0
  109. data/doc/tin_by_country/fr/TIN_-_country_sheet_RO_fr.pdf +0 -0
  110. data/doc/tin_by_country/fr/TIN_-_country_sheet_SE_fr.pdf +0 -0
  111. data/doc/tin_by_country/fr/TIN_-_country_sheet_SI_fr.pdf +0 -0
  112. data/doc/tin_by_country/fr/TIN_-_country_sheet_SK_fr.pdf +0 -0
  113. data/doc/tin_by_country/pt/TIN_-_country_sheet_AT_pt.pdf +0 -0
  114. data/doc/tin_by_country/pt/TIN_-_country_sheet_BE_pt.pdf +0 -0
  115. data/doc/tin_by_country/pt/TIN_-_country_sheet_BG_pt.pdf +0 -0
  116. data/doc/tin_by_country/pt/TIN_-_country_sheet_CY_pt.pdf +0 -0
  117. data/doc/tin_by_country/pt/TIN_-_country_sheet_CZ_pt.pdf +0 -0
  118. data/doc/tin_by_country/pt/TIN_-_country_sheet_DE_pt.pdf +0 -0
  119. data/doc/tin_by_country/pt/TIN_-_country_sheet_DK_pt.pdf +0 -0
  120. data/doc/tin_by_country/pt/TIN_-_country_sheet_EE_pt.pdf +0 -0
  121. data/doc/tin_by_country/pt/TIN_-_country_sheet_EL_pt.pdf +0 -0
  122. data/doc/tin_by_country/pt/TIN_-_country_sheet_ES_pt.pdf +0 -0
  123. data/doc/tin_by_country/pt/TIN_-_country_sheet_FI_pt.pdf +0 -0
  124. data/doc/tin_by_country/pt/TIN_-_country_sheet_FR_pt.pdf +0 -0
  125. data/doc/tin_by_country/pt/TIN_-_country_sheet_HR_pt.pdf +0 -0
  126. data/doc/tin_by_country/pt/TIN_-_country_sheet_HU_pt.pdf +0 -0
  127. data/doc/tin_by_country/pt/TIN_-_country_sheet_IE_pt.pdf +0 -0
  128. data/doc/tin_by_country/pt/TIN_-_country_sheet_IT_pt.pdf +0 -0
  129. data/doc/tin_by_country/pt/TIN_-_country_sheet_LT_pt.pdf +0 -0
  130. data/doc/tin_by_country/pt/TIN_-_country_sheet_LU_pt.pdf +0 -0
  131. data/doc/tin_by_country/pt/TIN_-_country_sheet_LV_pt.pdf +0 -0
  132. data/doc/tin_by_country/pt/TIN_-_country_sheet_MT_pt.pdf +0 -0
  133. data/doc/tin_by_country/pt/TIN_-_country_sheet_NL_pt.pdf +0 -0
  134. data/doc/tin_by_country/pt/TIN_-_country_sheet_PL_pt.pdf +0 -0
  135. data/doc/tin_by_country/pt/TIN_-_country_sheet_PT_pt.pdf +0 -0
  136. data/doc/tin_by_country/pt/TIN_-_country_sheet_RO_pt.pdf +0 -0
  137. data/doc/tin_by_country/pt/TIN_-_country_sheet_SE_pt.pdf +0 -0
  138. data/doc/tin_by_country/pt/TIN_-_country_sheet_SI_pt.pdf +0 -0
  139. data/doc/tin_by_country/pt/TIN_-_country_sheet_SK_pt.pdf +0 -0
  140. data/lib/tin_valid/bulgaria_tin.rb +9 -1
  141. data/lib/tin_valid/denmark_tin.rb +4 -5
  142. data/lib/tin_valid/finland_tin.rb +1 -1
  143. data/lib/tin_valid/version.rb +1 -1
  144. data/lib/tin_valid.rb +32 -1
  145. metadata +138 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5cf4c82de8a9175666cdb8ed766135735e98225912769b8c9b8a56aeb50b5a4
4
- data.tar.gz: a0a50b4cdcfd8486499fc57151bb6f082bebed988e390f0b9c1eedea61cb4840
3
+ metadata.gz: 1c999488fc7c2222c662a9efe788629b683ff3162d8841f5fea590cb843ba237
4
+ data.tar.gz: 0d3e35b367f2edeb18334b38b35eb84aad9412396e8bb37a98a9c7668b12dc4f
5
5
  SHA512:
6
- metadata.gz: 115f39ab89c389df482328d9bb1ea39e75f8b587d9d481122fe4f3477f48a2756815057cdf1325ae027a0f48ee0b964fc9bbcde67475aa3e2859508d97c937aa
7
- data.tar.gz: 9ff5a18c6d0c22eebadd8bccdc24bc1b99f375b0a382d8c307fa9ac13e27baa1f3cc548f9d01e8ba6e299ed526986aeba205f5dcdd30f40b3a1efde18ddabcf4
6
+ metadata.gz: 76644d43c083e42a69e09a9888717620467c4ca5d2b09d5f8396bc6bf56a4d92af06ff9b60def50b19241dfdd510810bc65b3dbb272d79205637c1b2c13931d3
7
+ data.tar.gz: 10ec21998fdd04f4494c977f73eb132daa5aaf9004834f02ac49a95fb5485cfa6d5a0fa03a72216fbb3854ed797743b0dfedc340ecd6dc6fcb54d9e75c176110
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.3.0] - 2025-12-12
4
+
5
+ Features:
6
+ - Add `TinValid::COUNTRY_CODES` to get available country codes.
7
+
8
+ Fixes:
9
+ - Fix Bulgaria to accept TINs starting with `10` instead of `00` 🇧🇬
10
+ - Fix Finland checks for tins ending in `P` 🇫🇮
11
+ - Fix Denmark check for certain ranges of birth years 🇩🇰
12
+
3
13
  ## [1.2.1] - 2025-05-22
4
14
 
5
15
  Fixes:
@@ -11,7 +21,7 @@ Fixes:
11
21
 
12
22
  Features:
13
23
  - Add generic `TinValid::Tin.new(country_code: "…", tin: "…").valid?`
14
- - Add `#siren?` and `#siret?` on `TinValid::FranceTin`
24
+ - Add `#siren?` and `#siret?` on `TinValid::FranceTin` 🇫🇷
15
25
 
16
26
  Fixes:
17
27
  - Accept SIRET for France 🇫🇷
@@ -65,15 +75,15 @@ Features:
65
75
 
66
76
  ## [0.1.0] - 2025-04-14
67
77
 
68
- - Initial release with:
69
- - Austria 🇦🇹
70
- - Belgium 🇧🇪
71
- - Bulgaria 🇧🇬
72
- - Croatia 🇭🇷
73
- - Cyprus 🇨🇾
74
- - Czechia 🇨🇿
75
- - Denmark 🇩🇰
76
- - Estonia 🇪🇪
77
- - Germany 🇩🇪
78
- - Greece 🇬🇷
79
- - Sweden 🇸🇪
78
+ Features:
79
+ - Add Austria 🇦🇹
80
+ - Add Belgium 🇧🇪
81
+ - Add Bulgaria 🇧🇬
82
+ - Add Croatia 🇭🇷
83
+ - Add Cyprus 🇨🇾
84
+ - Add Czechia 🇨🇿
85
+ - Add Denmark 🇩🇰
86
+ - Add Estonia 🇪🇪
87
+ - Add Germany 🇩🇪
88
+ - Add Greece 🇬🇷
89
+ - Add Sweden 🇸🇪
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TinValid 🇪🇺
2
2
 
3
- Validate Tax Identification Numbers (TINs) for the following European countries:
3
+ Ruby gem to validate Tax Identification Numbers (TINs) for the following European countries:
4
4
 
5
5
  - Austria 🇦🇹
6
6
  - Belgium 🇧🇪
@@ -32,8 +32,12 @@ Validate Tax Identification Numbers (TINs) for the following European countries:
32
32
  - United Kingdom 🇬🇧
33
33
 
34
34
  See also the
35
- [TIN specifications](https://ec.europa.eu/taxation_customs/tin/#/check-tin)
36
- and the
35
+ [TIN check](https://ec.europa.eu/taxation_customs/tin/#/check-tin),
36
+ the
37
+ [TIN specifications](https://taxation-customs.ec.europa.eu/document/download/d416448b-e055-472d-b0e0-4ffc07a7a407_en?v=1741781900877)
38
+ (link from the
39
+ [Technical information](https://ec.europa.eu/taxation_customs/tin/#/technical-information)
40
+ page) and the
37
41
  [descriptions of the structure](https://taxation-customs.ec.europa.eu/online-services/online-services-and-databases-taxation/taxpayer-identification-number-tin_en)
38
42
  provided by the European Union.
39
43
 
@@ -45,13 +49,6 @@ Add the gem to your application’s Gemfile by executing:
45
49
  bundle add tin_valid
46
50
  ```
47
51
 
48
- If bundler is not being used to manage dependencies, install the gem by
49
- executing:
50
-
51
- ```bash
52
- gem install tin_valid
53
- ```
54
-
55
52
  ## Usage
56
53
 
57
54
  Check a TIN by providing the country code.
@@ -77,23 +74,19 @@ TinValid::AustriaTin.new(
77
74
 
78
75
  ### Belgium 🇧🇪 (be)
79
76
 
80
- `birth_date` is optional
81
-
82
77
  ```rb
83
78
  TinValid::BelgiumTin.new(
84
79
  tin: "00012511119",
85
- birth_date: Date.new(1900, 1, 25),
80
+ birth_date: Date.new(1900, 1, 25), # optional
86
81
  ).valid?
87
82
  ```
88
83
 
89
84
  ### Bulgaria 🇧🇬 (bg)
90
85
 
91
- `birth_date` is optional
92
-
93
86
  ```rb
94
87
  TinValid::BulgariaTin.new(
95
88
  tin: "7501010010",
96
- birth_date: Date.new(1975, 1, 1),
89
+ birth_date: Date.new(1975, 1, 1), # optional
97
90
  ).valid?
98
91
  ```
99
92
 
@@ -107,53 +100,46 @@ TinValid::CroatiaTin.new(
107
100
 
108
101
  ### Cyprus 🇨🇾 (cy)
109
102
 
110
- `kind` is optional and can be `"individual"` or `"company"`
111
-
112
103
  ```rb
113
- TinValid::CyprusTin.new(tin: "00123123T", kind: "individual").valid?
104
+ TinValid::CyprusTin.new(
105
+ tin: "00123123T",
106
+ kind: "individual", # optional, can be "individual" or "company"
107
+ ).valid?
114
108
  ```
115
109
 
116
110
  ### Czechia 🇨🇿 (cz)
117
111
 
118
- `birth_date` is optional
119
-
120
112
  ```rb
121
113
  TinValid::CzechiaTin.new(
122
114
  tin: "420901/999",
123
- birth_date: Date.new(1942, 9, 1),
115
+ birth_date: Date.new(1942, 9, 1), # optional
124
116
  ).valid?
125
117
  ```
126
118
 
127
119
  ### Denmark 🇩🇰 (dk)
128
120
 
129
- `birth_date` is optional
130
-
131
121
  ```rb
132
122
  TinValid::DenmarkTin.new(
133
123
  tin: "0101111113",
134
- birth_date: Date.new(1911, 1, 1),
124
+ birth_date: Date.new(1911, 1, 1), # optional
135
125
  ).valid?
136
126
  ```
137
127
 
138
128
  ### Estonia 🇪🇪 (ee)
139
129
 
140
- `birth_date` is optional
141
-
142
130
  ```rb
143
131
  TinValid::EstoniaTin.new(
144
132
  tin: "37102250382",
145
- birth_date: Date.new(1971, 2, 25),
133
+ birth_date: Date.new(1971, 2, 25), # optional
146
134
  ).valid?
147
135
  ```
148
136
 
149
137
  ### Finland 🇫🇮 (fi)
150
138
 
151
- `birth_date` is optional
152
-
153
139
  ```rb
154
140
  TinValid::FinlandTin.new(
155
141
  tin: "131052-308T",
156
- birth_date: Date.new(1952, 10, 13),
142
+ birth_date: Date.new(1952, 10, 13), # optional
157
143
  ).valid?
158
144
  ```
159
145
 
@@ -197,45 +183,37 @@ TinValid::IrelandTin.new(tin: "1234567T").valid?
197
183
 
198
184
  ### Italy 🇮🇹 (it)
199
185
 
200
- `birth_date` is optional
201
-
202
186
  ```rb
203
187
  TinValid::ItalyTin.new(
204
188
  tin: "DMLPRY77D15H501F",
205
- birth_date: Date.new(1977, 4, 15),
189
+ birth_date: Date.new(1977, 4, 15), # optional
206
190
  ).valid?
207
191
  ```
208
192
 
209
193
  ### Latvia 🇱🇻 (lv)
210
194
 
211
- `birth_date` is optional
212
-
213
195
  ```rb
214
196
  TinValid::LatviaTin.new(
215
197
  tin: "01011012345",
216
- birth_date: Date.new(1910, 1, 1),
198
+ birth_date: Date.new(1910, 1, 1), # optional
217
199
  ).valid?
218
200
  ```
219
201
 
220
202
  ### Lithuania 🇱🇹 (lt)
221
203
 
222
- `birth_date` is optional
223
-
224
204
  ```rb
225
205
  TinValid::LithuaniaTin.new(
226
206
  tin: "10101010005",
227
- birth_date: Date.new(2001, 1, 1),
207
+ birth_date: Date.new(2001, 1, 1), # optional
228
208
  ).valid?
229
209
  ```
230
210
 
231
211
  ### Luxembourg 🇱🇺 (lu)
232
212
 
233
- `birth_date` is optional
234
-
235
213
  ```rb
236
214
  TinValid::LuxembourgTin.new(
237
215
  tin: "1893120105732",
238
- birth_date: Date.new(1893, 12, 1),
216
+ birth_date: Date.new(1893, 12, 1), # optional
239
217
  ).valid?
240
218
  ```
241
219
 
@@ -253,12 +231,10 @@ TinValid::NetherlandsTin.new(tin: "174559434").valid?
253
231
 
254
232
  ### Poland 🇵🇱 (pl)
255
233
 
256
- `birth_date` is optional
257
-
258
234
  ```rb
259
235
  TinValid::PolandTin.new(
260
236
  tin: "02070803628",
261
- birth_date: Date.new(1902, 7, 8),
237
+ birth_date: Date.new(1902, 7, 8), # optional
262
238
  ).valid?
263
239
  ```
264
240
 
@@ -270,23 +246,19 @@ TinValid::PortugalTin.new(tin: "299999998").valid?
270
246
 
271
247
  ### Romania 🇷🇴 (ro)
272
248
 
273
- `birth_date` is optional
274
-
275
249
  ```rb
276
250
  TinValid::RomaniaTin.new(
277
251
  tin: "8001011234567",
278
- birth_date: Date.new(2000, 10, 11),
252
+ birth_date: Date.new(2000, 10, 11), # optional
279
253
  ).valid?
280
254
  ```
281
255
 
282
256
  ### Slovakia 🇸🇰 (sk)
283
257
 
284
- `birth_date` is optional
285
-
286
258
  ```rb
287
259
  TinValid::SlovakiaTin.new(
288
260
  tin: "7711167420",
289
- birth_date: Date.new(1977, 11, 16),
261
+ birth_date: Date.new(1977, 11, 16), # optional
290
262
  ).valid?
291
263
  ```
292
264
 
@@ -304,12 +276,10 @@ TinValid::SpainTin.new(tin: "54237A").valid?
304
276
 
305
277
  ### Sweden 🇸🇪 (se)
306
278
 
307
- `birth_date` is optional
308
-
309
279
  ```rb
310
280
  TinValid::SwedenTin.new(
311
281
  tin: "640823-3234",
312
- birth_date: Date.new(1964, 8, 23),
282
+ birth_date: Date.new(1964, 8, 23), # optional
313
283
  ).valid?
314
284
  ```
315
285
 
@@ -325,9 +295,12 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
325
295
  `bin/rspec` to run the tests. You can also run `bin/console` for an interactive
326
296
  prompt that will allow you to experiment.
327
297
 
328
- To install this gem onto your local machine, run `bin/rake install`. To
329
- release a new version, update the version number in `version.rb`, call `bundle`
330
- and then create a commit using:
298
+ To install this gem onto your local machine, run `bin/rake install`.
299
+
300
+ ## Release a new version
301
+
302
+ Update the version number in `version.rb`, call `bundle`, add the files using
303
+ `git add --patch` and then create a commit using:
331
304
 
332
305
  ```sh
333
306
  git commit -m "v`ruby -r./lib/tin_valid/version <<< 'puts TinValid::VERSION + \" 🎉\"'`"
@@ -35,9 +35,17 @@ module TinValid
35
35
  }x
36
36
  private_constant :MATCHER
37
37
 
38
+ def accepted_date?(year, month, day)
39
+ if year == "10"
40
+ valid_date?(year, month, day) || valid_date?("00", month, day)
41
+ else
42
+ valid_date?(year, month, day)
43
+ end
44
+ end
45
+
38
46
  # rubocop:disable Metrics/AbcSize
39
47
  # rubocop:disable Metrics/MethodLength
40
- def accepted_date?(year, month, day)
48
+ def valid_date?(year, month, day)
41
49
  month = month.to_i
42
50
  day = day.to_i
43
51
 
@@ -69,17 +69,17 @@ module TinValid
69
69
 
70
70
  # rubocop:disable Metrics/CyclomaticComplexity
71
71
  # rubocop:disable Metrics/MethodLength
72
- # rubocop:disable Metrics/PerceivedComplexity
73
72
  def check_serial(serial, year)
74
73
  case serial.to_i
75
- in 1..3999
74
+ when 1..3999
76
75
  (1900..1999).cover?(birth_year)
77
- in 4000..4999, 9000..9999
76
+ when 4000..4999,
77
+ 9000..9999
78
78
  case year.to_i
79
79
  in 0..36 then (2000..2036).cover?(birth_year)
80
80
  in 36..99 then (1937..1999).cover?(birth_year)
81
81
  end
82
- in 5000..8999
82
+ when 5000..8999
83
83
  case year.to_i
84
84
  in 0..36 then (2000..2036).cover?(birth_year)
85
85
  in 37..57 then false
@@ -89,6 +89,5 @@ module TinValid
89
89
  end
90
90
  # rubocop:enable Metrics/CyclomaticComplexity
91
91
  # rubocop:enable Metrics/MethodLength
92
- # rubocop:enable Metrics/PerceivedComplexity
93
92
  end
94
93
  end
@@ -63,7 +63,7 @@ module TinValid
63
63
  when ..15 then (remainder + 55).chr
64
64
  when 16 then "H"
65
65
  when ..21 then (remainder + 57).chr
66
- when 21 then "P"
66
+ when 22 then "P"
67
67
  else (remainder + 59).chr
68
68
  end
69
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TinValid
4
- VERSION = "1.2.1"
4
+ VERSION = "1.3.0"
5
5
  end
data/lib/tin_valid.rb CHANGED
@@ -33,4 +33,35 @@ require_relative "tin_valid/spain_tin"
33
33
  require_relative "tin_valid/sweden_tin"
34
34
  require_relative "tin_valid/united_kingdom_tin"
35
35
 
36
- module TinValid; end
36
+ module TinValid
37
+ COUNTRY_CODES = %w[
38
+ at
39
+ be
40
+ bg
41
+ cy
42
+ cz
43
+ de
44
+ dk
45
+ ee
46
+ es
47
+ fi
48
+ fr
49
+ gb
50
+ gr
51
+ hr
52
+ hu
53
+ ie
54
+ it
55
+ lt
56
+ lu
57
+ lv
58
+ mt
59
+ nl
60
+ pl
61
+ pt
62
+ ro
63
+ se
64
+ si
65
+ sk
66
+ ].freeze
67
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tin_valid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Ripert
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-05-22 00:00:00.000000000 Z
10
+ date: 2025-12-12 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  email:
13
13
  - sunny@sunfox.org
@@ -22,6 +22,142 @@ files:
22
22
  - LICENSE.txt
23
23
  - README.md
24
24
  - Rakefile
25
+ - doc/algorithms/FS-TIN Algorithms-Public.docx
26
+ - doc/tin_by_country/de/TIN_-_country_sheet_AT_de.pdf
27
+ - doc/tin_by_country/de/TIN_-_country_sheet_BE_de.pdf
28
+ - doc/tin_by_country/de/TIN_-_country_sheet_BG_de.pdf
29
+ - doc/tin_by_country/de/TIN_-_country_sheet_CY_de.pdf
30
+ - doc/tin_by_country/de/TIN_-_country_sheet_CZ_de.pdf
31
+ - doc/tin_by_country/de/TIN_-_country_sheet_DE_de.pdf
32
+ - doc/tin_by_country/de/TIN_-_country_sheet_DK_de.pdf
33
+ - doc/tin_by_country/de/TIN_-_country_sheet_EE_de.pdf
34
+ - doc/tin_by_country/de/TIN_-_country_sheet_EL_de.pdf
35
+ - doc/tin_by_country/de/TIN_-_country_sheet_ES_de.pdf
36
+ - doc/tin_by_country/de/TIN_-_country_sheet_FI_de.pdf
37
+ - doc/tin_by_country/de/TIN_-_country_sheet_FR_de.pdf
38
+ - doc/tin_by_country/de/TIN_-_country_sheet_HR_de.pdf
39
+ - doc/tin_by_country/de/TIN_-_country_sheet_HU_de.pdf
40
+ - doc/tin_by_country/de/TIN_-_country_sheet_IE_de.pdf
41
+ - doc/tin_by_country/de/TIN_-_country_sheet_IT_de.pdf
42
+ - doc/tin_by_country/de/TIN_-_country_sheet_LT_de.pdf
43
+ - doc/tin_by_country/de/TIN_-_country_sheet_LU_de.pdf
44
+ - doc/tin_by_country/de/TIN_-_country_sheet_LV_de.pdf
45
+ - doc/tin_by_country/de/TIN_-_country_sheet_MT_de.pdf
46
+ - doc/tin_by_country/de/TIN_-_country_sheet_NL_de.pdf
47
+ - doc/tin_by_country/de/TIN_-_country_sheet_PL_de.pdf
48
+ - doc/tin_by_country/de/TIN_-_country_sheet_PT_de.pdf
49
+ - doc/tin_by_country/de/TIN_-_country_sheet_RO_de.pdf
50
+ - doc/tin_by_country/de/TIN_-_country_sheet_SE_de.pdf
51
+ - doc/tin_by_country/de/TIN_-_country_sheet_SI_de.pdf
52
+ - doc/tin_by_country/de/TIN_-_country_sheet_SK_de.pdf
53
+ - doc/tin_by_country/en/TIN_-_country_sheet_AT_en.pdf
54
+ - doc/tin_by_country/en/TIN_-_country_sheet_BE_en.pdf
55
+ - doc/tin_by_country/en/TIN_-_country_sheet_BG_en.pdf
56
+ - doc/tin_by_country/en/TIN_-_country_sheet_CY_en.pdf
57
+ - doc/tin_by_country/en/TIN_-_country_sheet_CZ_en.pdf
58
+ - doc/tin_by_country/en/TIN_-_country_sheet_DE_en.pdf
59
+ - doc/tin_by_country/en/TIN_-_country_sheet_DK_en.pdf
60
+ - doc/tin_by_country/en/TIN_-_country_sheet_EE_en.pdf
61
+ - doc/tin_by_country/en/TIN_-_country_sheet_EL_en.pdf
62
+ - doc/tin_by_country/en/TIN_-_country_sheet_ES_en.pdf
63
+ - doc/tin_by_country/en/TIN_-_country_sheet_FI_en.pdf
64
+ - doc/tin_by_country/en/TIN_-_country_sheet_FR_en.pdf
65
+ - doc/tin_by_country/en/TIN_-_country_sheet_HR_en.pdf
66
+ - doc/tin_by_country/en/TIN_-_country_sheet_HU_en.pdf
67
+ - doc/tin_by_country/en/TIN_-_country_sheet_IE_en.pdf
68
+ - doc/tin_by_country/en/TIN_-_country_sheet_IT_en.pdf
69
+ - doc/tin_by_country/en/TIN_-_country_sheet_LT_en.pdf
70
+ - doc/tin_by_country/en/TIN_-_country_sheet_LU_en.pdf
71
+ - doc/tin_by_country/en/TIN_-_country_sheet_LV_en.pdf
72
+ - doc/tin_by_country/en/TIN_-_country_sheet_MT_en.pdf
73
+ - doc/tin_by_country/en/TIN_-_country_sheet_NL_en.pdf
74
+ - doc/tin_by_country/en/TIN_-_country_sheet_PL_en.pdf
75
+ - doc/tin_by_country/en/TIN_-_country_sheet_PT_en.pdf
76
+ - doc/tin_by_country/en/TIN_-_country_sheet_RO_en.pdf
77
+ - doc/tin_by_country/en/TIN_-_country_sheet_SE_en.pdf
78
+ - doc/tin_by_country/en/TIN_-_country_sheet_SI_en.pdf
79
+ - doc/tin_by_country/en/TIN_-_country_sheet_SK_en.pdf
80
+ - doc/tin_by_country/es/TIN_-_country_sheet_AT_es.pdf
81
+ - doc/tin_by_country/es/TIN_-_country_sheet_BE_es.pdf
82
+ - doc/tin_by_country/es/TIN_-_country_sheet_BG_es.pdf
83
+ - doc/tin_by_country/es/TIN_-_country_sheet_CY_es.pdf
84
+ - doc/tin_by_country/es/TIN_-_country_sheet_CZ_es.pdf
85
+ - doc/tin_by_country/es/TIN_-_country_sheet_DE_es.pdf
86
+ - doc/tin_by_country/es/TIN_-_country_sheet_DK_es.pdf
87
+ - doc/tin_by_country/es/TIN_-_country_sheet_EE_es.pdf
88
+ - doc/tin_by_country/es/TIN_-_country_sheet_EL_es.pdf
89
+ - doc/tin_by_country/es/TIN_-_country_sheet_ES_es.pdf
90
+ - doc/tin_by_country/es/TIN_-_country_sheet_FI_es.pdf
91
+ - doc/tin_by_country/es/TIN_-_country_sheet_FR_es.pdf
92
+ - doc/tin_by_country/es/TIN_-_country_sheet_HR_es.pdf
93
+ - doc/tin_by_country/es/TIN_-_country_sheet_HU_es.pdf
94
+ - doc/tin_by_country/es/TIN_-_country_sheet_IE_es.pdf
95
+ - doc/tin_by_country/es/TIN_-_country_sheet_IT_es.pdf
96
+ - doc/tin_by_country/es/TIN_-_country_sheet_LT_es.pdf
97
+ - doc/tin_by_country/es/TIN_-_country_sheet_LU_es.pdf
98
+ - doc/tin_by_country/es/TIN_-_country_sheet_LV_es.pdf
99
+ - doc/tin_by_country/es/TIN_-_country_sheet_MT_es.pdf
100
+ - doc/tin_by_country/es/TIN_-_country_sheet_NL_es.pdf
101
+ - doc/tin_by_country/es/TIN_-_country_sheet_PL_es.pdf
102
+ - doc/tin_by_country/es/TIN_-_country_sheet_PT_es.pdf
103
+ - doc/tin_by_country/es/TIN_-_country_sheet_RO_es.pdf
104
+ - doc/tin_by_country/es/TIN_-_country_sheet_SE_es.pdf
105
+ - doc/tin_by_country/es/TIN_-_country_sheet_SI_es.pdf
106
+ - doc/tin_by_country/es/TIN_-_country_sheet_SK_es.pdf
107
+ - doc/tin_by_country/fr/TIN_-_country_sheet_AT_fr.pdf
108
+ - doc/tin_by_country/fr/TIN_-_country_sheet_BE_fr.pdf
109
+ - doc/tin_by_country/fr/TIN_-_country_sheet_BG_fr.pdf
110
+ - doc/tin_by_country/fr/TIN_-_country_sheet_CY_fr.pdf
111
+ - doc/tin_by_country/fr/TIN_-_country_sheet_CZ_fr.pdf
112
+ - doc/tin_by_country/fr/TIN_-_country_sheet_DE_fr.pdf
113
+ - doc/tin_by_country/fr/TIN_-_country_sheet_DK_fr.pdf
114
+ - doc/tin_by_country/fr/TIN_-_country_sheet_EE_fr.pdf
115
+ - doc/tin_by_country/fr/TIN_-_country_sheet_EL_fr.pdf
116
+ - doc/tin_by_country/fr/TIN_-_country_sheet_ES_fr.pdf
117
+ - doc/tin_by_country/fr/TIN_-_country_sheet_FI_fr.pdf
118
+ - doc/tin_by_country/fr/TIN_-_country_sheet_FR_fr.pdf
119
+ - doc/tin_by_country/fr/TIN_-_country_sheet_HR_fr.pdf
120
+ - doc/tin_by_country/fr/TIN_-_country_sheet_HU_fr.pdf
121
+ - doc/tin_by_country/fr/TIN_-_country_sheet_IE_fr.pdf
122
+ - doc/tin_by_country/fr/TIN_-_country_sheet_IT_fr.pdf
123
+ - doc/tin_by_country/fr/TIN_-_country_sheet_LT_fr.pdf
124
+ - doc/tin_by_country/fr/TIN_-_country_sheet_LU_fr.pdf
125
+ - doc/tin_by_country/fr/TIN_-_country_sheet_LV_fr.pdf
126
+ - doc/tin_by_country/fr/TIN_-_country_sheet_MT_fr.pdf
127
+ - doc/tin_by_country/fr/TIN_-_country_sheet_NL_fr.pdf
128
+ - doc/tin_by_country/fr/TIN_-_country_sheet_PL_fr.pdf
129
+ - doc/tin_by_country/fr/TIN_-_country_sheet_PT_fr.pdf
130
+ - doc/tin_by_country/fr/TIN_-_country_sheet_RO_fr.pdf
131
+ - doc/tin_by_country/fr/TIN_-_country_sheet_SE_fr.pdf
132
+ - doc/tin_by_country/fr/TIN_-_country_sheet_SI_fr.pdf
133
+ - doc/tin_by_country/fr/TIN_-_country_sheet_SK_fr.pdf
134
+ - doc/tin_by_country/pt/TIN_-_country_sheet_AT_pt.pdf
135
+ - doc/tin_by_country/pt/TIN_-_country_sheet_BE_pt.pdf
136
+ - doc/tin_by_country/pt/TIN_-_country_sheet_BG_pt.pdf
137
+ - doc/tin_by_country/pt/TIN_-_country_sheet_CY_pt.pdf
138
+ - doc/tin_by_country/pt/TIN_-_country_sheet_CZ_pt.pdf
139
+ - doc/tin_by_country/pt/TIN_-_country_sheet_DE_pt.pdf
140
+ - doc/tin_by_country/pt/TIN_-_country_sheet_DK_pt.pdf
141
+ - doc/tin_by_country/pt/TIN_-_country_sheet_EE_pt.pdf
142
+ - doc/tin_by_country/pt/TIN_-_country_sheet_EL_pt.pdf
143
+ - doc/tin_by_country/pt/TIN_-_country_sheet_ES_pt.pdf
144
+ - doc/tin_by_country/pt/TIN_-_country_sheet_FI_pt.pdf
145
+ - doc/tin_by_country/pt/TIN_-_country_sheet_FR_pt.pdf
146
+ - doc/tin_by_country/pt/TIN_-_country_sheet_HR_pt.pdf
147
+ - doc/tin_by_country/pt/TIN_-_country_sheet_HU_pt.pdf
148
+ - doc/tin_by_country/pt/TIN_-_country_sheet_IE_pt.pdf
149
+ - doc/tin_by_country/pt/TIN_-_country_sheet_IT_pt.pdf
150
+ - doc/tin_by_country/pt/TIN_-_country_sheet_LT_pt.pdf
151
+ - doc/tin_by_country/pt/TIN_-_country_sheet_LU_pt.pdf
152
+ - doc/tin_by_country/pt/TIN_-_country_sheet_LV_pt.pdf
153
+ - doc/tin_by_country/pt/TIN_-_country_sheet_MT_pt.pdf
154
+ - doc/tin_by_country/pt/TIN_-_country_sheet_NL_pt.pdf
155
+ - doc/tin_by_country/pt/TIN_-_country_sheet_PL_pt.pdf
156
+ - doc/tin_by_country/pt/TIN_-_country_sheet_PT_pt.pdf
157
+ - doc/tin_by_country/pt/TIN_-_country_sheet_RO_pt.pdf
158
+ - doc/tin_by_country/pt/TIN_-_country_sheet_SE_pt.pdf
159
+ - doc/tin_by_country/pt/TIN_-_country_sheet_SI_pt.pdf
160
+ - doc/tin_by_country/pt/TIN_-_country_sheet_SK_pt.pdf
25
161
  - lib/tin_valid.rb
26
162
  - lib/tin_valid/austria_tin.rb
27
163
  - lib/tin_valid/belgium_tin.rb