valvat 1.1.4 → 1.2.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 +0 -0
- data/.github/workflows/ruby.yml +3 -3
- data/.rubocop.yml +11 -2
- data/CHANGES.md +19 -2
- data/MIT-LICENSE +1 -1
- data/README.md +151 -80
- data/gemfiles/activemodel-6 +3 -0
- data/gemfiles/activemodel-7 +3 -0
- data/gemfiles/standalone +3 -0
- data/lib/active_model/validations/valvat_validator.rb +1 -1
- data/lib/valvat/checksum/es.rb +49 -16
- data/lib/valvat/checksum/fr.rb +1 -1
- data/lib/valvat/checksum/hr.rb +1 -1
- data/lib/valvat/checksum/hu.rb +1 -1
- data/lib/valvat/error.rb +16 -16
- data/lib/valvat/local.rb +2 -49
- data/lib/valvat/lookup/base.rb +73 -0
- data/lib/valvat/lookup/hmrc.rb +86 -0
- data/lib/valvat/lookup/vies.rb +98 -0
- data/lib/valvat/lookup.rb +16 -5
- data/lib/valvat/utils.rb +0 -1
- data/lib/valvat/version.rb +1 -1
- data/lib/valvat.rb +50 -4
- data/spec/spec_helper.rb +2 -1
- data/spec/valvat/checksum/es_spec.rb +48 -1
- data/spec/valvat/checksum/gb_spec.rb +1 -0
- data/spec/valvat/lookup/hmrc_spec.rb +32 -0
- data/spec/valvat/lookup/vies_spec.rb +23 -0
- data/spec/valvat/lookup_spec.rb +272 -80
- data/spec/valvat/utils_spec.rb +1 -1
- data/spec/valvat_spec.rb +12 -12
- data/valvat.gemspec +3 -2
- data.tar.gz.sig +0 -0
- metadata +24 -25
- metadata.gz.sig +0 -0
- data/lib/valvat/lookup/fault.rb +0 -38
- data/lib/valvat/lookup/request.rb +0 -57
- data/lib/valvat/lookup/response.rb +0 -37
- data/spec/valvat/lookup/fault_spec.rb +0 -34
- data/spec/valvat/lookup/request_spec.rb +0 -32
- data/spec/valvat/lookup/response_spec.rb +0 -29
data/spec/valvat/lookup_spec.rb
CHANGED
@@ -4,96 +4,162 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Valvat::Lookup do
|
6
6
|
describe '#validate' do
|
7
|
-
context 'with existing VAT number' do
|
7
|
+
context 'with existing EU VAT number' do
|
8
8
|
it 'returns true' do
|
9
9
|
result = described_class.validate('IE6388047V')
|
10
|
-
|
11
|
-
expect(result).to be(true)
|
10
|
+
skip 'VIES is down' if result.nil?
|
11
|
+
expect(result).to be(true)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'allows Valvat instance as input' do
|
15
15
|
result = described_class.validate(Valvat.new('IE6388047V'))
|
16
|
-
|
17
|
-
expect(result).to be(true)
|
16
|
+
skip 'VIES is down' if result.nil?
|
17
|
+
expect(result).to be(true)
|
18
18
|
end
|
19
|
-
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
context 'with details' do
|
21
|
+
it 'returns hash of details instead of true' do
|
22
|
+
result = described_class.validate('IE6388047V', detail: true)
|
23
|
+
skip 'VIES is down' if result.nil?
|
24
|
+
|
25
|
+
expect(result).to match({
|
26
|
+
request_date: kind_of(Date),
|
27
|
+
country_code: 'IE',
|
28
|
+
vat_number: '6388047V',
|
29
|
+
name: 'GOOGLE IRELAND LIMITED',
|
30
|
+
address: '3RD FLOOR, GORDON HOUSE, BARROW STREET, DUBLIN 4',
|
31
|
+
valid: true
|
32
|
+
})
|
33
|
+
end
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
29
|
-
context 'with
|
30
|
-
it 'returns
|
31
|
-
|
32
|
-
|
37
|
+
context 'with existing GB VAT number' do
|
38
|
+
it 'returns true' do
|
39
|
+
result = described_class.validate('GB727255821', uk: true)
|
40
|
+
skip 'HMRC is down' if result.nil?
|
41
|
+
expect(result).to be(true)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'returns details in format similar to VIES' do
|
45
|
+
result = described_class.validate('GB727255821', detail: true, uk: true)
|
46
|
+
skip 'HMRC is down' if result.nil?
|
47
|
+
expect(result).to match({
|
48
|
+
request_date: kind_of(Time),
|
49
|
+
country_code: 'GB',
|
50
|
+
vat_number: '727255821',
|
51
|
+
name: 'AMAZON EU SARL',
|
52
|
+
address: "1 PRINCIPAL PLACE\nWORSHIP STREET\nLONDON\nEC2A 2FA\nGB",
|
53
|
+
valid: true
|
54
|
+
})
|
33
55
|
end
|
34
56
|
end
|
35
57
|
|
36
|
-
context 'with
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
name: 'GOOGLE IRELAND LIMITED',
|
42
|
-
address: '3RD FLOOR, GORDON HOUSE, BARROW STREET, DUBLIN 4',
|
43
|
-
valid: true
|
44
|
-
}
|
58
|
+
context 'with not existing EU VAT number' do
|
59
|
+
it 'returns false' do
|
60
|
+
result = described_class.validate('IE6388048V')
|
61
|
+
skip 'VIES is down' if result.nil?
|
62
|
+
expect(result).to be(false)
|
45
63
|
end
|
46
64
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
expect(result
|
52
|
-
expect(result).to eql(details)
|
65
|
+
context 'with details' do
|
66
|
+
it 'still returns false' do
|
67
|
+
result = described_class.validate('LU21416128', detail: true)
|
68
|
+
skip 'VIES is down' if result.nil?
|
69
|
+
expect(result).to be(false)
|
53
70
|
end
|
54
71
|
end
|
72
|
+
end
|
55
73
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
74
|
+
context 'with not existing GB VAT number' do
|
75
|
+
it 'returns false' do
|
76
|
+
result = described_class.validate('GB727255820', uk: true)
|
77
|
+
skip 'HMRC is down' if result.nil?
|
78
|
+
expect(result).to be(false)
|
60
79
|
end
|
61
80
|
end
|
62
81
|
|
63
|
-
context 'with
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
country_code: 'IE',
|
68
|
-
vat_number: '6388047V',
|
69
|
-
name: 'GOOGLE IRELAND LIMITED',
|
70
|
-
company_type: nil,
|
71
|
-
address: '3RD FLOOR, GORDON HOUSE, BARROW STREET, DUBLIN 4',
|
72
|
-
valid: true
|
73
|
-
}
|
82
|
+
context 'with invalid country code / input' do
|
83
|
+
it 'returns false' do
|
84
|
+
expect(described_class.validate('AE259597697')).to be(false)
|
85
|
+
expect(described_class.validate('')).to be(false)
|
74
86
|
end
|
87
|
+
end
|
75
88
|
|
89
|
+
context 'with request identifier' do
|
76
90
|
it 'returns hash of details instead of true' do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
91
|
+
result = described_class.validate('IE6388047V', requester: 'IE6388047V')
|
92
|
+
|
93
|
+
skip 'VIES is down' if result.nil?
|
94
|
+
|
95
|
+
expect(result).to match({
|
96
|
+
request_date: kind_of(Date),
|
97
|
+
request_identifier: /\A[\w\W]{16}\Z/,
|
98
|
+
country_code: 'IE',
|
99
|
+
vat_number: '6388047V',
|
100
|
+
name: 'GOOGLE IRELAND LIMITED',
|
101
|
+
company_type: nil,
|
102
|
+
address: '3RD FLOOR, GORDON HOUSE, BARROW STREET, DUBLIN 4',
|
103
|
+
valid: true
|
104
|
+
})
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'supports old :requester_vat option for backwards compatibility' do
|
108
|
+
result = described_class.validate('IE6388047V', requester_vat: 'LU21416127')
|
109
|
+
|
110
|
+
expect(result).to match({
|
111
|
+
request_date: kind_of(Date),
|
112
|
+
request_identifier: /\A[\w\W]{16}\Z/,
|
113
|
+
country_code: 'IE',
|
114
|
+
vat_number: '6388047V',
|
115
|
+
name: 'GOOGLE IRELAND LIMITED',
|
116
|
+
company_type: nil,
|
117
|
+
address: '3RD FLOOR, GORDON HOUSE, BARROW STREET, DUBLIN 4',
|
118
|
+
valid: true
|
119
|
+
})
|
120
|
+
end
|
121
|
+
|
122
|
+
context 'with GB VAT number' do
|
123
|
+
it 'returns hash of details with request number' do
|
124
|
+
response = described_class.validate('GB727255821', requester: 'GB727255821', uk: true)
|
125
|
+
skip 'HMRC is down' if response.nil?
|
126
|
+
expect(response).to match({
|
127
|
+
request_date: kind_of(Time),
|
128
|
+
request_identifier: /\A\w\w\w-\w\w\w-\w\w\w\Z/,
|
129
|
+
country_code: 'GB',
|
130
|
+
vat_number: '727255821',
|
131
|
+
name: 'AMAZON EU SARL',
|
132
|
+
address: "1 PRINCIPAL PLACE\nWORSHIP STREET\nLONDON\nEC2A 2FA\nGB",
|
133
|
+
valid: true
|
134
|
+
})
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'raises exception if requester is not from GB' do
|
138
|
+
expect do
|
139
|
+
described_class.validate('GB727255821', requester: 'IE6388047V', uk: true)
|
140
|
+
end.to raise_error(Valvat::InvalidRequester,
|
141
|
+
'The HMRC web service returned the error: '\
|
142
|
+
'INVALID_REQUEST (Invalid requesterVrn - Vrn parameters should be 9 or 12 digits)')
|
82
143
|
end
|
83
|
-
end
|
84
144
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
145
|
+
it 'raises exception if requester is not valid' do
|
146
|
+
expect do
|
147
|
+
described_class.validate('GB727255821', requester: 'GB6388047', uk: true)
|
148
|
+
end.to raise_error(Valvat::InvalidRequester,
|
149
|
+
'The HMRC web service returned the error: '\
|
150
|
+
'INVALID_REQUEST (Invalid requesterVrn - Vrn parameters should be 9 or 12 digits)')
|
151
|
+
end
|
89
152
|
end
|
90
153
|
end
|
91
154
|
end
|
92
155
|
|
93
156
|
describe '#validate with VIES test enviroment' do
|
94
157
|
let(:options) do
|
95
|
-
{
|
96
|
-
|
158
|
+
{ skip_local_validation: true }
|
159
|
+
end
|
160
|
+
|
161
|
+
before do
|
162
|
+
stub_const('Valvat::Lookup::VIES::ENDPOINT_URI', URI('https://ec.europa.eu/taxation_customs/vies/test-services/checkVatTestService'))
|
97
163
|
end
|
98
164
|
|
99
165
|
context 'with valid request with valid VAT number' do
|
@@ -132,7 +198,7 @@ describe Valvat::Lookup do
|
|
132
198
|
subject(:result) { described_class.validate('DE300', options) }
|
133
199
|
|
134
200
|
it 'returns nil' do
|
135
|
-
expect(result).to
|
201
|
+
expect(result).to be_nil
|
136
202
|
end
|
137
203
|
|
138
204
|
it 'raises error with raise_error: true' do
|
@@ -146,7 +212,7 @@ describe Valvat::Lookup do
|
|
146
212
|
subject(:result) { described_class.validate('DE301', options) }
|
147
213
|
|
148
214
|
it 'returns nil' do
|
149
|
-
expect(result).to
|
215
|
+
expect(result).to be_nil
|
150
216
|
end
|
151
217
|
|
152
218
|
it 'raises error with raise_error: true' do
|
@@ -164,7 +230,23 @@ describe Valvat::Lookup do
|
|
164
230
|
end
|
165
231
|
|
166
232
|
it 'returns nil with raise_error set to false' do
|
167
|
-
expect(described_class.validate('DE302', options.merge(raise_error: false))).to
|
233
|
+
expect(described_class.validate('DE302', options.merge(raise_error: false))).to be_nil
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe 'Network timeout' do
|
238
|
+
subject(:result) { described_class.validate('DE200', options) }
|
239
|
+
|
240
|
+
before { stub_request(:post, /ec.europa.eu/).to_timeout }
|
241
|
+
|
242
|
+
it 'raises error' do
|
243
|
+
expect { result }.to raise_error(Net::OpenTimeout, 'execution expired')
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'also raises error with raise_error set to false (not handled)' do
|
247
|
+
expect do
|
248
|
+
described_class.validate('DE302', options.merge(raise_error: false))
|
249
|
+
end.to raise_error(Net::OpenTimeout, 'execution expired')
|
168
250
|
end
|
169
251
|
end
|
170
252
|
|
@@ -176,7 +258,7 @@ describe Valvat::Lookup do
|
|
176
258
|
end
|
177
259
|
|
178
260
|
it 'returns nil with raise_error set to false' do
|
179
|
-
expect(described_class.validate('DE400', options.merge(raise_error: false))).to
|
261
|
+
expect(described_class.validate('DE400', options.merge(raise_error: false))).to be_nil
|
180
262
|
end
|
181
263
|
end
|
182
264
|
|
@@ -188,7 +270,7 @@ describe Valvat::Lookup do
|
|
188
270
|
end
|
189
271
|
|
190
272
|
it 'returns nil with raise_error set to false' do
|
191
|
-
expect(described_class.validate('DE401', options.merge(raise_error: false))).to
|
273
|
+
expect(described_class.validate('DE401', options.merge(raise_error: false))).to be_nil
|
192
274
|
end
|
193
275
|
end
|
194
276
|
|
@@ -200,7 +282,7 @@ describe Valvat::Lookup do
|
|
200
282
|
end
|
201
283
|
|
202
284
|
it 'returns nil with raise_error set to false' do
|
203
|
-
expect(described_class.validate('DE500', options.merge(raise_error: false))).to
|
285
|
+
expect(described_class.validate('DE500', options.merge(raise_error: false))).to be_nil
|
204
286
|
end
|
205
287
|
end
|
206
288
|
|
@@ -212,7 +294,7 @@ describe Valvat::Lookup do
|
|
212
294
|
end
|
213
295
|
|
214
296
|
it 'returns nil with raise_error set to false' do
|
215
|
-
expect(described_class.validate('DE501', options.merge(raise_error: false))).to
|
297
|
+
expect(described_class.validate('DE501', options.merge(raise_error: false))).to be_nil
|
216
298
|
end
|
217
299
|
end
|
218
300
|
|
@@ -224,7 +306,7 @@ describe Valvat::Lookup do
|
|
224
306
|
end
|
225
307
|
|
226
308
|
it 'returns nil with raise_error set to false' do
|
227
|
-
expect(described_class.validate('DE600', options.merge(raise_error: false))).to
|
309
|
+
expect(described_class.validate('DE600', options.merge(raise_error: false))).to be_nil
|
228
310
|
end
|
229
311
|
end
|
230
312
|
|
@@ -236,41 +318,151 @@ describe Valvat::Lookup do
|
|
236
318
|
end
|
237
319
|
|
238
320
|
it 'returns nil with raise_error set to false' do
|
239
|
-
expect(described_class.validate('DE601', options.merge(raise_error: false))).to
|
321
|
+
expect(described_class.validate('DE601', options.merge(raise_error: false))).to be_nil
|
240
322
|
end
|
241
323
|
end
|
242
324
|
|
243
|
-
describe 'Error :
|
325
|
+
describe 'Error : HTTP error' do
|
326
|
+
subject(:result) { described_class.validate('DE601', options) }
|
327
|
+
|
244
328
|
before do
|
245
|
-
|
246
|
-
allow(Savon::Client).to receive(:new).and_return(dbl)
|
247
|
-
allow(dbl).to receive(:call).and_raise(Savon::UnknownOperationError.new('from stub'))
|
329
|
+
stub_request(:post, %r{\Ahttps://ec\.europa\.eu}).to_return({ status: 405 })
|
248
330
|
end
|
249
|
-
subject(:result) { described_class.validate('DE601', options) }
|
250
331
|
|
251
332
|
it 'raises error' do
|
252
|
-
expect { result }.to raise_error(Valvat::
|
333
|
+
expect { result }.to raise_error(Valvat::HTTPError, 'The VIES web service returned the error: 405')
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'returns nil with raise_error set to false' do
|
337
|
+
expect(described_class.validate('DE601', options.merge(raise_error: false))).to be_nil
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
describe '#validate with HMRC test enviroment' do
|
343
|
+
# https://developer.service.hmrc.gov.uk/api-documentation/docs/testing
|
344
|
+
# https://github.com/hmrc/vat-registered-companies-api/blob/master/public/api/conf/1.0/test-data/vrn.csv
|
345
|
+
subject(:result) { described_class.validate('GB123456789', uk: true) }
|
346
|
+
|
347
|
+
before do
|
348
|
+
stub_const('Valvat::Lookup::HMRC::ENDPOINT_URL', 'https://test-api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup')
|
349
|
+
end
|
350
|
+
|
351
|
+
context 'with valid request with valid VAT number' do
|
352
|
+
it 'returns true' do
|
353
|
+
expect(described_class.validate('GB553557881', uk: true)).to be(true)
|
354
|
+
expect(described_class.validate('GB146295999727', uk: true)).to be(true)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
context 'with valid request with an invalid VAT number' do
|
359
|
+
it 'returns false' do
|
360
|
+
expect(result).to be(false)
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
describe 'Error : MESSAGE_THROTTLED_OUT' do
|
365
|
+
before do
|
366
|
+
stub_request(:get, /test-api.service.hmrc.gov.uk/).to_return(
|
367
|
+
status: 429,
|
368
|
+
body: '{"code":"MESSAGE_THROTTLED_OUT"}'
|
369
|
+
)
|
370
|
+
end
|
371
|
+
|
372
|
+
it 'raises error' do
|
373
|
+
expect { result }.to raise_error(Valvat::RateLimitError, /MESSAGE_THROTTLED_OUT/)
|
253
374
|
end
|
254
375
|
|
255
376
|
it 'returns nil with raise_error set to false' do
|
256
|
-
expect(described_class.validate('
|
377
|
+
expect(described_class.validate('GB123456789', raise_error: false, uk: true)).to be_nil
|
257
378
|
end
|
258
379
|
end
|
259
380
|
|
260
|
-
describe 'Error :
|
381
|
+
describe 'Error : SCHEDULED_MAINTENANCE' do
|
261
382
|
before do
|
262
|
-
|
263
|
-
|
264
|
-
|
383
|
+
stub_request(:get, /test-api.service.hmrc.gov.uk/).to_return(
|
384
|
+
status: 503,
|
385
|
+
body: '{"code":"SCHEDULED_MAINTENANCE"}'
|
386
|
+
)
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'returns nil' do
|
390
|
+
expect(result).to be_nil
|
391
|
+
end
|
392
|
+
|
393
|
+
it 'raises error with raise_error set to false' do
|
394
|
+
expect do
|
395
|
+
described_class.validate('GB123456789', raise_error: true, uk: true)
|
396
|
+
end.to raise_error(Valvat::ServiceUnavailable, 'The HMRC web service returned the error: SCHEDULED_MAINTENANCE')
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
describe 'Error : SERVER_ERROR' do
|
401
|
+
before do
|
402
|
+
stub_request(:get, /test-api.service.hmrc.gov.uk/).to_return(
|
403
|
+
status: 503,
|
404
|
+
body: '{"code":"SERVER_ERROR"}'
|
405
|
+
)
|
406
|
+
end
|
407
|
+
|
408
|
+
it 'returns nil' do
|
409
|
+
expect(result).to be_nil
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'raises error with raise_error set to false' do
|
413
|
+
expect do
|
414
|
+
described_class.validate('GB123456789', raise_error: true, uk: true)
|
415
|
+
end.to raise_error(Valvat::ServiceUnavailable, 'The HMRC web service returned the error: SERVER_ERROR')
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
describe 'Error : GATEWAY_TIMEOUT' do
|
420
|
+
before do
|
421
|
+
stub_request(:get, /test-api.service.hmrc.gov.uk/).to_return(
|
422
|
+
status: 504,
|
423
|
+
body: '{"code":"GATEWAY_TIMEOUT"}'
|
424
|
+
)
|
425
|
+
end
|
426
|
+
|
427
|
+
it 'raises error' do
|
428
|
+
expect { result }.to raise_error(Valvat::Timeout, /GATEWAY_TIMEOUT/)
|
429
|
+
end
|
430
|
+
|
431
|
+
it 'returns nil with raise_error set to false' do
|
432
|
+
expect(described_class.validate('GB123456789', raise_error: false, uk: true)).to be_nil
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
describe 'Network timeout' do
|
437
|
+
before do
|
438
|
+
stub_request(:get, /test-api.service.hmrc.gov.uk/).to_timeout
|
439
|
+
end
|
440
|
+
|
441
|
+
it 'raises error' do
|
442
|
+
expect { result }.to raise_error(Net::OpenTimeout)
|
443
|
+
end
|
444
|
+
|
445
|
+
it 'also raises error with raise_error set to false (not handled)' do
|
446
|
+
expect do
|
447
|
+
described_class.validate('GB123456789', raise_error: false, uk: true)
|
448
|
+
end.to raise_error(Net::OpenTimeout)
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
describe 'Error : INTERNAL_SERVER_ERROR' do
|
453
|
+
before do
|
454
|
+
stub_request(:get, /test-api.service.hmrc.gov.uk/).to_return(
|
455
|
+
status: 500,
|
456
|
+
body: '{"code":"INTERNAL_SERVER_ERROR"}'
|
457
|
+
)
|
265
458
|
end
|
266
|
-
subject(:result) { described_class.validate('DE601', options) }
|
267
459
|
|
268
460
|
it 'raises error' do
|
269
|
-
expect { result }.to raise_error(Valvat::
|
461
|
+
expect { result }.to raise_error(Valvat::UnknownLookupError, /INTERNAL_SERVER_ERROR/)
|
270
462
|
end
|
271
463
|
|
272
464
|
it 'returns nil with raise_error set to false' do
|
273
|
-
expect(described_class.validate('
|
465
|
+
expect(described_class.validate('GB123456789', raise_error: false, uk: true)).to be_nil
|
274
466
|
end
|
275
467
|
end
|
276
468
|
end
|
data/spec/valvat/utils_spec.rb
CHANGED
@@ -56,7 +56,7 @@ describe Valvat::Utils do
|
|
56
56
|
it 'removes special chars' do
|
57
57
|
expect(described_class.normalize('DE.345-889_00:3,;')).to eql('DE345889003')
|
58
58
|
expect(described_class.normalize("→ DE·Ö34588 9003\0 ☺")).to eql(
|
59
|
-
|
59
|
+
'→DEÖ345889003☺'
|
60
60
|
)
|
61
61
|
end
|
62
62
|
end
|
data/spec/valvat_spec.rb
CHANGED
@@ -171,15 +171,15 @@ describe Valvat do
|
|
171
171
|
|
172
172
|
describe '#iso_country_code' do
|
173
173
|
it 'returns nil' do
|
174
|
-
expect(us_vat.iso_country_code).to
|
175
|
-
expect(ch_vat.iso_country_code).to
|
174
|
+
expect(us_vat.iso_country_code).to be_nil
|
175
|
+
expect(ch_vat.iso_country_code).to be_nil
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
179
|
describe '#vat_country_code' do
|
180
180
|
it 'returns nil' do
|
181
|
-
expect(us_vat.vat_country_code).to
|
182
|
-
expect(ch_vat.vat_country_code).to
|
181
|
+
expect(us_vat.vat_country_code).to be_nil
|
182
|
+
expect(ch_vat.vat_country_code).to be_nil
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
@@ -231,19 +231,19 @@ describe Valvat do
|
|
231
231
|
|
232
232
|
describe '#iso_country_code' do
|
233
233
|
it 'returns nil' do
|
234
|
-
expect(only_iso_vat.iso_country_code).to
|
235
|
-
expect(num_vat.iso_country_code).to
|
236
|
-
expect(empty_vat.iso_country_code).to
|
237
|
-
expect(nil_vat.iso_country_code).to
|
234
|
+
expect(only_iso_vat.iso_country_code).to be_nil
|
235
|
+
expect(num_vat.iso_country_code).to be_nil
|
236
|
+
expect(empty_vat.iso_country_code).to be_nil
|
237
|
+
expect(nil_vat.iso_country_code).to be_nil
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
241
|
describe '#vat_country_code' do
|
242
242
|
it 'returns nil' do
|
243
|
-
expect(only_iso_vat.vat_country_code).to
|
244
|
-
expect(num_vat.vat_country_code).to
|
245
|
-
expect(empty_vat.vat_country_code).to
|
246
|
-
expect(nil_vat.vat_country_code).to
|
243
|
+
expect(only_iso_vat.vat_country_code).to be_nil
|
244
|
+
expect(num_vat.vat_country_code).to be_nil
|
245
|
+
expect(empty_vat.vat_country_code).to be_nil
|
246
|
+
expect(nil_vat.vat_country_code).to be_nil
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
data/valvat.gemspec
CHANGED
@@ -20,9 +20,10 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
|
21
21
|
s.required_ruby_version = '>= 2.5.0'
|
22
22
|
|
23
|
-
s.add_dependency 'savon', '>= 2.3.0'
|
24
|
-
|
25
23
|
s.add_development_dependency 'activemodel', '>= 5.0'
|
26
24
|
s.add_development_dependency 'rake'
|
27
25
|
s.add_development_dependency 'rspec', '~> 3.0'
|
26
|
+
s.add_development_dependency 'webmock', '~> 3.0'
|
27
|
+
|
28
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
28
29
|
end
|
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: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Munz
|
@@ -35,52 +35,52 @@ cert_chain:
|
|
35
35
|
BUdT7mtr41GgvWnIjaGWAldSuabxx5H+PKS5FzjNDMHThRZWuvYp/nP2RXDh4gIa
|
36
36
|
7hV09P+XxvS96G+petG5KmC/lev8VqKu
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: activemodel
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
47
|
-
type: :
|
46
|
+
version: '5.0'
|
47
|
+
type: :development
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: '5.0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
55
|
+
name: rake
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '0'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '0'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: rspec
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
74
|
+
version: '3.0'
|
75
75
|
type: :development
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "
|
79
|
+
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
81
|
+
version: '3.0'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
83
|
+
name: webmock
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
@@ -166,9 +166,9 @@ files:
|
|
166
166
|
- lib/valvat/locales/sv.yml
|
167
167
|
- lib/valvat/locales/tr.yml
|
168
168
|
- lib/valvat/lookup.rb
|
169
|
-
- lib/valvat/lookup/
|
170
|
-
- lib/valvat/lookup/
|
171
|
-
- lib/valvat/lookup/
|
169
|
+
- lib/valvat/lookup/base.rb
|
170
|
+
- lib/valvat/lookup/hmrc.rb
|
171
|
+
- lib/valvat/lookup/vies.rb
|
172
172
|
- lib/valvat/syntax.rb
|
173
173
|
- lib/valvat/utils.rb
|
174
174
|
- lib/valvat/version.rb
|
@@ -200,9 +200,8 @@ files:
|
|
200
200
|
- spec/valvat/checksum/se_spec.rb
|
201
201
|
- spec/valvat/checksum/si_spec.rb
|
202
202
|
- spec/valvat/checksum_spec.rb
|
203
|
-
- spec/valvat/lookup/
|
204
|
-
- spec/valvat/lookup/
|
205
|
-
- spec/valvat/lookup/response_spec.rb
|
203
|
+
- spec/valvat/lookup/hmrc_spec.rb
|
204
|
+
- spec/valvat/lookup/vies_spec.rb
|
206
205
|
- spec/valvat/lookup_spec.rb
|
207
206
|
- spec/valvat/syntax_spec.rb
|
208
207
|
- spec/valvat/utils_spec.rb
|
@@ -211,7 +210,8 @@ files:
|
|
211
210
|
homepage: https://github.com/yolk/valvat
|
212
211
|
licenses:
|
213
212
|
- MIT
|
214
|
-
metadata:
|
213
|
+
metadata:
|
214
|
+
rubygems_mfa_required: 'true'
|
215
215
|
post_install_message:
|
216
216
|
rdoc_options: []
|
217
217
|
require_paths:
|
@@ -260,9 +260,8 @@ test_files:
|
|
260
260
|
- spec/valvat/checksum/se_spec.rb
|
261
261
|
- spec/valvat/checksum/si_spec.rb
|
262
262
|
- spec/valvat/checksum_spec.rb
|
263
|
-
- spec/valvat/lookup/
|
264
|
-
- spec/valvat/lookup/
|
265
|
-
- spec/valvat/lookup/response_spec.rb
|
263
|
+
- spec/valvat/lookup/hmrc_spec.rb
|
264
|
+
- spec/valvat/lookup/vies_spec.rb
|
266
265
|
- spec/valvat/lookup_spec.rb
|
267
266
|
- spec/valvat/syntax_spec.rb
|
268
267
|
- spec/valvat/utils_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|