vatsense 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +57 -0
- data/lib/vatsense/client.rb +5 -0
- data/lib/vatsense/models/batch.rb +218 -0
- data/lib/vatsense/models/batch_delete_response.rb +41 -0
- data/lib/vatsense/models/batch_list_response.rb +51 -0
- data/lib/vatsense/models/batch_response.rb +23 -0
- data/lib/vatsense/models/batch_result.rb +133 -0
- data/lib/vatsense/models/batch_results_response.rb +42 -0
- data/lib/vatsense/models/validate_check_params.rb +13 -1
- data/lib/vatsense/models/validate_check_response.rb +7 -0
- data/lib/vatsense/models.rb +4 -0
- data/lib/vatsense/resources/batches.rb +249 -0
- data/lib/vatsense/resources/validate.rb +1 -1
- data/lib/vatsense/version.rb +1 -1
- data/lib/vatsense/webhook.rb +104 -0
- data/lib/vatsense.rb +8 -0
- data/sig/vatsense/client.rbs +2 -0
- data/sig/vatsense/models/batch.rbs +57 -0
- data/sig/vatsense/models/batch_delete_response.rbs +17 -0
- data/sig/vatsense/models/batch_list_response.rbs +19 -0
- data/sig/vatsense/models/batch_response.rbs +10 -0
- data/sig/vatsense/models/batch_result.rbs +38 -0
- data/sig/vatsense/models/batch_results_response.rbs +17 -0
- data/sig/vatsense/models/validate_check_params.rbs +7 -1
- data/sig/vatsense/models/validate_check_response.rbs +5 -0
- data/sig/vatsense/resources/batches.rbs +72 -0
- data/sig/vatsense/resources/validate.rbs +1 -0
- data/sig/vatsense/webhook.rbs +28 -0
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 545dba99e82c0ea68686b4318c86e77b2a57a3842713fecce4adbf932a295325
|
|
4
|
+
data.tar.gz: d82f2a18070fe8b37f39db698bc28ba3874d85ac74c22faf3bd1167af7479888
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95d23b868d1729853cb236a65d52ab68798870b49ad2b80fcf8549b5f80da09ca2f57dcb6613628b3ba68ff070ce203b404e25022fba22cd333e678ea2828aa2
|
|
7
|
+
data.tar.gz: 42ec264bfa4a4f46f937e4c4826cfdd1a69e34deb6f7ef9c2ac718612069767d29acbe04b46e72e68e1e165f208f863cc75b49853664714648382ecc848672a8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.0](https://github.com/VAT-Sense/vatsense-ruby/compare/v0.2.0...v0.3.0) (2026-11-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **api:** batches, consultation_optional, confirmation_number and webhook signatures ([#9](https://github.com/VAT-Sense/vatsense-ruby/issues/9)) ([60d306b](https://github.com/VAT-Sense/vatsense-ruby/commit/60d306b68b8d6c2b109dec4d434df546620b33e2))
|
|
9
|
+
|
|
3
10
|
## [0.2.0](https://github.com/VAT-Sense/vatsense-ruby/compare/v0.1.2...v0.2.0) (2026-11-05)
|
|
4
11
|
|
|
5
12
|
|
data/README.md
CHANGED
|
@@ -72,6 +72,62 @@ puts response.data.consultation_number
|
|
|
72
72
|
|
|
73
73
|
> **Note:** GB requester numbers only work for GB validations, and EU requester numbers only work for EU validations. Cross-region requests are not supported.
|
|
74
74
|
|
|
75
|
+
If you would rather have an answer than wait for a consultation number when VIES is down, send `consultation_optional: true`. Where a national register can confirm the number, you get the answer with no `consultation_number` instead of the `412`.
|
|
76
|
+
|
|
77
|
+
### Check many numbers at once (batches)
|
|
78
|
+
|
|
79
|
+
A batch checks a list of VAT numbers, as the dashboard's bulk validator does with a file. Batch calls are free and each number checked counts as one request. With a test key the batch is answered from the test numbers and costs nothing.
|
|
80
|
+
|
|
81
|
+
```ruby
|
|
82
|
+
batch = client.batches.create(
|
|
83
|
+
numbers: ["GB288305674", "FR12345678901"],
|
|
84
|
+
reference: "November customers",
|
|
85
|
+
idempotency_key: "november-customers",
|
|
86
|
+
).data
|
|
87
|
+
|
|
88
|
+
# Poll, or take the batch.completed webhook instead.
|
|
89
|
+
status = batch.status
|
|
90
|
+
until %w[complete paused expired].include?(status)
|
|
91
|
+
sleep(10)
|
|
92
|
+
status = client.batches.retrieve(batch.id).data.status
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
after = 0
|
|
96
|
+
loop do
|
|
97
|
+
page = client.batches.results(batch.id, after: after, limit: 1000).data
|
|
98
|
+
page.data.each { |row| puts [row.vat_number, row.result, row.company_name].join(" ") }
|
|
99
|
+
break unless page.has_more
|
|
100
|
+
|
|
101
|
+
after = page.next_after
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
csv = client.batches.results_csv(batch.id)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Send `rows: [{vat_number:, company_name:, postcode:}]` instead of `numbers:` for company matching. A batch can also be paused, continued (`client.batches.continue`), completed and, while a draft, deleted.
|
|
108
|
+
|
|
109
|
+
### Check a webhook's signature
|
|
110
|
+
|
|
111
|
+
Every webhook event carries a `VatSense-Signature` header. Check it against the raw request body with the endpoint's signing secret before trusting the event:
|
|
112
|
+
|
|
113
|
+
```ruby
|
|
114
|
+
begin
|
|
115
|
+
event = Vatsense::Webhook.construct_event(
|
|
116
|
+
request.raw_post,
|
|
117
|
+
request.headers[Vatsense::Webhook::SIGNATURE_HEADER],
|
|
118
|
+
ENV.fetch("VATSENSE_WEBHOOK_SECRET"),
|
|
119
|
+
)
|
|
120
|
+
rescue Vatsense::Webhook::SignatureError
|
|
121
|
+
head(:bad_request) and return
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if event[:type] == "batch.completed"
|
|
125
|
+
# ...
|
|
126
|
+
end
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Events more than 5 minutes old are refused (change it with `tolerance:`). During the 24 hours after a secret is rolled, events signed with either secret are accepted.
|
|
130
|
+
|
|
75
131
|
### Find the VAT rate for a country
|
|
76
132
|
|
|
77
133
|
```ruby
|
|
@@ -189,6 +245,7 @@ response = client.validate.check(
|
|
|
189
245
|
| `client.rates` | VAT/GST rate lookups, price calculations |
|
|
190
246
|
| `client.countries` | Country data and province lookups |
|
|
191
247
|
| `client.currency` | Exchange rates and currency conversion |
|
|
248
|
+
| `client.batches` | Check many VAT numbers in one batch |
|
|
192
249
|
| `client.invoice` | Create and manage VAT-compliant invoices |
|
|
193
250
|
| `client.usage` | Check your API usage |
|
|
194
251
|
|
data/lib/vatsense/client.rb
CHANGED
|
@@ -51,6 +51,10 @@ module Vatsense
|
|
|
51
51
|
# @return [Vatsense::Resources::Sandbox]
|
|
52
52
|
attr_reader :sandbox
|
|
53
53
|
|
|
54
|
+
# Bulk validation: check many VAT numbers in one batch
|
|
55
|
+
# @return [Vatsense::Resources::Batches]
|
|
56
|
+
attr_reader :batches
|
|
57
|
+
|
|
54
58
|
# @api private
|
|
55
59
|
#
|
|
56
60
|
# @param security [Hash{Symbol=>Boolean}]
|
|
@@ -124,6 +128,7 @@ module Vatsense
|
|
|
124
128
|
@invoice = Vatsense::Resources::Invoice.new(client: self)
|
|
125
129
|
@usage = Vatsense::Resources::Usage.new(client: self)
|
|
126
130
|
@sandbox = Vatsense::Resources::Sandbox.new(client: self)
|
|
131
|
+
@batches = Vatsense::Resources::Batches.new(client: self)
|
|
127
132
|
end
|
|
128
133
|
end
|
|
129
134
|
end
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Vatsense
|
|
4
|
+
module Models
|
|
5
|
+
# A batch of VAT numbers checked together.
|
|
6
|
+
class Batch < Vatsense::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute id
|
|
8
|
+
# The batch's 26-character id.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :id, String
|
|
12
|
+
|
|
13
|
+
# @!attribute object
|
|
14
|
+
# Always `batch`.
|
|
15
|
+
#
|
|
16
|
+
# @return [String, nil]
|
|
17
|
+
optional :object, String, nil?: true
|
|
18
|
+
|
|
19
|
+
# @!attribute auto_continue
|
|
20
|
+
#
|
|
21
|
+
# @return [Boolean, nil]
|
|
22
|
+
optional :auto_continue, Vatsense::Internal::Type::Boolean, nil?: true
|
|
23
|
+
|
|
24
|
+
# @!attribute consultation
|
|
25
|
+
#
|
|
26
|
+
# @return [Boolean, nil]
|
|
27
|
+
optional :consultation, Vatsense::Internal::Type::Boolean, nil?: true
|
|
28
|
+
|
|
29
|
+
# @!attribute created_at
|
|
30
|
+
# When the batch was made. Times are UTC, ISO 8601.
|
|
31
|
+
#
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
optional :created_at, String, nil?: true
|
|
34
|
+
|
|
35
|
+
# @!attribute dashboard_url
|
|
36
|
+
# The batch's page in the dashboard; nil for a test batch.
|
|
37
|
+
#
|
|
38
|
+
# @return [String, nil]
|
|
39
|
+
optional :dashboard_url, String, nil?: true
|
|
40
|
+
|
|
41
|
+
# @!attribute estimated_finish_at
|
|
42
|
+
#
|
|
43
|
+
# @return [String, nil]
|
|
44
|
+
optional :estimated_finish_at, String, nil?: true
|
|
45
|
+
|
|
46
|
+
# @!attribute expires_at
|
|
47
|
+
#
|
|
48
|
+
# @return [String, nil]
|
|
49
|
+
optional :expires_at, String, nil?: true
|
|
50
|
+
|
|
51
|
+
# @!attribute finished_at
|
|
52
|
+
#
|
|
53
|
+
# @return [String, nil]
|
|
54
|
+
optional :finished_at, String, nil?: true
|
|
55
|
+
|
|
56
|
+
# @!attribute livemode
|
|
57
|
+
# False for a test batch, made with a test key.
|
|
58
|
+
#
|
|
59
|
+
# @return [Boolean, nil]
|
|
60
|
+
optional :livemode, Vatsense::Internal::Type::Boolean, nil?: true
|
|
61
|
+
|
|
62
|
+
# @!attribute number
|
|
63
|
+
#
|
|
64
|
+
# @return [Integer, nil]
|
|
65
|
+
optional :number, Integer, nil?: true
|
|
66
|
+
|
|
67
|
+
# @!attribute pause_reason
|
|
68
|
+
#
|
|
69
|
+
# @return [String, nil]
|
|
70
|
+
optional :pause_reason, String, nil?: true
|
|
71
|
+
|
|
72
|
+
# @!attribute quote
|
|
73
|
+
# For drafts and paused batches.
|
|
74
|
+
#
|
|
75
|
+
# @return [Vatsense::Models::Batch::Quote, nil]
|
|
76
|
+
optional :quote, -> { Vatsense::Models::Batch::Quote }, nil?: true
|
|
77
|
+
|
|
78
|
+
# @!attribute reference
|
|
79
|
+
#
|
|
80
|
+
# @return [String, nil]
|
|
81
|
+
optional :reference, String, nil?: true
|
|
82
|
+
|
|
83
|
+
# @!attribute requests_used
|
|
84
|
+
#
|
|
85
|
+
# @return [Integer, nil]
|
|
86
|
+
optional :requests_used, Integer, nil?: true
|
|
87
|
+
|
|
88
|
+
# @!attribute results
|
|
89
|
+
#
|
|
90
|
+
# @return [Vatsense::Models::Batch::Results, nil]
|
|
91
|
+
optional :results, -> { Vatsense::Models::Batch::Results }, nil?: true
|
|
92
|
+
|
|
93
|
+
# @!attribute rows
|
|
94
|
+
#
|
|
95
|
+
# @return [Vatsense::Models::Batch::Rows, nil]
|
|
96
|
+
optional :rows, -> { Vatsense::Models::Batch::Rows }, nil?: true
|
|
97
|
+
|
|
98
|
+
# @!attribute source
|
|
99
|
+
#
|
|
100
|
+
# @return [String, nil]
|
|
101
|
+
optional :source, String, nil?: true
|
|
102
|
+
|
|
103
|
+
# @!attribute started_at
|
|
104
|
+
#
|
|
105
|
+
# @return [String, nil]
|
|
106
|
+
optional :started_at, String, nil?: true
|
|
107
|
+
|
|
108
|
+
# @!attribute status
|
|
109
|
+
# `draft`, `queued`, `processing`, `paused`, `complete` or `expired`.
|
|
110
|
+
#
|
|
111
|
+
# @return [String, nil]
|
|
112
|
+
optional :status, String, nil?: true
|
|
113
|
+
|
|
114
|
+
# @!attribute trial
|
|
115
|
+
#
|
|
116
|
+
# @return [Boolean, nil]
|
|
117
|
+
optional :trial, Vatsense::Internal::Type::Boolean, nil?: true
|
|
118
|
+
|
|
119
|
+
# @!attribute uses_overage
|
|
120
|
+
#
|
|
121
|
+
# @return [Boolean, nil]
|
|
122
|
+
optional :uses_overage, Vatsense::Internal::Type::Boolean, nil?: true
|
|
123
|
+
|
|
124
|
+
# @see Vatsense::Models::Batch#rows
|
|
125
|
+
class Rows < Vatsense::Internal::Type::BaseModel
|
|
126
|
+
# @!attribute done
|
|
127
|
+
# Rows checked so far.
|
|
128
|
+
#
|
|
129
|
+
# @return [Integer, nil]
|
|
130
|
+
optional :done, Integer, nil?: true
|
|
131
|
+
|
|
132
|
+
# @!attribute to_check
|
|
133
|
+
# Rows that will be sent for checking.
|
|
134
|
+
#
|
|
135
|
+
# @return [Integer, nil]
|
|
136
|
+
optional :to_check, Integer, nil?: true
|
|
137
|
+
|
|
138
|
+
# @!attribute total
|
|
139
|
+
# Rows in the batch.
|
|
140
|
+
#
|
|
141
|
+
# @return [Integer, nil]
|
|
142
|
+
optional :total, Integer, nil?: true
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# @see Vatsense::Models::Batch#results
|
|
146
|
+
class Results < Vatsense::Internal::Type::BaseModel
|
|
147
|
+
# @!attribute duplicate
|
|
148
|
+
#
|
|
149
|
+
# @return [Integer, nil]
|
|
150
|
+
optional :duplicate, Integer, nil?: true
|
|
151
|
+
|
|
152
|
+
# @!attribute invalid
|
|
153
|
+
#
|
|
154
|
+
# @return [Integer, nil]
|
|
155
|
+
optional :invalid, Integer, nil?: true
|
|
156
|
+
|
|
157
|
+
# @!attribute not_checked
|
|
158
|
+
#
|
|
159
|
+
# @return [Integer, nil]
|
|
160
|
+
optional :not_checked, Integer, nil?: true
|
|
161
|
+
|
|
162
|
+
# @!attribute repaired
|
|
163
|
+
#
|
|
164
|
+
# @return [Integer, nil]
|
|
165
|
+
optional :repaired, Integer, nil?: true
|
|
166
|
+
|
|
167
|
+
# @!attribute retrying
|
|
168
|
+
#
|
|
169
|
+
# @return [Integer, nil]
|
|
170
|
+
optional :retrying, Integer, nil?: true
|
|
171
|
+
|
|
172
|
+
# @!attribute unsupported
|
|
173
|
+
#
|
|
174
|
+
# @return [Integer, nil]
|
|
175
|
+
optional :unsupported, Integer, nil?: true
|
|
176
|
+
|
|
177
|
+
# @!attribute valid
|
|
178
|
+
#
|
|
179
|
+
# @return [Integer, nil]
|
|
180
|
+
optional :valid, Integer, nil?: true
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# @see Vatsense::Models::Batch#quote
|
|
184
|
+
class Quote < Vatsense::Internal::Type::BaseModel
|
|
185
|
+
# @!attribute covered
|
|
186
|
+
# Whether the requests left cover the batch.
|
|
187
|
+
#
|
|
188
|
+
# @return [Boolean, nil]
|
|
189
|
+
optional :covered, Vatsense::Internal::Type::Boolean, nil?: true
|
|
190
|
+
|
|
191
|
+
# @!attribute overage_on
|
|
192
|
+
#
|
|
193
|
+
# @return [Boolean, nil]
|
|
194
|
+
optional :overage_on, Vatsense::Internal::Type::Boolean, nil?: true
|
|
195
|
+
|
|
196
|
+
# @!attribute renews_at
|
|
197
|
+
#
|
|
198
|
+
# @return [String, nil]
|
|
199
|
+
optional :renews_at, String, nil?: true
|
|
200
|
+
|
|
201
|
+
# @!attribute requests_left
|
|
202
|
+
#
|
|
203
|
+
# @return [Integer, nil]
|
|
204
|
+
optional :requests_left, Integer, nil?: true
|
|
205
|
+
|
|
206
|
+
# @!attribute requests_needed
|
|
207
|
+
#
|
|
208
|
+
# @return [Integer, nil]
|
|
209
|
+
optional :requests_needed, Integer, nil?: true
|
|
210
|
+
|
|
211
|
+
# @!attribute shortfall
|
|
212
|
+
#
|
|
213
|
+
# @return [Integer, nil]
|
|
214
|
+
optional :shortfall, Integer, nil?: true
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Vatsense
|
|
4
|
+
module Models
|
|
5
|
+
# @see Vatsense::Resources::Batches
|
|
6
|
+
class BatchDeleteResponse < Vatsense::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute code
|
|
8
|
+
#
|
|
9
|
+
# @return [Integer]
|
|
10
|
+
required :code, Integer
|
|
11
|
+
|
|
12
|
+
# @!attribute data
|
|
13
|
+
#
|
|
14
|
+
# @return [Vatsense::Models::BatchDeleteResponse::Data]
|
|
15
|
+
required :data, -> { Vatsense::Models::BatchDeleteResponse::Data }
|
|
16
|
+
|
|
17
|
+
# @!attribute success
|
|
18
|
+
#
|
|
19
|
+
# @return [Boolean]
|
|
20
|
+
required :success, Vatsense::Internal::Type::Boolean
|
|
21
|
+
|
|
22
|
+
# @see Vatsense::Models::BatchDeleteResponse#data
|
|
23
|
+
class Data < Vatsense::Internal::Type::BaseModel
|
|
24
|
+
# @!attribute id
|
|
25
|
+
#
|
|
26
|
+
# @return [String]
|
|
27
|
+
required :id, String
|
|
28
|
+
|
|
29
|
+
# @!attribute deleted
|
|
30
|
+
#
|
|
31
|
+
# @return [Boolean]
|
|
32
|
+
required :deleted, Vatsense::Internal::Type::Boolean
|
|
33
|
+
|
|
34
|
+
# @!attribute object
|
|
35
|
+
#
|
|
36
|
+
# @return [String, nil]
|
|
37
|
+
optional :object, String, nil?: true
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Vatsense
|
|
4
|
+
module Models
|
|
5
|
+
# @see Vatsense::Resources::Batches
|
|
6
|
+
class BatchListResponse < Vatsense::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute code
|
|
8
|
+
#
|
|
9
|
+
# @return [Integer]
|
|
10
|
+
required :code, Integer
|
|
11
|
+
|
|
12
|
+
# @!attribute data
|
|
13
|
+
#
|
|
14
|
+
# @return [Vatsense::Models::BatchListResponse::Data]
|
|
15
|
+
required :data, -> { Vatsense::Models::BatchListResponse::Data }
|
|
16
|
+
|
|
17
|
+
# @!attribute success
|
|
18
|
+
#
|
|
19
|
+
# @return [Boolean]
|
|
20
|
+
required :success, Vatsense::Internal::Type::Boolean
|
|
21
|
+
|
|
22
|
+
# @see Vatsense::Models::BatchListResponse#data
|
|
23
|
+
class Data < Vatsense::Internal::Type::BaseModel
|
|
24
|
+
# @!attribute data
|
|
25
|
+
#
|
|
26
|
+
# @return [Array<Vatsense::Models::Batch>]
|
|
27
|
+
required :data, -> { Vatsense::Internal::Type::ArrayOf[Vatsense::Models::Batch] }
|
|
28
|
+
|
|
29
|
+
# @!attribute has_more
|
|
30
|
+
#
|
|
31
|
+
# @return [Boolean]
|
|
32
|
+
required :has_more, Vatsense::Internal::Type::Boolean
|
|
33
|
+
|
|
34
|
+
# @!attribute limit
|
|
35
|
+
#
|
|
36
|
+
# @return [Integer, nil]
|
|
37
|
+
optional :limit, Integer, nil?: true
|
|
38
|
+
|
|
39
|
+
# @!attribute page
|
|
40
|
+
#
|
|
41
|
+
# @return [Integer, nil]
|
|
42
|
+
optional :page, Integer, nil?: true
|
|
43
|
+
|
|
44
|
+
# @!attribute total
|
|
45
|
+
#
|
|
46
|
+
# @return [Integer, nil]
|
|
47
|
+
optional :total, Integer, nil?: true
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Vatsense
|
|
4
|
+
module Models
|
|
5
|
+
# @see Vatsense::Resources::Batches
|
|
6
|
+
class BatchResponse < Vatsense::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute code
|
|
8
|
+
#
|
|
9
|
+
# @return [Integer]
|
|
10
|
+
required :code, Integer
|
|
11
|
+
|
|
12
|
+
# @!attribute data
|
|
13
|
+
#
|
|
14
|
+
# @return [Vatsense::Models::Batch]
|
|
15
|
+
required :data, -> { Vatsense::Models::Batch }
|
|
16
|
+
|
|
17
|
+
# @!attribute success
|
|
18
|
+
#
|
|
19
|
+
# @return [Boolean]
|
|
20
|
+
required :success, Vatsense::Internal::Type::Boolean
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Vatsense
|
|
4
|
+
module Models
|
|
5
|
+
# One checked row of a batch, as the CSV report lists it.
|
|
6
|
+
class BatchResult < Vatsense::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute row
|
|
8
|
+
#
|
|
9
|
+
# @return [Integer]
|
|
10
|
+
required :row, Integer
|
|
11
|
+
|
|
12
|
+
# @!attribute authority
|
|
13
|
+
#
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
optional :authority, String, nil?: true
|
|
16
|
+
|
|
17
|
+
# @!attribute checked_at
|
|
18
|
+
#
|
|
19
|
+
# @return [String, nil]
|
|
20
|
+
optional :checked_at, String, nil?: true
|
|
21
|
+
|
|
22
|
+
# @!attribute company_address
|
|
23
|
+
#
|
|
24
|
+
# @return [String, nil]
|
|
25
|
+
optional :company_address, String, nil?: true
|
|
26
|
+
|
|
27
|
+
# @!attribute company_name
|
|
28
|
+
#
|
|
29
|
+
# @return [String, nil]
|
|
30
|
+
optional :company_name, String, nil?: true
|
|
31
|
+
|
|
32
|
+
# @!attribute confirmation_number
|
|
33
|
+
#
|
|
34
|
+
# @return [String, nil]
|
|
35
|
+
optional :confirmation_number, String, nil?: true
|
|
36
|
+
|
|
37
|
+
# @!attribute consultation_number
|
|
38
|
+
#
|
|
39
|
+
# @return [String, nil]
|
|
40
|
+
optional :consultation_number, String, nil?: true
|
|
41
|
+
|
|
42
|
+
# @!attribute country_code
|
|
43
|
+
#
|
|
44
|
+
# @return [String, nil]
|
|
45
|
+
optional :country_code, String, nil?: true
|
|
46
|
+
|
|
47
|
+
# @!attribute country_uploaded
|
|
48
|
+
#
|
|
49
|
+
# @return [String, nil]
|
|
50
|
+
optional :country_uploaded, String, nil?: true
|
|
51
|
+
|
|
52
|
+
# @!attribute duplicate_of_row
|
|
53
|
+
#
|
|
54
|
+
# @return [Integer, nil]
|
|
55
|
+
optional :duplicate_of_row, Integer, nil?: true
|
|
56
|
+
|
|
57
|
+
# @!attribute match
|
|
58
|
+
#
|
|
59
|
+
# @return [Vatsense::Models::BatchResult::Match, nil]
|
|
60
|
+
optional :match, -> { Vatsense::Models::BatchResult::Match }, nil?: true
|
|
61
|
+
|
|
62
|
+
# @!attribute reason
|
|
63
|
+
#
|
|
64
|
+
# @return [String, nil]
|
|
65
|
+
optional :reason, String, nil?: true
|
|
66
|
+
|
|
67
|
+
# @!attribute repaired
|
|
68
|
+
#
|
|
69
|
+
# @return [Boolean, nil]
|
|
70
|
+
optional :repaired, Vatsense::Internal::Type::Boolean, nil?: true
|
|
71
|
+
|
|
72
|
+
# @!attribute result
|
|
73
|
+
# Such as `valid` or `invalid`; `pending` while the row is being checked.
|
|
74
|
+
#
|
|
75
|
+
# @return [String, nil]
|
|
76
|
+
optional :result, String, nil?: true
|
|
77
|
+
|
|
78
|
+
# @!attribute vat_number
|
|
79
|
+
# The number as it was checked.
|
|
80
|
+
#
|
|
81
|
+
# @return [String, nil]
|
|
82
|
+
optional :vat_number, String, nil?: true
|
|
83
|
+
|
|
84
|
+
# @!attribute vat_number_uploaded
|
|
85
|
+
#
|
|
86
|
+
# @return [String, nil]
|
|
87
|
+
optional :vat_number_uploaded, String, nil?: true
|
|
88
|
+
|
|
89
|
+
# @see Vatsense::Models::BatchResult#match
|
|
90
|
+
class Match < Vatsense::Internal::Type::BaseModel
|
|
91
|
+
# @!attribute fields
|
|
92
|
+
#
|
|
93
|
+
# @return [Hash{Symbol=>Vatsense::Models::BatchResult::Match::Field}, nil]
|
|
94
|
+
optional :fields, -> { Vatsense::Internal::Type::HashOf[Vatsense::Models::BatchResult::Match::Field] }, nil?: true
|
|
95
|
+
|
|
96
|
+
# @!attribute result
|
|
97
|
+
# `likely`, `possible`, `unlikely` or `not_applicable`.
|
|
98
|
+
#
|
|
99
|
+
# @return [String, nil]
|
|
100
|
+
optional :result, String, nil?: true
|
|
101
|
+
|
|
102
|
+
# @!attribute score
|
|
103
|
+
#
|
|
104
|
+
# @return [Integer, nil]
|
|
105
|
+
optional :score, Integer, nil?: true
|
|
106
|
+
|
|
107
|
+
# @see Vatsense::Models::BatchResult::Match#fields
|
|
108
|
+
class Field < Vatsense::Internal::Type::BaseModel
|
|
109
|
+
# @!attribute result
|
|
110
|
+
#
|
|
111
|
+
# @return [String, nil]
|
|
112
|
+
optional :result, String, nil?: true
|
|
113
|
+
|
|
114
|
+
# @!attribute score
|
|
115
|
+
#
|
|
116
|
+
# @return [Integer, nil]
|
|
117
|
+
optional :score, Integer, nil?: true
|
|
118
|
+
|
|
119
|
+
# @!attribute sent
|
|
120
|
+
# The detail as it was sent.
|
|
121
|
+
#
|
|
122
|
+
# @return [String, nil]
|
|
123
|
+
optional :sent, String, nil?: true
|
|
124
|
+
|
|
125
|
+
# @!attribute vies
|
|
126
|
+
#
|
|
127
|
+
# @return [String, nil]
|
|
128
|
+
optional :vies, String, nil?: true
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Vatsense
|
|
4
|
+
module Models
|
|
5
|
+
# @see Vatsense::Resources::Batches
|
|
6
|
+
class BatchResultsResponse < Vatsense::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute code
|
|
8
|
+
#
|
|
9
|
+
# @return [Integer]
|
|
10
|
+
required :code, Integer
|
|
11
|
+
|
|
12
|
+
# @!attribute data
|
|
13
|
+
#
|
|
14
|
+
# @return [Vatsense::Models::BatchResultsResponse::Data]
|
|
15
|
+
required :data, -> { Vatsense::Models::BatchResultsResponse::Data }
|
|
16
|
+
|
|
17
|
+
# @!attribute success
|
|
18
|
+
#
|
|
19
|
+
# @return [Boolean]
|
|
20
|
+
required :success, Vatsense::Internal::Type::Boolean
|
|
21
|
+
|
|
22
|
+
# @see Vatsense::Models::BatchResultsResponse#data
|
|
23
|
+
class Data < Vatsense::Internal::Type::BaseModel
|
|
24
|
+
# @!attribute data
|
|
25
|
+
#
|
|
26
|
+
# @return [Array<Vatsense::Models::BatchResult>]
|
|
27
|
+
required :data, -> { Vatsense::Internal::Type::ArrayOf[Vatsense::Models::BatchResult] }
|
|
28
|
+
|
|
29
|
+
# @!attribute has_more
|
|
30
|
+
#
|
|
31
|
+
# @return [Boolean]
|
|
32
|
+
required :has_more, Vatsense::Internal::Type::Boolean
|
|
33
|
+
|
|
34
|
+
# @!attribute next_after
|
|
35
|
+
# Pass as `after:` for the next page while `has_more` is true.
|
|
36
|
+
#
|
|
37
|
+
# @return [Integer, nil]
|
|
38
|
+
optional :next_after, Integer, nil?: true
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -43,6 +43,18 @@ module Vatsense
|
|
|
43
43
|
# @return [String, nil]
|
|
44
44
|
optional :match_postcode, String
|
|
45
45
|
|
|
46
|
+
# @!attribute consultation_optional
|
|
47
|
+
# Send `true` with `requester_vat_number` if you would rather have an answer than
|
|
48
|
+
# wait for a consultation number. When VIES cannot answer for the number's
|
|
49
|
+
# country and that country has a national register fallback, the answer comes
|
|
50
|
+
# from the register with no `consultation_number`, instead of the `412`. If VIES
|
|
51
|
+
# cannot check your own `requester_vat_number`, the number is checked without it,
|
|
52
|
+
# again with no `consultation_number`. Leave it out if you need the consultation
|
|
53
|
+
# number as proof of the check.
|
|
54
|
+
#
|
|
55
|
+
# @return [Boolean, nil]
|
|
56
|
+
optional :consultation_optional, Vatsense::Internal::Type::Boolean
|
|
57
|
+
|
|
46
58
|
# @!attribute match_street
|
|
47
59
|
# The street line you hold, looked for in the registered address.
|
|
48
60
|
#
|
|
@@ -67,7 +79,7 @@ module Vatsense
|
|
|
67
79
|
# @return [String, nil]
|
|
68
80
|
optional :vat_number, String
|
|
69
81
|
|
|
70
|
-
# @!method initialize(eori_number: nil, requester_vat_number: nil, vat_number: nil, match_address: nil, match_city: nil, match_company_name: nil, match_postcode: nil, match_street: nil, request_options: {})
|
|
82
|
+
# @!method initialize(eori_number: nil, requester_vat_number: nil, vat_number: nil, match_address: nil, match_city: nil, match_company_name: nil, match_postcode: nil, match_street: nil, consultation_optional: nil, request_options: {})
|
|
71
83
|
# Some parameter documentations has been truncated, see
|
|
72
84
|
# {Vatsense::Models::ValidateCheckParams} for more details.
|
|
73
85
|
#
|
|
@@ -31,6 +31,13 @@ module Vatsense
|
|
|
31
31
|
# @return [Vatsense::Models::ValidateCheckResponse::Data::Company::ValidationCompany, Vatsense::Models::ValidateCheckResponse::Data::Company::EoriValidationCompany, nil]
|
|
32
32
|
optional :company, union: -> { Vatsense::Models::ValidateCheckResponse::Data::Company }
|
|
33
33
|
|
|
34
|
+
# @!attribute confirmation_number
|
|
35
|
+
# VAT Sense's own reference for this check (beta, only for accounts in the
|
|
36
|
+
# beta). It is not an official number.
|
|
37
|
+
#
|
|
38
|
+
# @return [String, nil]
|
|
39
|
+
optional :confirmation_number, String, nil?: true
|
|
40
|
+
|
|
34
41
|
# @!attribute consultation_number
|
|
35
42
|
# Official consultation number (only returned when requester_vat_number is
|
|
36
43
|
# provided).
|
data/lib/vatsense/models.rb
CHANGED
|
@@ -93,6 +93,10 @@ module Vatsense
|
|
|
93
93
|
|
|
94
94
|
SandboxGenerateKeyParams = Vatsense::Models::SandboxGenerateKeyParams
|
|
95
95
|
|
|
96
|
+
Batch = Vatsense::Models::Batch
|
|
97
|
+
|
|
98
|
+
BatchResult = Vatsense::Models::BatchResult
|
|
99
|
+
|
|
96
100
|
TaxRate = Vatsense::Models::TaxRate
|
|
97
101
|
|
|
98
102
|
UsageRetrieveParams = Vatsense::Models::UsageRetrieveParams
|