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
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::BE do
|
4
4
|
%w(BE0123456749 BE0136695962 BE0817331995).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::BG do
|
4
4
|
%w(BG123456786 BG926067143 BG926067770 BG0101011739 BG0121013021 BG5041019992 BG1521687837 BG1431889037).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-4]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::CY do
|
4
4
|
%w(CY01234567U CY00532445O).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to be true
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-1]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to be false
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::DE do
|
4
4
|
%w(DE280857971 DE281381706 DE283108332 DE813622378 DE813628528 DE814178359 DE811907980).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::DK do
|
4
4
|
%w(DK13585628 DK61126228).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::EE do
|
4
4
|
%w(EE101234568 EE100207415).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to be true
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to be false
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::ES do
|
4
4
|
%w(ESA13585625 ESB83871236 ESE54507058 ES25139013J ESQ1518001A ESQ5018001G ESX4942978W ESX7676464F ESB10317980 ESY3860557K ESY2207765D).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-6]}#{valid_vat[-2]}#{valid_vat[-5]}#{valid_vat[-4]}#{valid_vat[-3]}#{valid_vat[-1]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::FI do
|
4
4
|
%w(FI13669598 FI20584306 FI01080233).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::FR do
|
4
4
|
%w(FR60528551658 FR43820567501).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe Valvat::Checksum::GB do
|
2
4
|
%w(GBGD100 GBHA600).each do |gov_agency_vat|
|
3
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT for government agency #{gov_agency_vat}" do
|
4
6
|
expect(Valvat::Checksum.validate(gov_agency_vat)).to be true
|
5
7
|
end
|
6
8
|
end
|
@@ -19,11 +21,11 @@ describe Valvat::Checksum::GB do
|
|
19
21
|
expect(Valvat::Checksum.validate('GB434031439')).to be true
|
20
22
|
end
|
21
23
|
|
22
|
-
it 'is false for an old format
|
24
|
+
it 'is false for an old format VAT in forbidden group' do
|
23
25
|
expect(Valvat::Checksum.validate('GB999999973')).to be false
|
24
26
|
end
|
25
27
|
|
26
|
-
it 'is false for a new format
|
28
|
+
it 'is false for a new format VAT in forbidden group' do
|
27
29
|
expect(Valvat::Checksum.validate('GB100000034')).to be false
|
28
30
|
end
|
29
31
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::GR do
|
4
4
|
%w(EL123456783 EL094543092 EL998219694).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::HR do
|
4
4
|
%w(HR06282943396 HR17099025134).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to be true
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to be false
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::HU do
|
4
4
|
%w(HU10672101 HU13460370 HU10747759).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to be true
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to be false
|
13
13
|
end
|
14
14
|
end
|
@@ -3,13 +3,19 @@ require 'spec_helper'
|
|
3
3
|
describe Valvat::Checksum::IE do
|
4
4
|
%w(IE8473625E IE0123459N IE9B12345N IE1113571MH IE2973912UH IE2974611LH
|
5
5
|
IE2974901UH IE3200115LH IE3206791MH IE3208913KH IE3214048CH).each do |valid_vat|
|
6
|
-
it "returns true on valid
|
6
|
+
it "returns true on valid VAT #{valid_vat}" do
|
7
7
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true), valid_vat
|
8
8
|
end
|
9
9
|
|
10
10
|
invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-1]}"
|
11
11
|
|
12
|
-
it "returns false on invalid
|
12
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
13
|
+
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
%w(IE0000000XX IE0000000AZ).each do |invalid_vat|
|
18
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
13
19
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
14
20
|
end
|
15
21
|
end
|
@@ -2,22 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::IT do
|
4
4
|
%w(IT12345670785 IT01897810162 IT00197200132 IT02762750210).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
it "returns false on invalid special case
|
16
|
+
it "returns false on invalid special case VAT IT12345671783" do
|
17
17
|
expect(Valvat::Checksum.validate("IT12345671783")).to eql(false)
|
18
18
|
end
|
19
19
|
|
20
|
-
it "returns false on invalid special case
|
20
|
+
it "returns false on invalid special case VAT IT00000000133" do
|
21
21
|
expect(Valvat::Checksum.validate("IT00000000133")).to eql(false)
|
22
22
|
end
|
23
23
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::LT do
|
4
4
|
%w(LT213179412 LT290061371314).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to be true
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to be false
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::LU do
|
4
4
|
%w(LU13669580 LU25361352 LU23124018 LU17560609).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-1]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::MT do
|
4
4
|
%w(MT11407334 MT10126313 MT11539237).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to be true
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to be false
|
13
13
|
end
|
14
14
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Valvat::Checksum::NL do
|
4
|
-
%w(NL123456782B12 NL802549391B01 NL808661863B01 NL820893559B01).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
4
|
+
%w(NL123456782B12 NL802549391B01 NL808661863B01 NL820893559B01 NL000099998B57 NL123456789B13).each do |valid_vat|
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
|
-
invalid_vat = "#{valid_vat[0..-5]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-4]}#{valid_vat[-1]}"
|
9
|
+
invalid_vat = "#{valid_vat[0..-5]}#{valid_vat[-2]}#{valid_vat[-3]}#{valid_vat[-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
@@ -2,18 +2,18 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::PL do
|
4
4
|
%w(PL8567346215 PL5260211587 PL9720575348 PL5272650022).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
it "returns false on special case invalid
|
16
|
+
it "returns false on special case invalid VAT PL8566445330" do
|
17
17
|
expect(Valvat::Checksum.validate("PL8566445330")).to eql(false)
|
18
18
|
end
|
19
19
|
end
|
@@ -5,13 +5,13 @@ describe Valvat::Checksum::PT do
|
|
5
5
|
subject { Valvat::Checksum }
|
6
6
|
|
7
7
|
%w(PT136695973 PT501413197 PT503037753 PT500243590 PT500100144 PT502921838).each do |valid_vat|
|
8
|
-
it "returns true on valid
|
8
|
+
it "returns true on valid VAT #{valid_vat}" do
|
9
9
|
expect(subject.validate(valid_vat)).to eql(true)
|
10
10
|
end
|
11
11
|
|
12
12
|
invalid_vat = "#{valid_vat[0..-5]}#{valid_vat[-1]}#{valid_vat[-4]}#{valid_vat[-2]}#{valid_vat[-3]}"
|
13
13
|
|
14
|
-
it "returns false on invalid
|
14
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
15
15
|
expect(subject.validate(invalid_vat)).to eql(false)
|
16
16
|
end
|
17
17
|
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::RO do
|
4
4
|
%w(RO123456789 RO99908 RO19 RO124 RO13182060).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to be true
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to be false
|
13
13
|
end
|
14
14
|
end
|
@@ -2,18 +2,18 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Valvat::Checksum::SE do
|
4
4
|
%w(SE136695975501 SE556464687401 SE502052817901 SE556555952201 SE556084097601).each do |valid_vat|
|
5
|
-
it "returns true on valid
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
invalid_vat = "#{valid_vat[0..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
it "returns false on special case invalid
|
16
|
+
it "returns false on special case invalid VAT SE556464687400" do
|
17
17
|
expect(Valvat::Checksum.validate("SE556464687400")).to eql(false)
|
18
18
|
end
|
19
19
|
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Valvat::Checksum::SI do
|
4
|
-
%w(SI59082437 SI51049406 SI86154575 SI47431857 SI22511822
|
5
|
-
it "returns true on valid
|
4
|
+
%w(SI59082437 SI51049406 SI86154575 SI47431857 SI22511822 SI26833921).each do |valid_vat|
|
5
|
+
it "returns true on valid VAT #{valid_vat}" do
|
6
6
|
expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
|
7
7
|
end
|
8
8
|
|
9
|
-
invalid_vat = "#{valid_vat[0..-
|
9
|
+
invalid_vat = "#{valid_vat[0..-2]}#{valid_vat[-1].to_i+1}"
|
10
10
|
|
11
|
-
it "returns false on invalid
|
11
|
+
it "returns false on invalid VAT #{invalid_vat}" do
|
12
12
|
expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
it "returns false on special case invalid
|
16
|
+
it "returns false on special case invalid VAT SI11111107" do
|
17
17
|
expect(Valvat::Checksum.validate("SI11111107")).to eql(false)
|
18
18
|
end
|
19
19
|
|
20
|
-
it "returns false on special case invalid
|
20
|
+
it "returns false on special case invalid VAT SI01111108" do
|
21
21
|
expect(Valvat::Checksum.validate("SI01111108")).to eql(false)
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|