valvat 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 903981843bd7255fc3baa92e31f82d45115a3b736fb1c4777a8009c61b9ddcf6
4
- data.tar.gz: 0ccb923e2374626b86d160ffde0ced09e585f9daa0cb4bd3d5cc1e889cd4ecac
3
+ metadata.gz: 0e7d92a2e8474b0badde3dfda893183f6109eed0d27cd485f7d3f22dfcae5723
4
+ data.tar.gz: f347f0ed55567d2b2c770f9eed233159baa5570bffa75eefbe341d75fa9d292b
5
5
  SHA512:
6
- metadata.gz: 149b8c92ae2a3b9eaf8bf3df09809598a38f5fc16700eb491b24fac05b5f5e242db470feda944846ea8b129ee7f39c4bdb2b809c6cf02eafeaaf31a6ffc7fb6c
7
- data.tar.gz: cac991af7a40140cd289a6166044258eebd2450333dd3ae3de8dc4565c03f2eeaf662c8d7357f0eb820963f37b88b420c1c5486fe0ff902dea428b1438fe4f37
6
+ metadata.gz: 3b195b61b4fbd02643bd219d7727932542ebc9f5b7e67bef71d31307575554f5dee7545e2cc983862959414c5b4237929f46e6989600439333e5082454af9e70
7
+ data.tar.gz: abedae554dd4f8b8a6d113df09a5e95990e454a43aca4c2723e8a966e86041ac2cd66fea812b66d5e5c039f9540c78b36e2574f7a7f82b67b90f549835255514
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.travis.yml CHANGED
@@ -30,4 +30,4 @@ matrix:
30
30
  - rvm: 1.9.3
31
31
  gemfile: gemfiles/before-ruby21/activemodel-3-2
32
32
  - rvm: 1.9.3
33
- gemfile: gemfiles/before-ruby21/standalone
33
+ gemfile: gemfiles/before-ruby21/standalone
data/CHANGES.md CHANGED
@@ -1,6 +1,13 @@
1
1
  ### dev
2
2
 
3
- [full changelog](http://github.com/yolk/valvat/compare/v0.8.1...master)
3
+ [full changelog](http://github.com/yolk/valvat/compare/v0.8.2...master)
4
+
5
+ ### 0.8.2 / 2019-11-15
6
+
7
+ [full changelog](http://github.com/yolk/valvat/compare/v0.8.1...v0.8.2)
8
+
9
+ * Fixed checksum computation for Slovenian VAT ID.
10
+ * Updated normalize regexp to clean spaces, punctuation and control chars (by [jarthod](https://github.com/jarthod))
4
11
 
5
12
  ### 0.8.1 / 2019-07-30
6
13
 
@@ -294,4 +301,4 @@
294
301
 
295
302
  [full changelog](http://github.com/yolk/valvat/compare/v0.0.1...v0.0.2)
296
303
 
297
- * Use REST-wrapper for accessing VIES web service; this removes dependency on savon and some lines of code. See http://isvat.appspot.com/
304
+ * Use REST-wrapper for accessing VIES web service; this removes dependency on savon and some lines of code. See http://isvat.appspot.com/
data/certs/yolk.pem CHANGED
@@ -1,21 +1,25 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MRIwEAYDVQQDDAlzZWJh
3
- c3RpYW4xEjAQBgoJkiaJk/IsZAEZFgJ5bzESMBAGCgmSJomT8ixkARkWAmxrMB4X
4
- DTE4MTEyMjEyMjEwMFoXDTE5MTEyMjEyMjEwMFowPDESMBAGA1UEAwwJc2ViYXN0
5
- aWFuMRIwEAYKCZImiZPyLGQBGRYCeW8xEjAQBgoJkiaJk/IsZAEZFgJsazCCASIw
6
- DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL2dehu5l3s+mT/kF7kaoyux9EmA
7
- RjpKifWtVP4NWieXHDZN2mV5dkUdw5TwKDL0IrKtp58ou0AzbEl8LLB7OsiRcOLf
8
- po5wt3ABCYkxUr+4tr5HfqmaUCPDTuE/5EF4uFVxLbL3Z6+5WLk21/tFNVyrjctc
9
- zaxqAt/VckFF+AFRI/vN2F+mrazeZZjLw1cBtw5YuJmorQv+VxAaZN+MbfLUL9WN
10
- fJegLqFjc2aCLsPa06YmveMvyr4p1e9VO10FkWeq+vuN66Sl16crr3wQusB1Yage
11
- aSwZQqDIfKnk9kxFtP1MrKnApTW1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-8,8 +8,8 @@ class Valvat
8
8
 
9
9
  def check_digit
10
10
  chk = sum_of_figues_for_pt_si
11
- chk == 1 ? 0 : chk
11
+ chk == 10 ? 0 : chk
12
12
  end
13
13
  end
14
14
  end
15
- end
15
+ end
data/lib/valvat/utils.rb CHANGED
@@ -3,7 +3,7 @@ class Valvat
3
3
 
4
4
  EU_COUNTRIES = %w(AT BE BG CY CZ DE DK EE ES FI FR GB GR HR HU IE IT LT LU LV MT NL PL PT RO SE SI SK)
5
5
  COUNTRY_PATTERN = /\A([A-Z]{2})(.+)\Z/
6
- NORMALIZE_PATTERN = /[-\.:_\s,;]+/
6
+ NORMALIZE_PATTERN = /[[:space:][:punct:][:cntrl:]]+/
7
7
 
8
8
  def self.split(vat)
9
9
  COUNTRY_PATTERN =~ vat
@@ -1,3 +1,3 @@
1
1
  class Valvat
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Valvat::Checksum::SI do
4
- %w(SI59082437 SI51049406 SI86154575 SI47431857 SI22511822 SI22511880).each do |valid_vat|
4
+ %w(SI59082437 SI51049406 SI86154575 SI47431857 SI22511822 SI26833921).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
8
8
 
9
- invalid_vat = "#{valid_vat[0..-5]}#{valid_vat[-1]}#{valid_vat[-4]}#{valid_vat[-3]}#{valid_vat[-2]}"
9
+ invalid_vat = "#{valid_vat[0..-2]}#{valid_vat[-1].to_i+1}"
10
10
 
11
11
  it "returns false on invalid vat #{invalid_vat}" do
12
12
  expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
@@ -20,4 +20,4 @@ describe Valvat::Checksum::SI do
20
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
@@ -49,6 +49,7 @@ describe Valvat::Utils do
49
49
 
50
50
  it "removes special chars" do
51
51
  expect(Valvat::Utils.normalize("DE.345-889_00:3,;")).to eql("DE345889003")
52
+ expect(Valvat::Utils.normalize("→ DE·Ö34588 9003\0 ☺")).to eql("→DEÖ345889003☺")
52
53
  end
53
54
  end
54
55
 
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.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Munz
@@ -10,27 +10,31 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MRIwEAYDVQQDDAlzZWJh
14
- c3RpYW4xEjAQBgoJkiaJk/IsZAEZFgJ5bzESMBAGCgmSJomT8ixkARkWAmxrMB4X
15
- DTE4MTEyMjEyMjEwMFoXDTE5MTEyMjEyMjEwMFowPDESMBAGA1UEAwwJc2ViYXN0
16
- aWFuMRIwEAYKCZImiZPyLGQBGRYCeW8xEjAQBgoJkiaJk/IsZAEZFgJsazCCASIw
17
- DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL2dehu5l3s+mT/kF7kaoyux9EmA
18
- RjpKifWtVP4NWieXHDZN2mV5dkUdw5TwKDL0IrKtp58ou0AzbEl8LLB7OsiRcOLf
19
- po5wt3ABCYkxUr+4tr5HfqmaUCPDTuE/5EF4uFVxLbL3Z6+5WLk21/tFNVyrjctc
20
- zaxqAt/VckFF+AFRI/vN2F+mrazeZZjLw1cBtw5YuJmorQv+VxAaZN+MbfLUL9WN
21
- fJegLqFjc2aCLsPa06YmveMvyr4p1e9VO10FkWeq+vuN66Sl16crr3wQusB1Yage
22
- aSwZQqDIfKnk9kxFtP1MrKnApTW1jmUahIcgv0j+yUCdnif6iy6qhvFI5ykCAwEA
23
- AaNxMG8w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Lns5bJUAXOvNsR4D
21
+ sWE5676q+Hi8Ti7B7AvWhqxB+9HSevjNrK+fNV7GFNRtbPW6o6vzYjPhtsdjluzP
22
+ 94UA2AC6rjxtzNgzaXtQHZAnBjCf6ayoqbizh++SHU7J+tdoyxHjSfKPfdIW0P7Z
23
+ W5npDb+b2kGTa6cclciBpRqyZWVz0CIgi06k+GuxgroQVf7465CEjyh2krQqGXtt
24
+ A7d8gWiKsxpZgOjh5wFmFT97h8MCAwEAAaNxMG8wCQYDVR0TBAIwADALBgNVHQ8E
25
+ BAMCBLAwHQYDVR0OBBYEFOGxpUkCn17xMxFtmn/CFk5W57s6MBoGA1UdEQQTMBGB
26
+ D3NlYmFzdGlhbkB5by5sazAaBgNVHRIEEzARgQ9zZWJhc3RpYW5AeW8ubGswDQYJ
27
+ KoZIhvcNAQELBQADggGBAEDGrRAAvS7w793sYSoE8VAt45pw71zio2BgdcpYRoHB
28
+ rdaghjIVg77lybTmKdRGPM1T9m4zL01xddrqpgQFflVLmd/JVfEHwkLfJzZKvpy+
29
+ 1vxgdIHhXkBB9G/X+LZC3PtMQx4f6BYIyf4kiVrTSWiKeeftFsH1tdvU5oYR7Gzy
30
+ dugPR09J0oVA/DiLlzfUy9o2meH8QyCGX8c0LHY8gx4C4orZz+FIFZczZB1FUOeu
31
+ LjR/yNUh7bYqwVHTQL5sajfQMFyt8HotazwdBvUETXGZW3VQZymR99gcMjr/H4xg
32
+ mPEildrYsY7glEKryCc2YDYC1ahqWshnpOLqAXatonsoDBXpVKl+HGsUnrnCiaxh
33
+ ctN4at+sy0CqPL+zXqp14b34rO0lP6hf0l+/LnuM96ImE+Rw+3gPX2iOtqivhrfM
34
+ rAFNAD1QEGN6elQdy1MRuXwjcUhM8P8ofLDEaE225TSZvAI+XoCxW2PSsQj5cGER
35
+ 9vbf6JSKzQPa/HeBoU0s1Q==
32
36
  -----END CERTIFICATE-----
33
- date: 2019-07-30 00:00:00.000000000 Z
37
+ date: 2019-11-15 00:00:00.000000000 Z
34
38
  dependencies:
35
39
  - !ruby/object:Gem::Dependency
36
40
  name: savon
metadata.gz.sig CHANGED
Binary file