valvat 0.8.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +4 -1
- data.tar.gz.sig +0 -0
- data/.gitignore +2 -1
- data/.travis.yml +33 -18
- data/CHANGES.md +43 -2
- data/Gemfile +2 -3
- data/README.md +95 -67
- data/certs/yolk.pem +23 -19
- data/gemfiles/activemodel-3-2 +3 -4
- data/gemfiles/activemodel-4 +3 -4
- data/gemfiles/activemodel-5 +4 -5
- data/gemfiles/activemodel-6 +7 -0
- data/gemfiles/before-ruby21/activemodel-3-2 +3 -4
- data/gemfiles/before-ruby21/activemodel-4 +3 -4
- data/gemfiles/before-ruby21/standalone +3 -4
- data/gemfiles/standalone +3 -5
- data/lib/active_model/validations/valvat_validator.rb +20 -5
- data/lib/valvat.rb +3 -1
- data/lib/valvat/checksum/gb.rb +30 -13
- data/lib/valvat/checksum/ie.rb +1 -1
- data/lib/valvat/checksum/nl.rb +5 -0
- data/lib/valvat/checksum/si.rb +2 -2
- data/lib/valvat/error.rb +28 -0
- data/lib/valvat/locales/en.yml +1 -1
- data/lib/valvat/locales/fr.yml +17 -17
- data/lib/valvat/locales/nb.yml +34 -0
- data/lib/valvat/lookup.rb +11 -43
- data/lib/valvat/lookup/fault.rb +30 -0
- data/lib/valvat/lookup/request.rb +33 -12
- data/lib/valvat/lookup/response.rb +36 -0
- data/lib/valvat/utils.rb +1 -1
- data/lib/valvat/version.rb +1 -1
- data/spec/active_model/validations/valvat_validator_spec.rb +66 -66
- data/spec/valvat/checksum/at_spec.rb +2 -2
- data/spec/valvat/checksum/be_spec.rb +2 -2
- data/spec/valvat/checksum/bg_spec.rb +2 -2
- data/spec/valvat/checksum/cy_spec.rb +2 -2
- data/spec/valvat/checksum/de_spec.rb +2 -2
- data/spec/valvat/checksum/dk_spec.rb +2 -2
- data/spec/valvat/checksum/ee_spec.rb +2 -2
- data/spec/valvat/checksum/es_spec.rb +2 -2
- data/spec/valvat/checksum/fi_spec.rb +2 -2
- data/spec/valvat/checksum/fr_spec.rb +2 -2
- data/spec/valvat/checksum/gb_spec.rb +5 -3
- data/spec/valvat/checksum/gr_spec.rb +2 -2
- data/spec/valvat/checksum/hr_spec.rb +2 -2
- data/spec/valvat/checksum/hu_spec.rb +2 -2
- data/spec/valvat/checksum/ie_spec.rb +8 -2
- data/spec/valvat/checksum/it_spec.rb +4 -4
- data/spec/valvat/checksum/lt_spec.rb +2 -2
- data/spec/valvat/checksum/lu_spec.rb +2 -2
- data/spec/valvat/checksum/mt_spec.rb +2 -2
- data/spec/valvat/checksum/nl_spec.rb +4 -4
- data/spec/valvat/checksum/pl_spec.rb +3 -3
- data/spec/valvat/checksum/pt_spec.rb +2 -2
- data/spec/valvat/checksum/ro_spec.rb +2 -2
- data/spec/valvat/checksum/se_spec.rb +3 -3
- data/spec/valvat/checksum/si_spec.rb +7 -7
- data/spec/valvat/checksum_spec.rb +2 -2
- data/spec/valvat/lockup/fault_spec.rb +32 -0
- data/spec/valvat/lockup/request_spec.rb +15 -0
- data/spec/valvat/lockup/response_spec.rb +27 -0
- data/spec/valvat/lookup_spec.rb +168 -35
- data/spec/valvat/syntax_spec.rb +29 -29
- data/spec/valvat/utils_spec.rb +8 -6
- data/spec/valvat_spec.rb +18 -18
- data/valvat.gemspec +1 -0
- metadata +53 -25
- metadata.gz.sig +0 -0
- data/lib/valvat/lookup/request_with_id.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b64b4bcee899d80f3c9205b541eeaf7123df7560e47528368bedc0e06d85f85
|
4
|
+
data.tar.gz: 31f18a7bf075a71c719002e3b34dd4a057da7ba85aeaf7283385d7ffc98f7dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b419833c23922a653f932995541e25300a8897529cd3bfdea2078de762f5829451e35c1a658510cfbd64978f0f6165471d1331e1673d381ef5c0ecd6ca6380a
|
7
|
+
data.tar.gz: e595829c058d7b2b89a644b779c4ea95c66eb9d416e395a4b32cf4d28f73bcb717f55c720fe51dd8d027092c94ae04b3c094cd1e7fbf1fe95d833330851a37d5
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
1
|
+
Y���ހ�"$K>
|
2
|
+
�K�����-|�Vh#�g��H�h��v�X����28����p@�u�@�Pk�P �n��1�k�8��k��Y �月x�c��a�g�
|
3
|
+
�'z18�9�Z-�[��^Vb[6�6��-�=j�{�8�m�J̰l�u�vN��N���[T��/x���eg�e���&ݔpr 9���tk�� *�0�5�-�V���t�ݾH&�K�|�2�G�$d4���0��h���C{�Ct�C��<���:�����&z6%��(Ƒ�ZC.J���fIy���uZ���ި �De��wyOa�͖_�V���ԷD\���}n��u���1DN�>�tó
|
4
|
+
l(�N��O�6qY��T߳��9c��jK6��
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,32 +1,47 @@
|
|
1
1
|
language: ruby
|
2
|
+
cache: bundler
|
2
3
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
4
|
+
- 2.7
|
5
|
+
- 2.6
|
6
|
+
- 2.5
|
7
|
+
- 2.4
|
5
8
|
- 2.3
|
6
9
|
- 2.2
|
7
10
|
- 2.1
|
11
|
+
- jruby-head
|
8
12
|
- jruby-19mode
|
9
13
|
gemfile:
|
14
|
+
- gemfiles/activemodel-6
|
10
15
|
- gemfiles/activemodel-5
|
11
16
|
- gemfiles/activemodel-4
|
12
17
|
- gemfiles/activemodel-3-2
|
13
18
|
- gemfiles/standalone
|
14
19
|
matrix:
|
15
20
|
exclude:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
21
|
+
- rvm: 2.4
|
22
|
+
gemfile: gemfiles/activemodel-6
|
23
|
+
- rvm: 2.3
|
24
|
+
gemfile: gemfiles/activemodel-6
|
25
|
+
- rvm: 2.2
|
26
|
+
gemfile: gemfiles/activemodel-6
|
27
|
+
- rvm: 2.1
|
28
|
+
gemfile: gemfiles/activemodel-6
|
29
|
+
- rvm: jruby-19mode
|
30
|
+
gemfile: gemfiles/activemodel-6
|
31
|
+
- rvm: 2.1
|
32
|
+
gemfile: gemfiles/activemodel-5
|
33
|
+
- rvm: jruby-19mode
|
34
|
+
gemfile: gemfiles/activemodel-5
|
20
35
|
include:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
36
|
+
- rvm: 2.0
|
37
|
+
gemfile: gemfiles/before-ruby21/activemodel-4
|
38
|
+
- rvm: 2.0
|
39
|
+
gemfile: gemfiles/before-ruby21/activemodel-3-2
|
40
|
+
- rvm: 2.0
|
41
|
+
gemfile: gemfiles/before-ruby21/standalone
|
42
|
+
- rvm: 1.9.3
|
43
|
+
gemfile: gemfiles/before-ruby21/activemodel-4
|
44
|
+
- rvm: 1.9.3
|
45
|
+
gemfile: gemfiles/before-ruby21/activemodel-3-2
|
46
|
+
- rvm: 1.9.3
|
47
|
+
gemfile: gemfiles/before-ruby21/standalone
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,47 @@
|
|
1
|
+
|
1
2
|
### dev
|
2
3
|
|
3
|
-
[full changelog](http://github.com/yolk/valvat/compare/v0.
|
4
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.9.1...master)
|
5
|
+
|
6
|
+
### 1.0.0 / 2020-11-06
|
7
|
+
|
8
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.9.1...v1.0.0)
|
9
|
+
|
10
|
+
* Refactored lookup to use specific rescue for savons soapfaults
|
11
|
+
* Raises vies specific error classes to help debugging temporary and permanent VIES errors
|
12
|
+
* Lookup#validate supports :savon option to allow altering the behaviour of the used savon client
|
13
|
+
* ActiveModel validator now supports all lookup options.
|
14
|
+
* Use https instead of http for accessing vies (by [Crazy Chris](https://github.com/lubekpl))
|
15
|
+
* Lookup#validate supports :raise_error option to return nil instead of raising (known) error when connecting to the VIES web service.
|
16
|
+
* [BUGFIX] Checksum: Prevent error on some invalid IE vat numbers
|
17
|
+
* EN: Capitalized VAT in error messages (and specs) (by [Vitalii Kashoid](https://github.com/Kashoid23))
|
18
|
+
|
19
|
+
### 0.9.1 / 2020-03-19
|
20
|
+
|
21
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.9.0...v0.9.1)
|
22
|
+
|
23
|
+
* Follow redirects to fix alteration of VIES-API (by [xxswingxx](https://github.com/xxswingxx))
|
24
|
+
|
25
|
+
### 0.9.0 / 2020-02-28
|
26
|
+
|
27
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.8.2...v0.9.0)
|
28
|
+
|
29
|
+
* Validate new dutch 2020 vat identification number (by [yvonnenieuwerth](https://github.com/yvonnenieuwerth))
|
30
|
+
* Set the country adjectives to masculine in FR locales (by [bobmaerten](https://github.com/bobmaerten))
|
31
|
+
* Fix greek country adjectif in french (by [bobmaerten](https://github.com/bobmaerten))
|
32
|
+
|
33
|
+
### 0.8.2 / 2019-11-15
|
34
|
+
|
35
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.8.1...v0.8.2)
|
36
|
+
|
37
|
+
* Fixed checksum computation for Slovenian VAT ID.
|
38
|
+
* Updated normalize regexp to clean spaces, punctuation and control chars (by [jarthod](https://github.com/jarthod))
|
39
|
+
|
40
|
+
### 0.8.1 / 2019-07-30
|
41
|
+
|
42
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.8.0...v0.8.1)
|
43
|
+
|
44
|
+
* Added Norwegian translation (by [erikaxel](https://github.com/erikaxel))
|
4
45
|
|
5
46
|
### 0.8.0 / 2019-07-19
|
6
47
|
|
@@ -288,4 +329,4 @@
|
|
288
329
|
|
289
330
|
[full changelog](http://github.com/yolk/valvat/compare/v0.0.1...v0.0.2)
|
290
331
|
|
291
|
-
* Use REST-wrapper for accessing VIES web service; this removes dependency on savon and some lines of code. See http://isvat.appspot.com/
|
332
|
+
* Use REST-wrapper for accessing VIES web service; this removes dependency on savon and some lines of code. See http://isvat.appspot.com/
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -11,10 +11,10 @@ Validates european vat numbers. Standalone or as a ActiveModel validator.
|
|
11
11
|
* Lookup via the VIES web service
|
12
12
|
* ActiveModel/Rails integration
|
13
13
|
* Works standalone without ActiveModel
|
14
|
-
* I18n locales for language specific error messages in English, German, French, Spanish, Italian, Portuguese, Polish, Swedish, Dutch, Danish, Czech, Slovakian, Hungarian, Bulgarian, Romanian, Latvian, Catalan, and Finnish.
|
14
|
+
* I18n locales for language specific error messages in English, German, French, Spanish, Italian, Portuguese, Polish, Swedish, Dutch, Danish, Czech, Slovakian, Hungarian, Bulgarian, Romanian, Latvian, Catalan, Norwegian, and Finnish.
|
15
15
|
* *Experimental* checksum verification
|
16
16
|
|
17
|
-
valvat is tested and works with ruby MRI 1.9.3/2.0/2.1/2.2/2.3/2.4, jruby (
|
17
|
+
valvat is tested and works with ruby MRI 1.9.3/2.0/2.1/2.2/2.3/2.4/2.5/2.6/2.7, jruby (including 1.9 mode) and ActiveModel 3/4/5/6
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
@@ -22,9 +22,9 @@ Add it to your Gemfile:
|
|
22
22
|
|
23
23
|
gem 'valvat'
|
24
24
|
|
25
|
-
To
|
25
|
+
To use less memory (~3.5 mb vs. ~0.5 mb) and load only the local verification functionality – and not the remote lookup with VIES – add it like this instead:
|
26
26
|
|
27
|
-
gem 'valvat', :
|
27
|
+
gem 'valvat', require: 'valvat/local'
|
28
28
|
|
29
29
|
In any case run:
|
30
30
|
|
@@ -34,72 +34,114 @@ Or install it yourself as:
|
|
34
34
|
|
35
35
|
$ gem install valvat
|
36
36
|
|
37
|
-
##
|
37
|
+
## Validate the syntax of a VAT number
|
38
38
|
|
39
39
|
To verify the syntax of a vat number:
|
40
40
|
|
41
41
|
Valvat.new("DE345789003").valid?
|
42
42
|
=> true or false
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
Valvat.new("DE345789003").exists?
|
47
|
-
=> true or false or nil
|
44
|
+
It is also possible to bypass initializing a Valvat instance and check the syntax of a vat number string directly with:
|
48
45
|
|
49
|
-
|
46
|
+
Valvat::Syntax.validate("DE345789003")
|
47
|
+
=> true or false
|
50
48
|
|
51
|
-
|
49
|
+
## Validate agains the VIES web service
|
52
50
|
|
53
|
-
|
51
|
+
To check if the given vat number exists via the VIES web service:
|
54
52
|
|
55
|
-
Valvat
|
56
|
-
=> true or false
|
53
|
+
Valvat.new("DE345789003").exists?
|
54
|
+
=> true or false or nil
|
57
55
|
|
58
56
|
Or to lookup a vat number string directly via VIES web service:
|
59
57
|
|
60
58
|
Valvat::Lookup.validate("DE345789003")
|
61
59
|
=> true or false or nil
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
valvat allows to check vat numbers from AT, BE, BG, DE, DK, ES, FR, FI, GR, IE, IT, LU, NL, PL, PT, SE and SI against a checksum calculation. All other countries will fall back to a simple syntax check:
|
61
|
+
*IMPORTANT* Keep in mind that the VIES web service might be offline at some time for all or some member states. If this happens `exists?` or `Valvat::Lookup.validate` will return `nil`. See *Handling of VIES maintenance errors* for further details.
|
66
62
|
|
67
|
-
|
68
|
-
=> true or false
|
63
|
+
### Details & request identifier
|
69
64
|
|
70
|
-
|
65
|
+
If you need all details and not only if the VAT is valid, pass {detail: true} as second parameter to the lookup call.
|
71
66
|
|
72
|
-
|
73
|
-
|
74
|
-
To bypass initializing a Valvat instance:
|
75
|
-
|
76
|
-
Valvat::Checksum.validate("DE345789003")
|
77
|
-
=> true or false
|
78
|
-
|
79
|
-
## Details & request identifier
|
80
|
-
|
81
|
-
If you need all details and not only if the VAT is valid, pass {:detail => true} as second parameter to the lookup call.
|
82
|
-
|
83
|
-
Valvat.new("IE6388047V").exists?(:detail => true)
|
67
|
+
Valvat.new("IE6388047V").exists?(detail: true)
|
84
68
|
=> {
|
85
|
-
:country_code=>"IE", :vat_number => "6388047V",
|
69
|
+
:country_code=>"IE", :vat_number => "6388047V", :valid => true,
|
86
70
|
:request_date => Date.today, :name=>"GOOGLE IRELAND LIMITED",
|
87
71
|
:address=>"1ST & 2ND FLOOR ,GORDON HOUSE ,BARROW STREET ,DUBLIN 4"
|
88
72
|
} or false or nil
|
89
73
|
|
90
|
-
According to EU law, or at least as Austria sees it, it's mandatory to verify the
|
74
|
+
According to EU law, or at least as Austria sees it, it's mandatory to verify the VAT number of every new customer, but also to check the VAT number periodicaly. To prove that you have checked the VAT number, the VIES Web service can return a `request_identifier`.
|
91
75
|
|
92
|
-
To receive a
|
76
|
+
To receive a `request_identifier` you need to pass your own VAT number in the options hash. In this example, Google (VAT IE6388047V) is checking the validity of eBays VAT number (LU21416127)
|
93
77
|
|
94
|
-
Valvat.new("LU21416127").exists?(:
|
78
|
+
Valvat.new("LU21416127").exists?(requester: "IE6388047V")
|
95
79
|
=> {
|
96
|
-
:country_code=>"LU", :vat_number => "21416127",
|
80
|
+
:country_code=>"LU", :vat_number => "21416127", :valid => true,
|
97
81
|
:request_date => Date.today, :name=>"EBAY EUROPE S.A R.L.",
|
98
82
|
:address => "22, BOULEVARD ROYAL\nL-2449 LUXEMBOURG",
|
99
83
|
:company_type => nil, :request_identifier => "some_uniq_string"
|
100
84
|
} or false or nil
|
101
85
|
|
102
|
-
|
86
|
+
If the given `requester` is invalid, a `Valvat::InvalidRequester` error is thrown.
|
87
|
+
|
88
|
+
### Handling of VIES maintenance errors
|
89
|
+
|
90
|
+
From time to time the VIES web service for one or all member states is down for maintenance. To handle this kind of temporary errors, `Valvat::Lookup#validate` returns `nil` by default to indicate that there is no way at the moment to say if the given VAT is valid or not. You should revalidate the VAT later. If you prefer an error, use the `raise_error` option:
|
91
|
+
|
92
|
+
Valvat.new("IE6388047V").exists?(raise_error: true)
|
93
|
+
|
94
|
+
This raises `Valvat::ServiceUnavailable` or `Valvat::MemberStateUnavailable` instead of returning `nil`.
|
95
|
+
|
96
|
+
Visit [http://ec.europa.eu/taxation_customs/vies/viesspec.do](http://ec.europa.eu/taxation_customs/vies/viesspec.do) for more accurate information at what time the service for a specific member state will be down.
|
97
|
+
|
98
|
+
### Handling of other VIES errors
|
99
|
+
|
100
|
+
All other errors accuring while validating against the VIES web service are raised and must be handled by you. These include:
|
101
|
+
|
102
|
+
* `Valvat::InvalidRequester`
|
103
|
+
* `Valvat::BlockedError`
|
104
|
+
* `Valvat::RateLimitError`
|
105
|
+
* `Valvat::Timeout`
|
106
|
+
* all IO errors
|
107
|
+
|
108
|
+
If you want to suppress all known error cases. Pass in the `raise_error` option set to `false`:
|
109
|
+
|
110
|
+
Valvat.new("IE6388047V").exists?(raise_error: false)
|
111
|
+
|
112
|
+
This will return `nil` instead of raising a known error.
|
113
|
+
|
114
|
+
### Set options for the savon client
|
115
|
+
|
116
|
+
Use the `:savon` key to set options for the used savon SOAP client. For example to log all requests:
|
117
|
+
|
118
|
+
Valvat.new("IE6388047V").exists?(savon: {log: true})
|
119
|
+
|
120
|
+
Or to use higher timeouts for the requests:
|
121
|
+
|
122
|
+
Valvat.new("IE6388047V").exists?(savon: {open_timeout: 10, read_timeout: 10})
|
123
|
+
|
124
|
+
### Skip local validation before lookup
|
125
|
+
|
126
|
+
To prevent unnecessary requests, valvat performs a local syntax check before making the request to the VIES web service. If you want to skip this step (for any reason), set the `:skip_local_validation` option to `true`.
|
127
|
+
|
128
|
+
## Experimental checksum verification
|
129
|
+
|
130
|
+
valvat allows to check vat numbers from AT, BE, BG, DE, DK, ES, FR, FI, GR, IE, IT, LU, NL, PL, PT, SE and SI against a checksum calculation. All other member states will fall back to a basic syntax check:
|
131
|
+
|
132
|
+
Valvat.new("DE345789003").valid_checksum?
|
133
|
+
=> true or false
|
134
|
+
|
135
|
+
These results are more valuable than a simple syntax check, but keep in mind: they can not replace a lookup via VIES.
|
136
|
+
|
137
|
+
*IMPORTANT* This feature was tested against all vat numbers I could get my hand on, but it is still marked as *experimental* because these calculations are not documented and may return wrong results.
|
138
|
+
|
139
|
+
To bypass initializing a Valvat instance:
|
140
|
+
|
141
|
+
Valvat::Checksum.validate("DE345789003")
|
142
|
+
=> true or false
|
143
|
+
|
144
|
+
## Usage with ActiveModel / Rails
|
103
145
|
|
104
146
|
### Loading
|
105
147
|
|
@@ -114,30 +156,34 @@ after ActiveModel has been loaded.
|
|
114
156
|
To validate the attribute `vat_number` add this to your model:
|
115
157
|
|
116
158
|
class MyModel < ActiveRecord::Base
|
117
|
-
validates :vat_number, :
|
159
|
+
validates :vat_number, valvat: true
|
118
160
|
end
|
119
161
|
|
120
162
|
### Additional lookup validation
|
121
163
|
|
122
164
|
To additionally perform a lookup via VIES:
|
123
165
|
|
124
|
-
validates :vat_number, :
|
166
|
+
validates :vat_number, valvat: {lookup: true}
|
125
167
|
|
126
168
|
By default this will validate to true if the VIES web service is down. To fail in this case simply add the `:fail_if_down` option:
|
127
169
|
|
128
|
-
validates :vat_number, :
|
170
|
+
validates :vat_number, valvat: {lookup: {fail_if_down: true}}
|
171
|
+
|
172
|
+
You can pass in any options accepted by `Valvat::Lookup#validate`:
|
173
|
+
|
174
|
+
validates :vat_number, valvat: {lookup: {raise_error: true, savon: {log: true}}}
|
129
175
|
|
130
176
|
### Additional (and experimental) checksum validation
|
131
177
|
|
132
178
|
To additionally perform a checksum validation:
|
133
179
|
|
134
|
-
validates :vat_number, :
|
180
|
+
validates :vat_number, valvat: {checksum: true}
|
135
181
|
|
136
182
|
### Additional ISO country code validation
|
137
183
|
|
138
184
|
If you want the vat number’s (ISO) country to match another country attribute, use the _match_country_ option:
|
139
185
|
|
140
|
-
validates :vat_number, :
|
186
|
+
validates :vat_number, valvat: {match_country: :country}
|
141
187
|
|
142
188
|
where it is supposed that your model has a method named _country_ which returns the country ISO code you want to match.
|
143
189
|
|
@@ -145,14 +191,14 @@ where it is supposed that your model has a method named _country_ which returns
|
|
145
191
|
|
146
192
|
By default blank vat numbers validate to false. To change this add the `:allow_blank` option:
|
147
193
|
|
148
|
-
validates :vat_number, :
|
194
|
+
validates :vat_number, valvat: {allow_blank: true}
|
149
195
|
|
150
196
|
### Allow vat numbers outside of europe
|
151
197
|
|
152
198
|
To allow vat numbers from outside of europe, add something like this to your model (country_code should return a upcase ISO country code):
|
153
199
|
|
154
200
|
class MyModel < ActiveRecord::Base
|
155
|
-
validates :vat_number, :
|
201
|
+
validates :vat_number, valvat: true, if: :eu?
|
156
202
|
|
157
203
|
def eu?
|
158
204
|
Valvat::Utils::EU_COUNTRIES.include?(country_code)
|
@@ -202,30 +248,12 @@ There seems to be a problem when using the VIES service over IPv6. Sadly this is
|
|
202
248
|
|
203
249
|
## Contributions by
|
204
250
|
|
205
|
-
|
206
|
-
* [0ctobat](https://github.com/0ctobat)
|
207
|
-
* [kaapa](https://github.com/kaapa)
|
208
|
-
* [descala](https://github.com/descala)
|
209
|
-
* [Carlos Hernández Medina](https://github.com/polimorfico)
|
210
|
-
* [Julik Tarkhanov](https://github.com/julik)
|
211
|
-
* [Roman Lehnert](https://github.com/romanlehnert)
|
212
|
-
* [0scarius](https://github.com/0scarius)
|
213
|
-
* [Davidslv](https://github.com/Davidslv)
|
214
|
-
* [brianphillips](https://github.com/brianphillips)
|
215
|
-
* [wasi](https://github.com/wasi)
|
216
|
-
* [liggitt](https://github.com/liggitt)
|
217
|
-
* [nevesenin](https://github.com/nevesenin)
|
218
|
-
* [shaundaley39](https://github.com/shaundaley39)
|
219
|
-
* [lcx](https://github.com/lcx)
|
220
|
-
* [kirichkov](https://github.com/kirichkov)
|
221
|
-
* [borodiychuk](https://github.com/borodiychuk)
|
222
|
-
* [opsidao](https://github.com/opsidao)
|
223
|
-
* [henrik](https://github.com/henrik)
|
224
|
-
* [SpoBo](https://github.com/SpoBo)
|
225
|
-
* [Deb Bassett](https://github.com/urbanwide)
|
251
|
+
https://github.com/yolk/valvat/graphs/contributors
|
226
252
|
|
227
253
|
## BlaBla
|
228
254
|
|
229
|
-
Copyright (c) 2011-
|
255
|
+
Copyright (c) 2011-2020 Yolk Sebastian Munz & Julia Soergel GbR
|
230
256
|
|
231
257
|
Beyond that, the implementation is licensed under the MIT License.
|
258
|
+
|
259
|
+
Code was originally extracted from our time tracking webapp [mite](https://mite.yo.lk/en/).
|
data/certs/yolk.pem
CHANGED
@@ -1,21 +1,25 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
+
|
20
|
-
|
2
|
+
MIIELDCCApSgAwIBAgIBATANBgkqhkiG9w0BAQsFADAgMR4wHAYDVQQDDBVzZWJh
|
3
|
+
c3RpYW4vREM9eW8vREM9bGswHhcNMTkxMTE1MTIzMzUwWhcNMjAxMTE0MTIzMzUw
|
4
|
+
WjAgMR4wHAYDVQQDDBVzZWJhc3RpYW4vREM9eW8vREM9bGswggGiMA0GCSqGSIb3
|
5
|
+
DQEBAQUAA4IBjwAwggGKAoIBgQC96oQ16N6R0H69fWFfsfHo2oIJHtLgETPK6ly+
|
6
|
+
tLeznJsZomCkZgFS0wNwnExr9qlH+AmygvNoaniVq/Pp2+2jwMuLgk5hkZMRM8Rf
|
7
|
+
i3wp5LCbW4BysT1rURQoqfo4iH8d60WgUl2Ggou70RMGlizvgvGOfszxfRTkuNXd
|
8
|
+
Eisbzs3UTKIWdx/umzHW4hbfbZcJ89cXoRLbxPjzozCfXPymmimlyva3Tu3QrxNH
|
9
|
+
/IBdzni9qj6gctmTYgWHMwzRJz+yJBY7V3G7jss/3vWaAoOhLns5bJUAXOvNsR4D
|
10
|
+
sWE5676q+Hi8Ti7B7AvWhqxB+9HSevjNrK+fNV7GFNRtbPW6o6vzYjPhtsdjluzP
|
11
|
+
94UA2AC6rjxtzNgzaXtQHZAnBjCf6ayoqbizh++SHU7J+tdoyxHjSfKPfdIW0P7Z
|
12
|
+
W5npDb+b2kGTa6cclciBpRqyZWVz0CIgi06k+GuxgroQVf7465CEjyh2krQqGXtt
|
13
|
+
A7d8gWiKsxpZgOjh5wFmFT97h8MCAwEAAaNxMG8wCQYDVR0TBAIwADALBgNVHQ8E
|
14
|
+
BAMCBLAwHQYDVR0OBBYEFOGxpUkCn17xMxFtmn/CFk5W57s6MBoGA1UdEQQTMBGB
|
15
|
+
D3NlYmFzdGlhbkB5by5sazAaBgNVHRIEEzARgQ9zZWJhc3RpYW5AeW8ubGswDQYJ
|
16
|
+
KoZIhvcNAQELBQADggGBAEDGrRAAvS7w793sYSoE8VAt45pw71zio2BgdcpYRoHB
|
17
|
+
rdaghjIVg77lybTmKdRGPM1T9m4zL01xddrqpgQFflVLmd/JVfEHwkLfJzZKvpy+
|
18
|
+
1vxgdIHhXkBB9G/X+LZC3PtMQx4f6BYIyf4kiVrTSWiKeeftFsH1tdvU5oYR7Gzy
|
19
|
+
dugPR09J0oVA/DiLlzfUy9o2meH8QyCGX8c0LHY8gx4C4orZz+FIFZczZB1FUOeu
|
20
|
+
LjR/yNUh7bYqwVHTQL5sajfQMFyt8HotazwdBvUETXGZW3VQZymR99gcMjr/H4xg
|
21
|
+
mPEildrYsY7glEKryCc2YDYC1ahqWshnpOLqAXatonsoDBXpVKl+HGsUnrnCiaxh
|
22
|
+
ctN4at+sy0CqPL+zXqp14b34rO0lP6hf0l+/LnuM96ImE+Rw+3gPX2iOtqivhrfM
|
23
|
+
rAFNAD1QEGN6elQdy1MRuXwjcUhM8P8ofLDEaE225TSZvAI+XoCxW2PSsQj5cGER
|
24
|
+
9vbf6JSKzQPa/HeBoU0s1Q==
|
21
25
|
-----END CERTIFICATE-----
|