taxamo-ns 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/LICENSE +11 -0
- data/README.md +152 -0
- data/Rakefile +7 -0
- data/lib/monkey.rb +90 -0
- data/lib/swagger/configuration.rb +21 -0
- data/lib/swagger/request.rb +199 -0
- data/lib/swagger/response.rb +87 -0
- data/lib/swagger.rb +93 -0
- data/lib/taxamo/models/additionalcurrencies.rb +63 -0
- data/lib/taxamo/models/additionalcurrency.rb +88 -0
- data/lib/taxamo/models/bycountry.rb +78 -0
- data/lib/taxamo/models/bystatus.rb +70 -0
- data/lib/taxamo/models/bytaxationtype.rb +83 -0
- data/lib/taxamo/models/c.rb +78 -0
- data/lib/taxamo/models/calculatesimpletaxout.rb +75 -0
- data/lib/taxamo/models/calculatetaxin.rb +63 -0
- data/lib/taxamo/models/calculatetaxlocationout.rb +98 -0
- data/lib/taxamo/models/calculatetaxout.rb +75 -0
- data/lib/taxamo/models/canceltransactionout.rb +63 -0
- data/lib/taxamo/models/capturepaymentout.rb +63 -0
- data/lib/taxamo/models/confirmtransactionin.rb +63 -0
- data/lib/taxamo/models/confirmtransactionout.rb +75 -0
- data/lib/taxamo/models/countries.rb +113 -0
- data/lib/taxamo/models/country.rb +120 -0
- data/lib/taxamo/models/countryschema.rb +120 -0
- data/lib/taxamo/models/createpaymentin.rb +73 -0
- data/lib/taxamo/models/createpaymentout.rb +63 -0
- data/lib/taxamo/models/createrefundin.rb +83 -0
- data/lib/taxamo/models/createrefundout.rb +78 -0
- data/lib/taxamo/models/createsmstokenin.rb +68 -0
- data/lib/taxamo/models/createsmstokenout.rb +63 -0
- data/lib/taxamo/models/createtransactionin.rb +68 -0
- data/lib/taxamo/models/createtransactionout.rb +75 -0
- data/lib/taxamo/models/currencyschema.rb +83 -0
- data/lib/taxamo/models/customfields.rb +68 -0
- data/lib/taxamo/models/emailinvoicein.rb +63 -0
- data/lib/taxamo/models/emailinvoiceout.rb +63 -0
- data/lib/taxamo/models/emailrefundin.rb +63 -0
- data/lib/taxamo/models/emailrefundout.rb +63 -0
- data/lib/taxamo/models/evidence.rb +113 -0
- data/lib/taxamo/models/evidenceschema.rb +78 -0
- data/lib/taxamo/models/getcountriesdictout.rb +64 -0
- data/lib/taxamo/models/getcurrenciesdictout.rb +64 -0
- data/lib/taxamo/models/getdailysettlementstatsout.rb +64 -0
- data/lib/taxamo/models/getdetailedrefundsout.rb +64 -0
- data/lib/taxamo/models/getdomesticsummaryreportout.rb +123 -0
- data/lib/taxamo/models/geteuviesreportout.rb +79 -0
- data/lib/taxamo/models/getproducttypesdictout.rb +64 -0
- data/lib/taxamo/models/getrefundsout.rb +64 -0
- data/lib/taxamo/models/getsettlementout.rb +84 -0
- data/lib/taxamo/models/getsettlementstatsbycountryout.rb +64 -0
- data/lib/taxamo/models/getsettlementstatsbytaxationtypeout.rb +63 -0
- data/lib/taxamo/models/getsettlementsummaryout.rb +63 -0
- data/lib/taxamo/models/gettransactionout.rb +75 -0
- data/lib/taxamo/models/gettransactionsstatsbycountryout.rb +64 -0
- data/lib/taxamo/models/gettransactionsstatsout.rb +63 -0
- data/lib/taxamo/models/inputtransaction.rb +220 -0
- data/lib/taxamo/models/inputtransactionline.rb +144 -0
- data/lib/taxamo/models/inputtransactionupdate.rb +220 -0
- data/lib/taxamo/models/invoiceaddress.rb +98 -0
- data/lib/taxamo/models/listpaymentsout.rb +64 -0
- data/lib/taxamo/models/listrefundsout.rb +64 -0
- data/lib/taxamo/models/listtransactionsout.rb +64 -0
- data/lib/taxamo/models/locategivenipout.rb +73 -0
- data/lib/taxamo/models/locatemyipout.rb +73 -0
- data/lib/taxamo/models/n.rb +78 -0
- data/lib/taxamo/models/payments.rb +73 -0
- data/lib/taxamo/models/producttypeschema.rb +63 -0
- data/lib/taxamo/models/refunds.rb +108 -0
- data/lib/taxamo/models/report.rb +103 -0
- data/lib/taxamo/models/settlementdailystatsschema.rb +103 -0
- data/lib/taxamo/models/storagerequiredfields.rb +63 -0
- data/lib/taxamo/models/summary.rb +98 -0
- data/lib/taxamo/models/taxdataschema.rb +63 -0
- data/lib/taxamo/models/taxrequiredfields.rb +63 -0
- data/lib/taxamo/models/transaction.rb +330 -0
- data/lib/taxamo/models/transactionlines.rb +174 -0
- data/lib/taxamo/models/transactions.rb +330 -0
- data/lib/taxamo/models/unconfirmtransactionin.rb +63 -0
- data/lib/taxamo/models/unconfirmtransactionout.rb +75 -0
- data/lib/taxamo/models/updatetransactionin.rb +63 -0
- data/lib/taxamo/models/updatetransactionout.rb +75 -0
- data/lib/taxamo/models/ustaxexemptioncertificatedetailsschema.rb +139 -0
- data/lib/taxamo/models/ustaxexemptioncertificateschema.rb +68 -0
- data/lib/taxamo/models/ustaxexemptstate.rb +73 -0
- data/lib/taxamo/models/ustaxid.rb +73 -0
- data/lib/taxamo/models/validatetaxnumberout.rb +78 -0
- data/lib/taxamo/models/verifysmstokenout.rb +63 -0
- data/lib/taxamo/version.rb +17 -0
- data/lib/taxamo.rb +1215 -0
- data/taxamo.gemspec +28 -0
- data/test/taxamo/connectivity_test.rb +55 -0
- data/test/taxamo/tax_test.rb +152 -0
- data/test/taxamo/transactions_api_test.rb +326 -0
- metadata +241 -0
data/lib/taxamo.rb
ADDED
@@ -0,0 +1,1215 @@
|
|
1
|
+
# Copyright 2014-2015 Taxamo, Ltd.
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
require "uri"
|
14
|
+
require "swagger"
|
15
|
+
require "taxamo/version"
|
16
|
+
require "require_all"
|
17
|
+
require_rel "taxamo/models/*"
|
18
|
+
|
19
|
+
module Taxamo
|
20
|
+
class <<self
|
21
|
+
def escapeString(string)
|
22
|
+
URI.encode(string.to_s)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_refund (key,body,opts={})
|
26
|
+
query_param_keys = []
|
27
|
+
|
28
|
+
# verify existence of params
|
29
|
+
raise "key is required" if key.nil?
|
30
|
+
raise "body is required" if body.nil?
|
31
|
+
# set default values and merge with input
|
32
|
+
options = {
|
33
|
+
:key => key,
|
34
|
+
:body => body}.merge(opts)
|
35
|
+
|
36
|
+
#resource path
|
37
|
+
path = "/api/v1/transactions/{key}/refunds".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
38
|
+
|
39
|
+
|
40
|
+
# pull querystring keys from options
|
41
|
+
queryopts = options.select do |key,value|
|
42
|
+
query_param_keys.include? key
|
43
|
+
end
|
44
|
+
|
45
|
+
headers = nil
|
46
|
+
post_body = nil
|
47
|
+
if body != nil
|
48
|
+
if body.is_a?(Array)
|
49
|
+
array = Array.new
|
50
|
+
body.each do |item|
|
51
|
+
if item.respond_to?("to_body".to_sym)
|
52
|
+
array.push item.to_body
|
53
|
+
else
|
54
|
+
array.push item
|
55
|
+
end
|
56
|
+
end
|
57
|
+
post_body = array
|
58
|
+
|
59
|
+
else
|
60
|
+
if body.respond_to?("to_body".to_sym)
|
61
|
+
post_body = body.to_body
|
62
|
+
else
|
63
|
+
post_body = body
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
68
|
+
CreateRefundOut.new(response)
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
def list_refunds (key,opts={})
|
73
|
+
query_param_keys = []
|
74
|
+
|
75
|
+
# verify existence of params
|
76
|
+
raise "key is required" if key.nil?
|
77
|
+
# set default values and merge with input
|
78
|
+
options = {
|
79
|
+
:key => key}.merge(opts)
|
80
|
+
|
81
|
+
#resource path
|
82
|
+
path = "/api/v1/transactions/{key}/refunds".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
83
|
+
|
84
|
+
|
85
|
+
# pull querystring keys from options
|
86
|
+
queryopts = options.select do |key,value|
|
87
|
+
query_param_keys.include? key
|
88
|
+
end
|
89
|
+
|
90
|
+
headers = nil
|
91
|
+
post_body = nil
|
92
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
93
|
+
ListRefundsOut.new(response)
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
def create_payment (key,body,opts={})
|
98
|
+
query_param_keys = []
|
99
|
+
|
100
|
+
# verify existence of params
|
101
|
+
raise "key is required" if key.nil?
|
102
|
+
raise "body is required" if body.nil?
|
103
|
+
# set default values and merge with input
|
104
|
+
options = {
|
105
|
+
:key => key,
|
106
|
+
:body => body}.merge(opts)
|
107
|
+
|
108
|
+
#resource path
|
109
|
+
path = "/api/v1/transactions/{key}/payments".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
110
|
+
|
111
|
+
|
112
|
+
# pull querystring keys from options
|
113
|
+
queryopts = options.select do |key,value|
|
114
|
+
query_param_keys.include? key
|
115
|
+
end
|
116
|
+
|
117
|
+
headers = nil
|
118
|
+
post_body = nil
|
119
|
+
if body != nil
|
120
|
+
if body.is_a?(Array)
|
121
|
+
array = Array.new
|
122
|
+
body.each do |item|
|
123
|
+
if item.respond_to?("to_body".to_sym)
|
124
|
+
array.push item.to_body
|
125
|
+
else
|
126
|
+
array.push item
|
127
|
+
end
|
128
|
+
end
|
129
|
+
post_body = array
|
130
|
+
|
131
|
+
else
|
132
|
+
if body.respond_to?("to_body".to_sym)
|
133
|
+
post_body = body.to_body
|
134
|
+
else
|
135
|
+
post_body = body
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
140
|
+
CreatePaymentOut.new(response)
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
def list_payments (limit,offset,key,opts={})
|
145
|
+
query_param_keys = [:limit,:offset]
|
146
|
+
|
147
|
+
# verify existence of params
|
148
|
+
raise "key is required" if key.nil?
|
149
|
+
# set default values and merge with input
|
150
|
+
options = {
|
151
|
+
:limit => limit,
|
152
|
+
:offset => offset,
|
153
|
+
:key => key}.merge(opts)
|
154
|
+
|
155
|
+
#resource path
|
156
|
+
path = "/api/v1/transactions/{key}/payments".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
157
|
+
|
158
|
+
|
159
|
+
# pull querystring keys from options
|
160
|
+
queryopts = options.select do |key,value|
|
161
|
+
query_param_keys.include? key
|
162
|
+
end
|
163
|
+
|
164
|
+
headers = nil
|
165
|
+
post_body = nil
|
166
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
167
|
+
ListPaymentsOut.new(response)
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
def capture_payment (key,opts={})
|
172
|
+
query_param_keys = []
|
173
|
+
|
174
|
+
# verify existence of params
|
175
|
+
raise "key is required" if key.nil?
|
176
|
+
# set default values and merge with input
|
177
|
+
options = {
|
178
|
+
:key => key}.merge(opts)
|
179
|
+
|
180
|
+
#resource path
|
181
|
+
path = "/api/v1/transactions/{key}/payments/capture".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
182
|
+
|
183
|
+
|
184
|
+
# pull querystring keys from options
|
185
|
+
queryopts = options.select do |key,value|
|
186
|
+
query_param_keys.include? key
|
187
|
+
end
|
188
|
+
|
189
|
+
headers = nil
|
190
|
+
post_body = nil
|
191
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
192
|
+
CapturePaymentOut.new(response)
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
def email_invoice (key,body,opts={})
|
197
|
+
query_param_keys = []
|
198
|
+
|
199
|
+
# verify existence of params
|
200
|
+
raise "key is required" if key.nil?
|
201
|
+
raise "body is required" if body.nil?
|
202
|
+
# set default values and merge with input
|
203
|
+
options = {
|
204
|
+
:key => key,
|
205
|
+
:body => body}.merge(opts)
|
206
|
+
|
207
|
+
#resource path
|
208
|
+
path = "/api/v1/transactions/{key}/invoice/send_email".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
209
|
+
|
210
|
+
|
211
|
+
# pull querystring keys from options
|
212
|
+
queryopts = options.select do |key,value|
|
213
|
+
query_param_keys.include? key
|
214
|
+
end
|
215
|
+
|
216
|
+
headers = nil
|
217
|
+
post_body = nil
|
218
|
+
if body != nil
|
219
|
+
if body.is_a?(Array)
|
220
|
+
array = Array.new
|
221
|
+
body.each do |item|
|
222
|
+
if item.respond_to?("to_body".to_sym)
|
223
|
+
array.push item.to_body
|
224
|
+
else
|
225
|
+
array.push item
|
226
|
+
end
|
227
|
+
end
|
228
|
+
post_body = array
|
229
|
+
|
230
|
+
else
|
231
|
+
if body.respond_to?("to_body".to_sym)
|
232
|
+
post_body = body.to_body
|
233
|
+
else
|
234
|
+
post_body = body
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
239
|
+
EmailInvoiceOut.new(response)
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
def email_refund (key,refund_note_number,body,opts={})
|
244
|
+
query_param_keys = []
|
245
|
+
|
246
|
+
# verify existence of params
|
247
|
+
raise "key is required" if key.nil?
|
248
|
+
raise "refund_note_number is required" if refund_note_number.nil?
|
249
|
+
raise "body is required" if body.nil?
|
250
|
+
# set default values and merge with input
|
251
|
+
options = {
|
252
|
+
:key => key,
|
253
|
+
:refund_note_number => refund_note_number,
|
254
|
+
:body => body}.merge(opts)
|
255
|
+
|
256
|
+
#resource path
|
257
|
+
path = "/api/v1/transactions/{key}/invoice/refunds/{refund_note_number}/send_email".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key)).sub('{' + 'refund_note_number' + '}', escapeString(refund_note_number))
|
258
|
+
|
259
|
+
|
260
|
+
# pull querystring keys from options
|
261
|
+
queryopts = options.select do |key,value|
|
262
|
+
query_param_keys.include? key
|
263
|
+
end
|
264
|
+
|
265
|
+
headers = nil
|
266
|
+
post_body = nil
|
267
|
+
if body != nil
|
268
|
+
if body.is_a?(Array)
|
269
|
+
array = Array.new
|
270
|
+
body.each do |item|
|
271
|
+
if item.respond_to?("to_body".to_sym)
|
272
|
+
array.push item.to_body
|
273
|
+
else
|
274
|
+
array.push item
|
275
|
+
end
|
276
|
+
end
|
277
|
+
post_body = array
|
278
|
+
|
279
|
+
else
|
280
|
+
if body.respond_to?("to_body".to_sym)
|
281
|
+
post_body = body.to_body
|
282
|
+
else
|
283
|
+
post_body = body
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
288
|
+
EmailRefundOut.new(response)
|
289
|
+
|
290
|
+
end
|
291
|
+
|
292
|
+
def create_transaction (body,opts={})
|
293
|
+
query_param_keys = []
|
294
|
+
|
295
|
+
# verify existence of params
|
296
|
+
raise "body is required" if body.nil?
|
297
|
+
# set default values and merge with input
|
298
|
+
options = {
|
299
|
+
:body => body}.merge(opts)
|
300
|
+
|
301
|
+
#resource path
|
302
|
+
path = "/api/v1/transactions".sub('{format}','json')
|
303
|
+
|
304
|
+
|
305
|
+
# pull querystring keys from options
|
306
|
+
queryopts = options.select do |key,value|
|
307
|
+
query_param_keys.include? key
|
308
|
+
end
|
309
|
+
|
310
|
+
headers = nil
|
311
|
+
post_body = nil
|
312
|
+
if body != nil
|
313
|
+
if body.is_a?(Array)
|
314
|
+
array = Array.new
|
315
|
+
body.each do |item|
|
316
|
+
if item.respond_to?("to_body".to_sym)
|
317
|
+
array.push item.to_body
|
318
|
+
else
|
319
|
+
array.push item
|
320
|
+
end
|
321
|
+
end
|
322
|
+
post_body = array
|
323
|
+
|
324
|
+
else
|
325
|
+
if body.respond_to?("to_body".to_sym)
|
326
|
+
post_body = body.to_body
|
327
|
+
else
|
328
|
+
post_body = body
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
333
|
+
CreateTransactionOut.new(response)
|
334
|
+
|
335
|
+
end
|
336
|
+
|
337
|
+
def get_transaction (key,opts={})
|
338
|
+
query_param_keys = []
|
339
|
+
|
340
|
+
# verify existence of params
|
341
|
+
raise "key is required" if key.nil?
|
342
|
+
# set default values and merge with input
|
343
|
+
options = {
|
344
|
+
:key => key}.merge(opts)
|
345
|
+
|
346
|
+
#resource path
|
347
|
+
path = "/api/v1/transactions/{key}".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
348
|
+
|
349
|
+
|
350
|
+
# pull querystring keys from options
|
351
|
+
queryopts = options.select do |key,value|
|
352
|
+
query_param_keys.include? key
|
353
|
+
end
|
354
|
+
|
355
|
+
headers = nil
|
356
|
+
post_body = nil
|
357
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
358
|
+
GetTransactionOut.new(response)
|
359
|
+
|
360
|
+
end
|
361
|
+
|
362
|
+
def update_transaction (key,body,opts={})
|
363
|
+
query_param_keys = []
|
364
|
+
|
365
|
+
# verify existence of params
|
366
|
+
raise "key is required" if key.nil?
|
367
|
+
raise "body is required" if body.nil?
|
368
|
+
# set default values and merge with input
|
369
|
+
options = {
|
370
|
+
:key => key,
|
371
|
+
:body => body}.merge(opts)
|
372
|
+
|
373
|
+
#resource path
|
374
|
+
path = "/api/v1/transactions/{key}".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
375
|
+
|
376
|
+
|
377
|
+
# pull querystring keys from options
|
378
|
+
queryopts = options.select do |key,value|
|
379
|
+
query_param_keys.include? key
|
380
|
+
end
|
381
|
+
|
382
|
+
headers = nil
|
383
|
+
post_body = nil
|
384
|
+
if body != nil
|
385
|
+
if body.is_a?(Array)
|
386
|
+
array = Array.new
|
387
|
+
body.each do |item|
|
388
|
+
if item.respond_to?("to_body".to_sym)
|
389
|
+
array.push item.to_body
|
390
|
+
else
|
391
|
+
array.push item
|
392
|
+
end
|
393
|
+
end
|
394
|
+
post_body = array
|
395
|
+
|
396
|
+
else
|
397
|
+
if body.respond_to?("to_body".to_sym)
|
398
|
+
post_body = body.to_body
|
399
|
+
else
|
400
|
+
post_body = body
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
response = Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
405
|
+
UpdateTransactionOut.new(response)
|
406
|
+
|
407
|
+
end
|
408
|
+
|
409
|
+
def confirm_transaction (key,body,opts={})
|
410
|
+
query_param_keys = []
|
411
|
+
|
412
|
+
# verify existence of params
|
413
|
+
raise "key is required" if key.nil?
|
414
|
+
raise "body is required" if body.nil?
|
415
|
+
# set default values and merge with input
|
416
|
+
options = {
|
417
|
+
:key => key,
|
418
|
+
:body => body}.merge(opts)
|
419
|
+
|
420
|
+
#resource path
|
421
|
+
path = "/api/v1/transactions/{key}/confirm".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
422
|
+
|
423
|
+
|
424
|
+
# pull querystring keys from options
|
425
|
+
queryopts = options.select do |key,value|
|
426
|
+
query_param_keys.include? key
|
427
|
+
end
|
428
|
+
|
429
|
+
headers = nil
|
430
|
+
post_body = nil
|
431
|
+
if body != nil
|
432
|
+
if body.is_a?(Array)
|
433
|
+
array = Array.new
|
434
|
+
body.each do |item|
|
435
|
+
if item.respond_to?("to_body".to_sym)
|
436
|
+
array.push item.to_body
|
437
|
+
else
|
438
|
+
array.push item
|
439
|
+
end
|
440
|
+
end
|
441
|
+
post_body = array
|
442
|
+
|
443
|
+
else
|
444
|
+
if body.respond_to?("to_body".to_sym)
|
445
|
+
post_body = body.to_body
|
446
|
+
else
|
447
|
+
post_body = body
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
452
|
+
ConfirmTransactionOut.new(response)
|
453
|
+
|
454
|
+
end
|
455
|
+
|
456
|
+
def cancel_transaction (key,opts={})
|
457
|
+
query_param_keys = []
|
458
|
+
|
459
|
+
# verify existence of params
|
460
|
+
raise "key is required" if key.nil?
|
461
|
+
# set default values and merge with input
|
462
|
+
options = {
|
463
|
+
:key => key}.merge(opts)
|
464
|
+
|
465
|
+
#resource path
|
466
|
+
path = "/api/v1/transactions/{key}".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
467
|
+
|
468
|
+
|
469
|
+
# pull querystring keys from options
|
470
|
+
queryopts = options.select do |key,value|
|
471
|
+
query_param_keys.include? key
|
472
|
+
end
|
473
|
+
|
474
|
+
headers = nil
|
475
|
+
post_body = nil
|
476
|
+
response = Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
477
|
+
CancelTransactionOut.new(response)
|
478
|
+
|
479
|
+
end
|
480
|
+
|
481
|
+
def unconfirm_transaction (key,body,opts={})
|
482
|
+
query_param_keys = []
|
483
|
+
|
484
|
+
# verify existence of params
|
485
|
+
raise "key is required" if key.nil?
|
486
|
+
raise "body is required" if body.nil?
|
487
|
+
# set default values and merge with input
|
488
|
+
options = {
|
489
|
+
:key => key,
|
490
|
+
:body => body}.merge(opts)
|
491
|
+
|
492
|
+
#resource path
|
493
|
+
path = "/api/v1/transactions/{key}/unconfirm".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
494
|
+
|
495
|
+
|
496
|
+
# pull querystring keys from options
|
497
|
+
queryopts = options.select do |key,value|
|
498
|
+
query_param_keys.include? key
|
499
|
+
end
|
500
|
+
|
501
|
+
headers = nil
|
502
|
+
post_body = nil
|
503
|
+
if body != nil
|
504
|
+
if body.is_a?(Array)
|
505
|
+
array = Array.new
|
506
|
+
body.each do |item|
|
507
|
+
if item.respond_to?("to_body".to_sym)
|
508
|
+
array.push item.to_body
|
509
|
+
else
|
510
|
+
array.push item
|
511
|
+
end
|
512
|
+
end
|
513
|
+
post_body = array
|
514
|
+
|
515
|
+
else
|
516
|
+
if body.respond_to?("to_body".to_sym)
|
517
|
+
post_body = body.to_body
|
518
|
+
else
|
519
|
+
post_body = body
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
524
|
+
UnconfirmTransactionOut.new(response)
|
525
|
+
|
526
|
+
end
|
527
|
+
|
528
|
+
def list_transactions (filter_text,offset,key_or_custom_id,currency_code,order_date_to,sort_reverse,limit,invoice_number,statuses,order_date_from,total_amount_greater_than,format,total_amount_less_than,tax_country_code,original_transaction_key,has_note,tax_country_codes, opts={})
|
529
|
+
query_param_keys = [:filter_text,:offset,:key_or_custom_id,:currency_code,:order_date_to,:sort_reverse,:limit,:invoice_number,:statuses,:original_transaction_key,:order_date_from,:total_amount_greater_than,:format,:total_amount_less_than,:tax_country_code,:has_note, :tax_country_codes]
|
530
|
+
|
531
|
+
# set default values and merge with input
|
532
|
+
options = {
|
533
|
+
:filter_text => filter_text,
|
534
|
+
:offset => offset,
|
535
|
+
:has_note => has_note,
|
536
|
+
:key_or_custom_id => key_or_custom_id,
|
537
|
+
:currency_code => currency_code,
|
538
|
+
:order_date_to => order_date_to,
|
539
|
+
:sort_reverse => sort_reverse,
|
540
|
+
:limit => limit,
|
541
|
+
:invoice_number => invoice_number,
|
542
|
+
:tax_country_codes => tax_country_codes,
|
543
|
+
:statuses => statuses,
|
544
|
+
:original_transaction_key => original_transaction_key,
|
545
|
+
:order_date_from => order_date_from,
|
546
|
+
:total_amount_greater_than => total_amount_greater_than,
|
547
|
+
:format => format,
|
548
|
+
:total_amount_less_than => total_amount_less_than,
|
549
|
+
:tax_country_code => tax_country_code}.merge(opts)
|
550
|
+
|
551
|
+
#resource path
|
552
|
+
path = "/api/v1/transactions".sub('{format}','json')
|
553
|
+
|
554
|
+
|
555
|
+
# pull querystring keys from options
|
556
|
+
queryopts = options.select do |key,value|
|
557
|
+
query_param_keys.include? key
|
558
|
+
end
|
559
|
+
|
560
|
+
headers = nil
|
561
|
+
post_body = nil
|
562
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
563
|
+
ListTransactionsOut.new(response)
|
564
|
+
|
565
|
+
end
|
566
|
+
|
567
|
+
def calculate_tax (body,opts={})
|
568
|
+
query_param_keys = []
|
569
|
+
|
570
|
+
# verify existence of params
|
571
|
+
raise "body is required" if body.nil?
|
572
|
+
# set default values and merge with input
|
573
|
+
options = {
|
574
|
+
:body => body}.merge(opts)
|
575
|
+
|
576
|
+
#resource path
|
577
|
+
path = "/api/v1/tax/calculate".sub('{format}','json')
|
578
|
+
|
579
|
+
|
580
|
+
# pull querystring keys from options
|
581
|
+
queryopts = options.select do |key,value|
|
582
|
+
query_param_keys.include? key
|
583
|
+
end
|
584
|
+
|
585
|
+
headers = nil
|
586
|
+
post_body = nil
|
587
|
+
if body != nil
|
588
|
+
if body.is_a?(Array)
|
589
|
+
array = Array.new
|
590
|
+
body.each do |item|
|
591
|
+
if item.respond_to?("to_body".to_sym)
|
592
|
+
array.push item.to_body
|
593
|
+
else
|
594
|
+
array.push item
|
595
|
+
end
|
596
|
+
end
|
597
|
+
post_body = array
|
598
|
+
|
599
|
+
else
|
600
|
+
if body.respond_to?("to_body".to_sym)
|
601
|
+
post_body = body.to_body
|
602
|
+
else
|
603
|
+
post_body = body
|
604
|
+
end
|
605
|
+
end
|
606
|
+
end
|
607
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
608
|
+
CalculateTaxOut.new(response)
|
609
|
+
|
610
|
+
end
|
611
|
+
|
612
|
+
def calculate_simple_tax (product_type,invoice_address_city,buyer_credit_card_prefix,currency_code,invoice_address_region,unit_price,quantity,buyer_tax_number,force_country_code,order_date,amount,billing_country_code,invoice_address_postal_code,total_amount,tax_deducted,opts={})
|
613
|
+
query_param_keys = [:product_type,:invoice_address_city,:buyer_credit_card_prefix,:currency_code,:invoice_address_region,:unit_price,:quantity,:buyer_tax_number,:force_country_code,:order_date,:amount,:billing_country_code,:invoice_address_postal_code,:total_amount,:tax_deducted]
|
614
|
+
|
615
|
+
# verify existence of params
|
616
|
+
raise "currency_code is required" if currency_code.nil?
|
617
|
+
# set default values and merge with input
|
618
|
+
options = {
|
619
|
+
:product_type => product_type,
|
620
|
+
:invoice_address_city => invoice_address_city,
|
621
|
+
:buyer_credit_card_prefix => buyer_credit_card_prefix,
|
622
|
+
:currency_code => currency_code,
|
623
|
+
:invoice_address_region => invoice_address_region,
|
624
|
+
:unit_price => unit_price,
|
625
|
+
:quantity => quantity,
|
626
|
+
:buyer_tax_number => buyer_tax_number,
|
627
|
+
:force_country_code => force_country_code,
|
628
|
+
:order_date => order_date,
|
629
|
+
:amount => amount,
|
630
|
+
:billing_country_code => billing_country_code,
|
631
|
+
:invoice_address_postal_code => invoice_address_postal_code,
|
632
|
+
:total_amount => total_amount,
|
633
|
+
:tax_deducted => tax_deducted}.merge(opts)
|
634
|
+
|
635
|
+
#resource path
|
636
|
+
path = "/api/v1/tax/calculate".sub('{format}','json')
|
637
|
+
|
638
|
+
|
639
|
+
# pull querystring keys from options
|
640
|
+
queryopts = options.select do |key,value|
|
641
|
+
query_param_keys.include? key
|
642
|
+
end
|
643
|
+
|
644
|
+
headers = nil
|
645
|
+
post_body = nil
|
646
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
647
|
+
CalculateSimpleTaxOut.new(response)
|
648
|
+
|
649
|
+
end
|
650
|
+
|
651
|
+
def validate_tax_number (country_code,tax_number,opts={})
|
652
|
+
query_param_keys = [:country_code]
|
653
|
+
|
654
|
+
# verify existence of params
|
655
|
+
raise "tax_number is required" if tax_number.nil?
|
656
|
+
# set default values and merge with input
|
657
|
+
options = {
|
658
|
+
:country_code => country_code,
|
659
|
+
:tax_number => tax_number}.merge(opts)
|
660
|
+
|
661
|
+
#resource path
|
662
|
+
path = "/api/v1/tax/vat_numbers/{tax_number}/validate".sub('{format}','json').sub('{' + 'tax_number' + '}', escapeString(tax_number))
|
663
|
+
|
664
|
+
|
665
|
+
# pull querystring keys from options
|
666
|
+
queryopts = options.select do |key,value|
|
667
|
+
query_param_keys.include? key
|
668
|
+
end
|
669
|
+
|
670
|
+
headers = nil
|
671
|
+
post_body = nil
|
672
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
673
|
+
ValidateTaxNumberOut.new(response)
|
674
|
+
|
675
|
+
end
|
676
|
+
|
677
|
+
def calculate_tax_location (billing_country_code,buyer_credit_card_prefix,opts={})
|
678
|
+
query_param_keys = [:billing_country_code,:buyer_credit_card_prefix]
|
679
|
+
|
680
|
+
# set default values and merge with input
|
681
|
+
options = {
|
682
|
+
:billing_country_code => billing_country_code,
|
683
|
+
:buyer_credit_card_prefix => buyer_credit_card_prefix}.merge(opts)
|
684
|
+
|
685
|
+
#resource path
|
686
|
+
path = "/api/v1/tax/location/calculate".sub('{format}','json')
|
687
|
+
|
688
|
+
|
689
|
+
# pull querystring keys from options
|
690
|
+
queryopts = options.select do |key,value|
|
691
|
+
query_param_keys.include? key
|
692
|
+
end
|
693
|
+
|
694
|
+
headers = nil
|
695
|
+
post_body = nil
|
696
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
697
|
+
CalculateTaxLocationOut.new(response)
|
698
|
+
|
699
|
+
end
|
700
|
+
|
701
|
+
def locate_my_i_p (opts={})
|
702
|
+
query_param_keys = []
|
703
|
+
|
704
|
+
# set default values and merge with input
|
705
|
+
options = {
|
706
|
+
}.merge(opts)
|
707
|
+
|
708
|
+
#resource path
|
709
|
+
path = "/api/v1/geoip".sub('{format}','json')
|
710
|
+
|
711
|
+
|
712
|
+
# pull querystring keys from options
|
713
|
+
queryopts = options.select do |key,value|
|
714
|
+
query_param_keys.include? key
|
715
|
+
end
|
716
|
+
|
717
|
+
headers = nil
|
718
|
+
post_body = nil
|
719
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
720
|
+
LocateMyIPOut.new(response)
|
721
|
+
|
722
|
+
end
|
723
|
+
|
724
|
+
def locate_given_i_p (ip,opts={})
|
725
|
+
query_param_keys = []
|
726
|
+
|
727
|
+
# verify existence of params
|
728
|
+
raise "ip is required" if ip.nil?
|
729
|
+
# set default values and merge with input
|
730
|
+
options = {
|
731
|
+
:ip => ip}.merge(opts)
|
732
|
+
|
733
|
+
#resource path
|
734
|
+
path = "/api/v1/geoip/{ip}".sub('{format}','json').sub('{' + 'ip' + '}', escapeString(ip))
|
735
|
+
|
736
|
+
|
737
|
+
# pull querystring keys from options
|
738
|
+
queryopts = options.select do |key,value|
|
739
|
+
query_param_keys.include? key
|
740
|
+
end
|
741
|
+
|
742
|
+
headers = nil
|
743
|
+
post_body = nil
|
744
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
745
|
+
LocateGivenIPOut.new(response)
|
746
|
+
|
747
|
+
end
|
748
|
+
|
749
|
+
def get_transactions_stats_by_country (global_currency_code,date_from,date_to,opts={})
|
750
|
+
query_param_keys = [:global_currency_code,:date_from,:date_to]
|
751
|
+
|
752
|
+
# verify existence of params
|
753
|
+
raise "date_from is required" if date_from.nil?
|
754
|
+
raise "date_to is required" if date_to.nil?
|
755
|
+
# set default values and merge with input
|
756
|
+
options = {
|
757
|
+
:global_currency_code => global_currency_code,
|
758
|
+
:date_from => date_from,
|
759
|
+
:date_to => date_to}.merge(opts)
|
760
|
+
|
761
|
+
#resource path
|
762
|
+
path = "/api/v1/stats/transactions/by_country".sub('{format}','json')
|
763
|
+
|
764
|
+
|
765
|
+
# pull querystring keys from options
|
766
|
+
queryopts = options.select do |key,value|
|
767
|
+
query_param_keys.include? key
|
768
|
+
end
|
769
|
+
|
770
|
+
headers = nil
|
771
|
+
post_body = nil
|
772
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
773
|
+
GetTransactionsStatsByCountryOut.new(response)
|
774
|
+
|
775
|
+
end
|
776
|
+
|
777
|
+
def get_transactions_stats (date_from,date_to,interval,opts={})
|
778
|
+
query_param_keys = [:date_from,:date_to,:interval]
|
779
|
+
|
780
|
+
# verify existence of params
|
781
|
+
raise "date_from is required" if date_from.nil?
|
782
|
+
raise "date_to is required" if date_to.nil?
|
783
|
+
# set default values and merge with input
|
784
|
+
options = {
|
785
|
+
:date_from => date_from,
|
786
|
+
:date_to => date_to,
|
787
|
+
:interval => interval}.merge(opts)
|
788
|
+
|
789
|
+
#resource path
|
790
|
+
path = "/api/v1/stats/transactions".sub('{format}','json')
|
791
|
+
|
792
|
+
|
793
|
+
# pull querystring keys from options
|
794
|
+
queryopts = options.select do |key,value|
|
795
|
+
query_param_keys.include? key
|
796
|
+
end
|
797
|
+
|
798
|
+
headers = nil
|
799
|
+
post_body = nil
|
800
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
801
|
+
GetTransactionsStatsOut.new(response)
|
802
|
+
|
803
|
+
end
|
804
|
+
|
805
|
+
def get_settlement_stats_by_country (date_from,date_to,opts={})
|
806
|
+
query_param_keys = [:date_from,:date_to]
|
807
|
+
|
808
|
+
# verify existence of params
|
809
|
+
raise "date_from is required" if date_from.nil?
|
810
|
+
raise "date_to is required" if date_to.nil?
|
811
|
+
# set default values and merge with input
|
812
|
+
options = {
|
813
|
+
:date_from => date_from,
|
814
|
+
:date_to => date_to}.merge(opts)
|
815
|
+
|
816
|
+
#resource path
|
817
|
+
path = "/api/v1/stats/settlement/by_country".sub('{format}','json')
|
818
|
+
|
819
|
+
|
820
|
+
# pull querystring keys from options
|
821
|
+
queryopts = options.select do |key,value|
|
822
|
+
query_param_keys.include? key
|
823
|
+
end
|
824
|
+
|
825
|
+
headers = nil
|
826
|
+
post_body = nil
|
827
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
828
|
+
GetSettlementStatsByCountryOut.new(response)
|
829
|
+
|
830
|
+
end
|
831
|
+
|
832
|
+
def get_settlement_stats_by_taxation_type (date_from,date_to,opts={})
|
833
|
+
query_param_keys = [:date_from,:date_to]
|
834
|
+
|
835
|
+
# verify existence of params
|
836
|
+
raise "date_from is required" if date_from.nil?
|
837
|
+
raise "date_to is required" if date_to.nil?
|
838
|
+
# set default values and merge with input
|
839
|
+
options = {
|
840
|
+
:date_from => date_from,
|
841
|
+
:date_to => date_to}.merge(opts)
|
842
|
+
|
843
|
+
#resource path
|
844
|
+
path = "/api/v1/stats/settlement/by_taxation_type".sub('{format}','json')
|
845
|
+
|
846
|
+
|
847
|
+
# pull querystring keys from options
|
848
|
+
queryopts = options.select do |key,value|
|
849
|
+
query_param_keys.include? key
|
850
|
+
end
|
851
|
+
|
852
|
+
headers = nil
|
853
|
+
post_body = nil
|
854
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
855
|
+
GetSettlementStatsByTaxationTypeOut.new(response)
|
856
|
+
|
857
|
+
end
|
858
|
+
|
859
|
+
def get_daily_settlement_stats (interval,date_from,date_to,opts={})
|
860
|
+
query_param_keys = [:interval,:date_from,:date_to]
|
861
|
+
|
862
|
+
# verify existence of params
|
863
|
+
raise "interval is required" if interval.nil?
|
864
|
+
raise "date_from is required" if date_from.nil?
|
865
|
+
raise "date_to is required" if date_to.nil?
|
866
|
+
# set default values and merge with input
|
867
|
+
options = {
|
868
|
+
:interval => interval,
|
869
|
+
:date_from => date_from,
|
870
|
+
:date_to => date_to}.merge(opts)
|
871
|
+
|
872
|
+
#resource path
|
873
|
+
path = "/api/v1/stats/settlement/daily".sub('{format}','json')
|
874
|
+
|
875
|
+
|
876
|
+
# pull querystring keys from options
|
877
|
+
queryopts = options.select do |key,value|
|
878
|
+
query_param_keys.include? key
|
879
|
+
end
|
880
|
+
|
881
|
+
headers = nil
|
882
|
+
post_body = nil
|
883
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
884
|
+
GetDailySettlementStatsOut.new(response)
|
885
|
+
|
886
|
+
end
|
887
|
+
|
888
|
+
def get_eu_vies_report (period_length,lff_sequence_number,transformation,currency_code,end_month,tax_id,start_month,eu_country_code,fx_date_type,format,opts={})
|
889
|
+
query_param_keys = [:period_length,:lff_sequence_number,:transformation,:currency_code,:end_month,:tax_id,:start_month,:eu_country_code,:fx_date_type,:format]
|
890
|
+
|
891
|
+
# verify existence of params
|
892
|
+
raise "end_month is required" if end_month.nil?
|
893
|
+
raise "start_month is required" if start_month.nil?
|
894
|
+
raise "eu_country_code is required" if eu_country_code.nil?
|
895
|
+
# set default values and merge with input
|
896
|
+
options = {
|
897
|
+
:period_length => period_length,
|
898
|
+
:lff_sequence_number => lff_sequence_number,
|
899
|
+
:transformation => transformation,
|
900
|
+
:currency_code => currency_code,
|
901
|
+
:end_month => end_month,
|
902
|
+
:tax_id => tax_id,
|
903
|
+
:start_month => start_month,
|
904
|
+
:eu_country_code => eu_country_code,
|
905
|
+
:fx_date_type => fx_date_type,
|
906
|
+
:format => format}.merge(opts)
|
907
|
+
|
908
|
+
#resource path
|
909
|
+
path = "/api/v1/reports/eu/vies".sub('{format}','json')
|
910
|
+
|
911
|
+
|
912
|
+
# pull querystring keys from options
|
913
|
+
queryopts = options.select do |key,value|
|
914
|
+
query_param_keys.include? key
|
915
|
+
end
|
916
|
+
|
917
|
+
headers = nil
|
918
|
+
post_body = nil
|
919
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
920
|
+
GetEuViesReportOut.new(response)
|
921
|
+
|
922
|
+
end
|
923
|
+
|
924
|
+
def get_domestic_summary_report (format,country_code,currency_code,start_month,end_month,fx_date_type,opts={})
|
925
|
+
query_param_keys = [:format,:country_code,:currency_code,:start_month,:end_month,:fx_date_type]
|
926
|
+
|
927
|
+
# verify existence of params
|
928
|
+
raise "country_code is required" if country_code.nil?
|
929
|
+
raise "start_month is required" if start_month.nil?
|
930
|
+
raise "end_month is required" if end_month.nil?
|
931
|
+
# set default values and merge with input
|
932
|
+
options = {
|
933
|
+
:format => format,
|
934
|
+
:country_code => country_code,
|
935
|
+
:currency_code => currency_code,
|
936
|
+
:start_month => start_month,
|
937
|
+
:end_month => end_month,
|
938
|
+
:fx_date_type => fx_date_type}.merge(opts)
|
939
|
+
|
940
|
+
#resource path
|
941
|
+
path = "/api/v1/reports/domestic/summary".sub('{format}','json')
|
942
|
+
|
943
|
+
|
944
|
+
# pull querystring keys from options
|
945
|
+
queryopts = options.select do |key,value|
|
946
|
+
query_param_keys.include? key
|
947
|
+
end
|
948
|
+
|
949
|
+
headers = nil
|
950
|
+
post_body = nil
|
951
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
952
|
+
GetDomesticSummaryReportOut.new(response)
|
953
|
+
|
954
|
+
end
|
955
|
+
|
956
|
+
def get_detailed_refunds (format,country_codes,date_from,date_to,limit,offset,opts={})
|
957
|
+
query_param_keys = [:format,:country_codes,:date_from,:date_to,:limit,:offset]
|
958
|
+
|
959
|
+
# set default values and merge with input
|
960
|
+
options = {
|
961
|
+
:format => format,
|
962
|
+
:country_codes => country_codes,
|
963
|
+
:date_from => date_from,
|
964
|
+
:date_to => date_to,
|
965
|
+
:limit => limit,
|
966
|
+
:offset => offset}.merge(opts)
|
967
|
+
|
968
|
+
#resource path
|
969
|
+
path = "/api/v1/settlement/detailed_refunds".sub('{format}','json')
|
970
|
+
|
971
|
+
|
972
|
+
# pull querystring keys from options
|
973
|
+
queryopts = options.select do |key,value|
|
974
|
+
query_param_keys.include? key
|
975
|
+
end
|
976
|
+
|
977
|
+
headers = nil
|
978
|
+
post_body = nil
|
979
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
980
|
+
GetDetailedRefundsOut.new(response)
|
981
|
+
|
982
|
+
end
|
983
|
+
|
984
|
+
def get_refunds (format,moss_country_code,tax_region,date_from,opts={})
|
985
|
+
query_param_keys = [:format,:moss_country_code,:tax_region,:date_from]
|
986
|
+
|
987
|
+
# verify existence of params
|
988
|
+
raise "date_from is required" if date_from.nil?
|
989
|
+
# set default values and merge with input
|
990
|
+
options = {
|
991
|
+
:format => format,
|
992
|
+
:moss_country_code => moss_country_code,
|
993
|
+
:tax_region => tax_region,
|
994
|
+
:date_from => date_from}.merge(opts)
|
995
|
+
|
996
|
+
#resource path
|
997
|
+
path = "/api/v1/settlement/refunds".sub('{format}','json')
|
998
|
+
|
999
|
+
|
1000
|
+
# pull querystring keys from options
|
1001
|
+
queryopts = options.select do |key,value|
|
1002
|
+
query_param_keys.include? key
|
1003
|
+
end
|
1004
|
+
|
1005
|
+
headers = nil
|
1006
|
+
post_body = nil
|
1007
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1008
|
+
GetRefundsOut.new(response)
|
1009
|
+
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
def get_settlement (moss_tax_id,currency_code,end_month,tax_id,refund_date_kind_override,start_month,moss_country_code,format,tax_country_code,quarter,opts={})
|
1013
|
+
query_param_keys = [:moss_tax_id,:currency_code,:end_month,:tax_id,:refund_date_kind_override,:start_month,:moss_country_code,:format,:tax_country_code]
|
1014
|
+
|
1015
|
+
# verify existence of params
|
1016
|
+
raise "quarter is required" if quarter.nil?
|
1017
|
+
# set default values and merge with input
|
1018
|
+
options = {
|
1019
|
+
:moss_tax_id => moss_tax_id,
|
1020
|
+
:currency_code => currency_code,
|
1021
|
+
:end_month => end_month,
|
1022
|
+
:tax_id => tax_id,
|
1023
|
+
:refund_date_kind_override => refund_date_kind_override,
|
1024
|
+
:start_month => start_month,
|
1025
|
+
:moss_country_code => moss_country_code,
|
1026
|
+
:format => format,
|
1027
|
+
:tax_country_code => tax_country_code,
|
1028
|
+
:quarter => quarter}.merge(opts)
|
1029
|
+
|
1030
|
+
#resource path
|
1031
|
+
path = "/api/v1/settlement/{quarter}".sub('{format}','json').sub('{' + 'quarter' + '}', escapeString(quarter))
|
1032
|
+
|
1033
|
+
|
1034
|
+
# pull querystring keys from options
|
1035
|
+
queryopts = options.select do |key,value|
|
1036
|
+
query_param_keys.include? key
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
headers = nil
|
1040
|
+
post_body = nil
|
1041
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1042
|
+
GetSettlementOut.new(response)
|
1043
|
+
|
1044
|
+
end
|
1045
|
+
|
1046
|
+
def get_settlement_summary (moss_country_code,tax_region,start_month,end_month,quarter,opts={})
|
1047
|
+
query_param_keys = [:moss_country_code,:tax_region,:start_month,:end_month]
|
1048
|
+
|
1049
|
+
# verify existence of params
|
1050
|
+
raise "quarter is required" if quarter.nil?
|
1051
|
+
# set default values and merge with input
|
1052
|
+
options = {
|
1053
|
+
:moss_country_code => moss_country_code,
|
1054
|
+
:tax_region => tax_region,
|
1055
|
+
:start_month => start_month,
|
1056
|
+
:end_month => end_month,
|
1057
|
+
:quarter => quarter}.merge(opts)
|
1058
|
+
|
1059
|
+
#resource path
|
1060
|
+
path = "/api/v1/settlement/summary/{quarter}".sub('{format}','json').sub('{' + 'quarter' + '}', escapeString(quarter))
|
1061
|
+
|
1062
|
+
|
1063
|
+
# pull querystring keys from options
|
1064
|
+
queryopts = options.select do |key,value|
|
1065
|
+
query_param_keys.include? key
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
headers = nil
|
1069
|
+
post_body = nil
|
1070
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1071
|
+
GetSettlementSummaryOut.new(response)
|
1072
|
+
|
1073
|
+
end
|
1074
|
+
|
1075
|
+
def create_s_m_s_token (body,opts={})
|
1076
|
+
query_param_keys = []
|
1077
|
+
|
1078
|
+
# verify existence of params
|
1079
|
+
raise "body is required" if body.nil?
|
1080
|
+
# set default values and merge with input
|
1081
|
+
options = {
|
1082
|
+
:body => body}.merge(opts)
|
1083
|
+
|
1084
|
+
#resource path
|
1085
|
+
path = "/api/v1/verification/sms".sub('{format}','json')
|
1086
|
+
|
1087
|
+
|
1088
|
+
# pull querystring keys from options
|
1089
|
+
queryopts = options.select do |key,value|
|
1090
|
+
query_param_keys.include? key
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
headers = nil
|
1094
|
+
post_body = nil
|
1095
|
+
if body != nil
|
1096
|
+
if body.is_a?(Array)
|
1097
|
+
array = Array.new
|
1098
|
+
body.each do |item|
|
1099
|
+
if item.respond_to?("to_body".to_sym)
|
1100
|
+
array.push item.to_body
|
1101
|
+
else
|
1102
|
+
array.push item
|
1103
|
+
end
|
1104
|
+
end
|
1105
|
+
post_body = array
|
1106
|
+
|
1107
|
+
else
|
1108
|
+
if body.respond_to?("to_body".to_sym)
|
1109
|
+
post_body = body.to_body
|
1110
|
+
else
|
1111
|
+
post_body = body
|
1112
|
+
end
|
1113
|
+
end
|
1114
|
+
end
|
1115
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1116
|
+
CreateSMSTokenOut.new(response)
|
1117
|
+
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
def verify_s_m_s_token (token,opts={})
|
1121
|
+
query_param_keys = []
|
1122
|
+
|
1123
|
+
# verify existence of params
|
1124
|
+
raise "token is required" if token.nil?
|
1125
|
+
# set default values and merge with input
|
1126
|
+
options = {
|
1127
|
+
:token => token}.merge(opts)
|
1128
|
+
|
1129
|
+
#resource path
|
1130
|
+
path = "/api/v1/verification/sms/{token}".sub('{format}','json').sub('{' + 'token' + '}', escapeString(token))
|
1131
|
+
|
1132
|
+
|
1133
|
+
# pull querystring keys from options
|
1134
|
+
queryopts = options.select do |key,value|
|
1135
|
+
query_param_keys.include? key
|
1136
|
+
end
|
1137
|
+
|
1138
|
+
headers = nil
|
1139
|
+
post_body = nil
|
1140
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1141
|
+
VerifySMSTokenOut.new(response)
|
1142
|
+
|
1143
|
+
end
|
1144
|
+
|
1145
|
+
def get_currencies_dict (opts={})
|
1146
|
+
query_param_keys = []
|
1147
|
+
|
1148
|
+
# set default values and merge with input
|
1149
|
+
options = {
|
1150
|
+
}.merge(opts)
|
1151
|
+
|
1152
|
+
#resource path
|
1153
|
+
path = "/api/v1/dictionaries/currencies".sub('{format}','json')
|
1154
|
+
|
1155
|
+
|
1156
|
+
# pull querystring keys from options
|
1157
|
+
queryopts = options.select do |key,value|
|
1158
|
+
query_param_keys.include? key
|
1159
|
+
end
|
1160
|
+
|
1161
|
+
headers = nil
|
1162
|
+
post_body = nil
|
1163
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1164
|
+
GetCurrenciesDictOut.new(response)
|
1165
|
+
|
1166
|
+
end
|
1167
|
+
|
1168
|
+
def get_product_types_dict (opts={})
|
1169
|
+
query_param_keys = []
|
1170
|
+
|
1171
|
+
# set default values and merge with input
|
1172
|
+
options = {
|
1173
|
+
}.merge(opts)
|
1174
|
+
|
1175
|
+
#resource path
|
1176
|
+
path = "/api/v1/dictionaries/product_types".sub('{format}','json')
|
1177
|
+
|
1178
|
+
|
1179
|
+
# pull querystring keys from options
|
1180
|
+
queryopts = options.select do |key,value|
|
1181
|
+
query_param_keys.include? key
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
headers = nil
|
1185
|
+
post_body = nil
|
1186
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1187
|
+
GetProductTypesDictOut.new(response)
|
1188
|
+
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
def get_countries_dict (tax_supported,opts={})
|
1192
|
+
query_param_keys = [:tax_supported]
|
1193
|
+
|
1194
|
+
# set default values and merge with input
|
1195
|
+
options = {
|
1196
|
+
:tax_supported => tax_supported}.merge(opts)
|
1197
|
+
|
1198
|
+
#resource path
|
1199
|
+
path = "/api/v1/dictionaries/countries".sub('{format}','json')
|
1200
|
+
|
1201
|
+
|
1202
|
+
# pull querystring keys from options
|
1203
|
+
queryopts = options.select do |key,value|
|
1204
|
+
query_param_keys.include? key
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
headers = nil
|
1208
|
+
post_body = nil
|
1209
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1210
|
+
GetCountriesDictOut.new(response)
|
1211
|
+
|
1212
|
+
end
|
1213
|
+
|
1214
|
+
end
|
1215
|
+
end
|