tin_valid 1.1.0 β 1.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +16 -7
- data/lib/tin_valid/france_tin.rb +12 -2
- data/lib/tin_valid/italy_tin.rb +1 -1
- data/lib/tin_valid/luxembourg_tin.rb +1 -1
- data/lib/tin_valid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57ef691e689d26ef2b254910aa99a7aee71247ebd5029187404b1fb9ae26d725
|
4
|
+
data.tar.gz: 81e37c9edc4a97698cdc1e264a9c794679e4f417ce01284f78a62f16b87b3a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04d22d7d57e37bba3cd2de93f5af77883671520143e8cd15b62f3062b388e71a774b49c2c58c90970b4ef72d14d3b80a3ff9c5fb7aa1a0ba9f84561f466f75f7
|
7
|
+
data.tar.gz: '089d95d8d72de2f7ed52958c194112bedde0bc982b58ec3cc134db13b5eea8b72f44df2bfdffe898e6aa61f962d6976ac53b3fcfa4a3cf3e8f9a1db9da34743d'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.1.2] - 2025-05-06
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
- Fix Luxembourg check
|
7
|
+
- Accept SIREN for France
|
8
|
+
|
9
|
+
## [1.1.1] - 2025-04-28
|
10
|
+
|
11
|
+
Fixes:
|
12
|
+
- Fix birth date check for Italy when year is between 1900..1909 or 2000..2009
|
13
|
+
|
3
14
|
## [1.1.0] - 2025-04-18
|
4
15
|
|
5
16
|
Features:
|
data/README.md
CHANGED
@@ -31,8 +31,11 @@ Validate Tax Identification Numbers (TINs) for the following European countries:
|
|
31
31
|
- Sweden πΈπͺ
|
32
32
|
- United Kingdom π¬π§
|
33
33
|
|
34
|
-
See also the
|
35
|
-
|
34
|
+
See also the
|
35
|
+
[TIN specifications](https://ec.europa.eu/taxation_customs/tin/#/check-tin)
|
36
|
+
and the
|
37
|
+
[descriptions of the structure](https://taxation-customs.ec.europa.eu/online-services/online-services-and-databases-taxation/taxpayer-identification-number-tin_en)
|
38
|
+
provided by the European Union.
|
36
39
|
|
37
40
|
## Installation
|
38
41
|
|
@@ -155,13 +158,19 @@ TinValid::UnitedKingdomTin.new(tin: "β¦").valid?
|
|
155
158
|
## Development
|
156
159
|
|
157
160
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
158
|
-
`
|
161
|
+
`bin/rspec` to run the tests. You can also run `bin/console` for an interactive
|
159
162
|
prompt that will allow you to experiment.
|
160
163
|
|
161
|
-
To install this gem onto your local machine, run `
|
162
|
-
release a new version, update the version number in `version.rb`,
|
163
|
-
|
164
|
-
|
164
|
+
To install this gem onto your local machine, run `bin/rake install`. To
|
165
|
+
release a new version, update the version number in `version.rb`, call `bundle`
|
166
|
+
and then create a commit using:
|
167
|
+
|
168
|
+
```sh
|
169
|
+
git commit -m "v`ruby -r./lib/tin_valid/version <<< 'puts TinValid::VERSION + \" π\"'`"
|
170
|
+
```
|
171
|
+
|
172
|
+
Finally, call `bin/rake release`, which will create a git tag for the version,
|
173
|
+
push git commits and the created tag, and add the `.gem` file to
|
165
174
|
[rubygems.org](https://rubygems.org).
|
166
175
|
|
167
176
|
## Contributing
|
data/lib/tin_valid/france_tin.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# https://www.economie.gouv.fr/cedef/fiches-pratiques/quest-ce-que-le-nif
|
3
4
|
module TinValid
|
4
5
|
class FranceTin
|
5
6
|
def initialize(tin:)
|
@@ -8,14 +9,23 @@ module TinValid
|
|
8
9
|
|
9
10
|
attr_reader :tin
|
10
11
|
|
11
|
-
def valid?
|
12
|
+
def valid? = valid_v1? || valid_siren?
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def valid_v1?
|
12
17
|
return false unless /\A[0-3][0-9]{12}\z/.match?(tin)
|
13
18
|
return false if tin == "0000000000000"
|
14
19
|
|
15
20
|
tin[-3..].to_i == check
|
16
21
|
end
|
17
22
|
|
18
|
-
|
23
|
+
# https://annuaire-entreprises.data.gouv.fr/definitions/numero-siren
|
24
|
+
def valid_siren?
|
25
|
+
return false if tin == "123456789"
|
26
|
+
|
27
|
+
/\A[1-9][0-9]{8}\z/.match?(tin)
|
28
|
+
end
|
19
29
|
|
20
30
|
def check
|
21
31
|
# 1. Concatenate C1, C2, C3, C4, C5, C6, C7, C8, C9, C10;
|
data/lib/tin_valid/italy_tin.rb
CHANGED
@@ -24,7 +24,7 @@ module TinValid
|
|
24
24
|
|
25
25
|
def valid_date?(match)
|
26
26
|
# C7,C8: Two last digits of a year.
|
27
|
-
year = replacement_to_i(match[:year])
|
27
|
+
year = replacement_to_i(match[:year]).to_s.rjust(2, "0")
|
28
28
|
|
29
29
|
# C9: A letter representing a month;
|
30
30
|
month = MONTH_LETTERS.fetch(match[:month])
|
@@ -95,7 +95,7 @@ module TinValid
|
|
95
95
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
96
96
|
[1, 5, 7, 6, 2, 8, 3, 0, 9, 4],
|
97
97
|
[5, 8, 0, 3, 7, 9, 6, 1, 4, 2],
|
98
|
-
[8, 9, 1, 6, 0,
|
98
|
+
[8, 9, 1, 6, 0, 4, 3, 5, 2, 7],
|
99
99
|
[9, 4, 5, 3, 1, 2, 6, 8, 7, 0],
|
100
100
|
[4, 2, 8, 6, 5, 7, 3, 9, 0, 1],
|
101
101
|
[2, 7, 9, 3, 8, 0, 6, 4, 1, 5],
|
data/lib/tin_valid/version.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunny Ripert
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-05-06 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
email:
|
13
13
|
- sunny@sunfox.org
|