valvat 0.6.8 → 0.6.9
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 +0 -0
- data/.gitignore +3 -1
- data/CHANGES.md +9 -1
- data/README.md +4 -2
- data/lib/valvat/checksum/es.rb +15 -6
- data/lib/valvat/locales/ca.yml +34 -0
- data/lib/valvat/locales/es.yml +4 -4
- data/lib/valvat/version.rb +1 -1
- data/spec/valvat/checksum/es_spec.rb +1 -1
- data/valvat.gemspec +1 -0
- data.tar.gz.sig +0 -0
- metadata +4 -5
- metadata.gz.sig +0 -0
- data/.rbenv-gemsets +0 -1
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbfcb15db4a635bac6916984c415c20bfcbdf89c
|
4
|
+
data.tar.gz: 7c72a583b3a5a9b3b001da112656c1d25a92c7e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ca1eb637a48062b27b3f6302bffc5fbc4d41c8b6060acf6d1b9925cbfb8114e377dff4bc2932ff5c8e8384557cfbe3b6fa3c08338095639307745f9eab823d9
|
7
|
+
data.tar.gz: adc20d41241cbbbe53133bf710b5bd24335b27f96dd57ad04decd73beb19b3438304485c21e9c79928764bb16df2fb01ccc20258304c821371b8740403eedf37
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/CHANGES.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
### dev
|
2
2
|
|
3
|
-
[full changelog](http://github.com/yolk/valvat/compare/v0.6.
|
3
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.6.9...master)
|
4
|
+
|
5
|
+
### 0.6.9 / 2015-03-19
|
6
|
+
|
7
|
+
[full changelog](http://github.com/yolk/valvat/compare/v0.6.8...v0.6.9)
|
8
|
+
|
9
|
+
* Added catalan translations (by [descala](https://github.com/descala))
|
10
|
+
* Added support for spanish NIE Y and Z (by [descala](https://github.com/descala))
|
11
|
+
* Fixed spanish translations (by [Carlos Hernández Medina](https://github.com/polimorfico))
|
4
12
|
|
5
13
|
### 0.6.8 / 2014-12-18
|
6
14
|
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Validates european vat numbers. Standalone or as a ActiveModel validator.
|
|
11
11
|
* Lookup via the VIES web service
|
12
12
|
* (Optional) ActiveModel/Rails3 integration
|
13
13
|
* Works standalone without ActiveModel
|
14
|
-
* I18n locales for country specific error messages in English, German, French, Spanish, Italian, Portuguese, Polish, Swedish, Dutch, Danish, Bulgarian, Romanian and
|
14
|
+
* I18n locales for country specific error messages in English, German, French, Spanish, Italian, Portuguese, Polish, Swedish, Dutch, Danish, Bulgarian, Romanian, Latvian and Catalan.
|
15
15
|
* *Experimental* checksum verification
|
16
16
|
|
17
17
|
valvat is tested and works with ruby MRI 1.9.3/2.0/2.1, jruby (in 1.9 mode) and ActiveModel 3.2/4.1
|
@@ -188,6 +188,8 @@ There seems to be a problem when using the VIES service over IPv6. Sadly this is
|
|
188
188
|
|
189
189
|
## Contributions by
|
190
190
|
|
191
|
+
* [descala](https://github.com/descala)
|
192
|
+
* [Carlos Hernández Medina](https://github.com/polimorfico)
|
191
193
|
* [Julik Tarkhanov](https://github.com/julik)
|
192
194
|
* [Roman Lehnert](https://github.com/romanlehnert)
|
193
195
|
* [0scarius](https://github.com/0scarius)
|
@@ -207,6 +209,6 @@ There seems to be a problem when using the VIES service over IPv6. Sadly this is
|
|
207
209
|
|
208
210
|
## BlaBla
|
209
211
|
|
210
|
-
Copyright (c) 2011-
|
212
|
+
Copyright (c) 2011-2015 Yolk Sebastian Munz & Julia Soergel GbR
|
211
213
|
|
212
214
|
Beyond that, the implementation is licensed under the MIT License.
|
data/lib/valvat/checksum/es.rb
CHANGED
@@ -2,22 +2,31 @@ class Valvat
|
|
2
2
|
module Checksum
|
3
3
|
class ES < Base
|
4
4
|
NATURAL_PERSON_CHARS = %w(T R W A G M Y F P D X B N J Z S Q V H L C K E)
|
5
|
-
NATURAL_PERSON_EXP = /\A([\d]{8}[ABCDEFGHJKLMNPQRSTVWXYZ]|[
|
6
|
-
|
7
|
-
|
5
|
+
NATURAL_PERSON_EXP = /\A([\d]{8}[ABCDEFGHJKLMNPQRSTVWXYZ]|[KLMXYZ][\d]{7}[ABCDEFGHJKLMNPQRSTVWXYZ])\Z/
|
6
|
+
LEGAL_PERSON_CHARS = [false] + %w(A B C D E F G H I J)
|
7
|
+
LEGAL_PERSON_EXP = /\A[NPQRSW][\d]{7}[ABCDEFGHIJ]\Z/
|
8
8
|
|
9
9
|
def check_digit
|
10
10
|
natural_person? ? check_digit_natural_person : check_digit_legal_person
|
11
11
|
end
|
12
12
|
|
13
13
|
def check_digit_natural_person
|
14
|
-
|
14
|
+
nie_digit = nil
|
15
|
+
letter = vat.to_s_wo_country[0]
|
16
|
+
if letter == 'X'
|
17
|
+
nie_digit = 0
|
18
|
+
elsif letter == 'Y'
|
19
|
+
nie_digit = 1
|
20
|
+
elsif letter == 'Z'
|
21
|
+
nie_digit = 2
|
22
|
+
end
|
23
|
+
NATURAL_PERSON_CHARS["#{nie_digit}#{figures_str}".to_i.modulo(23)]
|
15
24
|
end
|
16
25
|
|
17
26
|
def check_digit_legal_person
|
18
27
|
chk = 10 - sum_of_figures_for_at_es_it_se(true).modulo(10)
|
19
28
|
legal_foreign_person? ?
|
20
|
-
|
29
|
+
LEGAL_PERSON_CHARS[chk] :
|
21
30
|
(chk == 10 ? 0 : chk)
|
22
31
|
end
|
23
32
|
|
@@ -39,7 +48,7 @@ class Valvat
|
|
39
48
|
end
|
40
49
|
|
41
50
|
def legal_foreign_person?
|
42
|
-
!!(vat.to_s_wo_country =~
|
51
|
+
!!(vat.to_s_wo_country =~ LEGAL_PERSON_EXP)
|
43
52
|
end
|
44
53
|
end
|
45
54
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
ca:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
invalid_vat: no és un número d'IVA intracomunitari %{country_adjective} vàlid
|
5
|
+
valvat:
|
6
|
+
country_adjectives:
|
7
|
+
eu: europeu
|
8
|
+
at: austríac
|
9
|
+
be: belga
|
10
|
+
bg: búlgar
|
11
|
+
cy: xipriota
|
12
|
+
cz: txec
|
13
|
+
de: alemany
|
14
|
+
dk: danès
|
15
|
+
ee: estoni
|
16
|
+
es: espanyol
|
17
|
+
fi: finlandés
|
18
|
+
fr: francès
|
19
|
+
gb: britànic
|
20
|
+
gr: grec
|
21
|
+
hu: hungarès
|
22
|
+
ie: irlandès
|
23
|
+
it: italià
|
24
|
+
lt: lituà
|
25
|
+
lu: luxemburguès
|
26
|
+
lv: letó
|
27
|
+
mt: maltès
|
28
|
+
nl: holandès
|
29
|
+
pl: polac
|
30
|
+
pt: portuguès
|
31
|
+
ro: rumanès
|
32
|
+
se: suec
|
33
|
+
si: eslovec
|
34
|
+
sk: eslovac
|
data/lib/valvat/locales/es.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
es:
|
2
2
|
errors:
|
3
3
|
messages:
|
4
|
-
invalid_vat: el
|
4
|
+
invalid_vat: el número de IVA intracomunitario %{country_adjective} no es válido
|
5
5
|
valvat:
|
6
6
|
country_adjectives:
|
7
7
|
eu: europeo
|
@@ -18,7 +18,7 @@ es:
|
|
18
18
|
fr: francés
|
19
19
|
gb: británico
|
20
20
|
gr: griego
|
21
|
-
hu:
|
21
|
+
hu: húngaro
|
22
22
|
ie: irlandés
|
23
23
|
it: italiano
|
24
24
|
lt: lituano
|
@@ -28,7 +28,7 @@ es:
|
|
28
28
|
nl: holandés
|
29
29
|
pl: polaco
|
30
30
|
pt: portugués
|
31
|
-
ro:
|
31
|
+
ro: rumano
|
32
32
|
se: sueco
|
33
|
-
si:
|
33
|
+
si: esloveno
|
34
34
|
sk: eslovaco
|
data/lib/valvat/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Valvat::Checksum::ES do
|
4
|
-
%w(ESA13585625 ESB83871236 ESE54507058 ES25139013J ESQ1518001A ESQ5018001G ESX4942978W ESX7676464F ESB10317980).each do |valid_vat|
|
4
|
+
%w(ESA13585625 ESB83871236 ESE54507058 ES25139013J ESQ1518001A ESQ5018001G ESX4942978W ESX7676464F ESB10317980 ESY3860557K ESY2207765D).each do |valid_vat|
|
5
5
|
it "returns true on valid vat #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
data/valvat.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
s.cert_chain = ['certs/yolk.pem']
|
20
20
|
s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if $0 =~ /gem\z/
|
21
|
+
s.required_ruby_version = '>= 1.9.3'
|
21
22
|
|
22
23
|
s.add_dependency 'savon', '>= 2.3.0'
|
23
24
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valvat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Munz
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
wV8oppYhH3tRwfGrXgETqok7yPVYTZFcjCW9s9snwVE/JA23z12g54jVnaAP8SQH
|
31
31
|
L1HABGk4QCo=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: savon
|
@@ -96,8 +96,6 @@ extensions: []
|
|
96
96
|
extra_rdoc_files: []
|
97
97
|
files:
|
98
98
|
- ".gitignore"
|
99
|
-
- ".rbenv-gemsets"
|
100
|
-
- ".ruby-version"
|
101
99
|
- ".travis.yml"
|
102
100
|
- CHANGES.md
|
103
101
|
- Gemfile
|
@@ -129,6 +127,7 @@ files:
|
|
129
127
|
- lib/valvat/checksum/se.rb
|
130
128
|
- lib/valvat/checksum/si.rb
|
131
129
|
- lib/valvat/locales/bg.yml
|
130
|
+
- lib/valvat/locales/ca.yml
|
132
131
|
- lib/valvat/locales/cs.yml
|
133
132
|
- lib/valvat/locales/da.yml
|
134
133
|
- lib/valvat/locales/de.yml
|
@@ -184,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
183
|
requirements:
|
185
184
|
- - ">="
|
186
185
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
186
|
+
version: 1.9.3
|
188
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
188
|
requirements:
|
190
189
|
- - ">="
|
metadata.gz.sig
CHANGED
Binary file
|
data/.rbenv-gemsets
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
plugin
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.5
|