taxamo-ns 2.3.3 → 2.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +3 -3
- data/LICENSE +1 -1
- data/README.md +17 -1
- data/lib/swagger.rb +1 -1
- data/lib/swagger/configuration.rb +41 -0
- data/lib/swagger/request.rb +25 -26
- data/lib/taxamo.rb +42 -39
- data/lib/taxamo/models/controlflags.rb +68 -0
- data/lib/taxamo/models/inputtransaction.rb +7 -1
- data/lib/taxamo/models/inputtransactionupdate.rb +7 -1
- data/lib/taxamo/models/transaction.rb +18 -1
- data/lib/taxamo/models/transactions.rb +18 -1
- data/lib/taxamo/models/warnings.rb +68 -0
- data/lib/taxamo/version.rb +1 -1
- data/taxamo.gemspec +1 -1
- data/test/taxamo/connectivity_test.rb +12 -13
- data/test/taxamo/tax_test.rb +40 -0
- data/test/taxamo/transactions_api_test.rb +20 -1
- metadata +23 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 76d6a643ac7fe67d7ddb466388e6334a0ac31a6e7b3551045f2a8ce3c36e8cfa
|
4
|
+
data.tar.gz: 3c8a532c6d069c5eea3b6e891b3bdea0eb895b00284b96532827c3425c25e5b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ab0a8a8c41e991bd0a58438934498d53a13c06c1bada07650a2f70d18d3a9a523cb94a925449a8d53e074c0d89c1fadaf03ebf25e5d0d5beae8ee0863edb514
|
7
|
+
data.tar.gz: dc2cd251db2f7d508ac99d2f419b4cbc10903e612700fedcc36198d481049df1f0c9a8b89befd0e8e1b3ccacf9c04bc5ccbccce3390fcc699a006514673f878b
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -20,7 +20,7 @@ The library can also be installed directy - just fetch this repository and issue
|
|
20
20
|
|
21
21
|
```shell
|
22
22
|
$ gem build taxamo.gemspec
|
23
|
-
$ gem install taxamo-ns-2.3.
|
23
|
+
$ gem install taxamo-ns-2.3.8.gem
|
24
24
|
```
|
25
25
|
|
26
26
|
Finally, you can use this github repo and add the following line to your project's `Gemfile` file:
|
@@ -37,6 +37,22 @@ gem "taxamo", github: "taxamo/taxamo-ruby", '~> 1.1'
|
|
37
37
|
|
38
38
|
## Changes
|
39
39
|
|
40
|
+
2.3.8 (2021-05-19):
|
41
|
+
* update library dependencies
|
42
|
+
|
43
|
+
2.3.7 (2018-08-09):
|
44
|
+
* merge in PR #15 with logger improvements
|
45
|
+
* update library dependencies
|
46
|
+
|
47
|
+
2.3.6 (2017-11-09):
|
48
|
+
* add control_flags to transaction class and update calculate_simple_tax with new fields
|
49
|
+
|
50
|
+
2.3.5 (2017-11-01):
|
51
|
+
* add warnings and tax_entity_additional_id field to the transaction object
|
52
|
+
|
53
|
+
2.3.4 (2017-06-09):
|
54
|
+
* allow configuration to be overridden when making the api call. See `connectivity_test.rb` for examples.
|
55
|
+
|
40
56
|
2.3.3 (2017-05-26):
|
41
57
|
* remove not needed camel case applied to 1st level attributes in request map
|
42
58
|
|
data/lib/swagger.rb
CHANGED
@@ -30,7 +30,7 @@ module Swagger
|
|
30
30
|
yield(configuration) if block_given?
|
31
31
|
|
32
32
|
# Configure logger. Default to use Rails
|
33
|
-
self.logger ||= configuration.logger || (defined?(Rails) ? Rails.logger : Logger.new(STDOUT))
|
33
|
+
self.logger ||= configuration.logger || (defined?(Rails) ? Rails.logger : Logger.new(STDOUT, level: Logger::WARN))
|
34
34
|
|
35
35
|
# remove :// from scheme
|
36
36
|
configuration.scheme.sub!(/:\/\//, '')
|
@@ -16,6 +16,47 @@ module Swagger
|
|
16
16
|
@camelize_params = false
|
17
17
|
end
|
18
18
|
|
19
|
+
def update(params)
|
20
|
+
if params[:format]
|
21
|
+
@format = params[:format]
|
22
|
+
end
|
23
|
+
if params[:scheme]
|
24
|
+
@scheme = params[:scheme]
|
25
|
+
end
|
26
|
+
if params[:host]
|
27
|
+
@host = params[:host]
|
28
|
+
end
|
29
|
+
if params[:base_path]
|
30
|
+
@base_path = params[:base_path]
|
31
|
+
end
|
32
|
+
if params[:user_agent]
|
33
|
+
@user_agent = params[:user_agent]
|
34
|
+
end
|
35
|
+
if params[:inject_format]
|
36
|
+
@inject_format = params[:inject_format]
|
37
|
+
end
|
38
|
+
if params[:force_ending_format]
|
39
|
+
@force_ending_format = params[:force_ending_format]
|
40
|
+
end
|
41
|
+
if params[:camelize_params]
|
42
|
+
@camelize_params = params[:camelize_params]
|
43
|
+
end
|
44
|
+
if params[:api_key]
|
45
|
+
@api_key = params[:api_key]
|
46
|
+
end
|
47
|
+
if params[:username]
|
48
|
+
@username = params[:username]
|
49
|
+
end
|
50
|
+
if params[:password]
|
51
|
+
@password = params[:password]
|
52
|
+
end
|
53
|
+
if params[:auth_token]
|
54
|
+
@auth_token = params[:auth_token]
|
55
|
+
end
|
56
|
+
if params[:logger]
|
57
|
+
@logger = params[:logger]
|
58
|
+
end
|
59
|
+
end
|
19
60
|
end
|
20
61
|
|
21
62
|
end
|
data/lib/swagger/request.rb
CHANGED
@@ -5,20 +5,23 @@ module Swagger
|
|
5
5
|
require 'addressable/uri'
|
6
6
|
require 'typhoeus'
|
7
7
|
|
8
|
-
attr_accessor :host, :path, :format, :params, :body, :http_method, :headers
|
8
|
+
attr_accessor :host, :path, :format, :params, :body, :http_method, :headers, :configuration
|
9
9
|
|
10
10
|
|
11
11
|
# All requests must have an HTTP method and a path
|
12
12
|
# Optionals parameters are :params, :headers, :body, :format, :host
|
13
13
|
#
|
14
|
-
def initialize(http_method, path, attributes={})
|
15
|
-
|
14
|
+
def initialize(http_method, path, attributes={}, configuration={})
|
15
|
+
self.configuration = Swagger.configuration.clone()
|
16
|
+
self.configuration.update(configuration || {})
|
17
|
+
|
18
|
+
attributes[:format] ||= self.configuration.format
|
16
19
|
attributes[:params] ||= {}
|
17
20
|
|
18
21
|
# Set default headers
|
19
22
|
default_headers = {
|
20
23
|
'Content-Type' => "application/#{attributes[:format].downcase}",
|
21
|
-
'Token' =>
|
24
|
+
'Token' => self.configuration.api_key,
|
22
25
|
'Source-Id' => "taxamo-ruby/" + Taxamo::VERSION
|
23
26
|
}
|
24
27
|
|
@@ -26,20 +29,15 @@ module Swagger
|
|
26
29
|
if attributes[:headers].present? && attributes[:headers].has_key?(:api_key)
|
27
30
|
default_headers.delete(:api_key)
|
28
31
|
end
|
29
|
-
|
32
|
+
|
30
33
|
# api_key from params hash trumps all others (headers and default_headers)
|
31
34
|
if attributes[:params].present? && attributes[:params].has_key?(:api_key)
|
32
35
|
default_headers.delete(:api_key)
|
33
36
|
attributes[:headers].delete(:api_key) if attributes[:headers].present?
|
34
37
|
end
|
35
|
-
|
38
|
+
|
36
39
|
# Merge argument headers into defaults
|
37
40
|
attributes[:headers] = default_headers.merge(attributes[:headers] || {})
|
38
|
-
|
39
|
-
# Stick in the auth token if there is one
|
40
|
-
if Swagger.authenticated?
|
41
|
-
attributes[:headers].merge!({:auth_token => Swagger.configuration.auth_token})
|
42
|
-
end
|
43
41
|
|
44
42
|
self.http_method = http_method.to_sym
|
45
43
|
self.path = path
|
@@ -50,20 +48,20 @@ module Swagger
|
|
50
48
|
|
51
49
|
# Construct a base URL
|
52
50
|
#
|
53
|
-
def url(options = {})
|
51
|
+
def url(options = {})
|
54
52
|
u = Addressable::URI.new(
|
55
|
-
:scheme =>
|
56
|
-
:host =>
|
53
|
+
:scheme => self.configuration.scheme,
|
54
|
+
:host => self.configuration.host,
|
57
55
|
:path => self.interpreted_path,
|
58
56
|
:query => self.query_string.sub(/\?/, '')
|
59
57
|
).to_s
|
60
|
-
|
58
|
+
|
61
59
|
# Drop trailing question mark, if present
|
62
60
|
u.sub! /\?$/, ''
|
63
|
-
|
61
|
+
|
64
62
|
# Obfuscate API key?
|
65
63
|
u.sub! /api\_key=\w+/, 'api_key=YOUR_API_KEY' if options[:obfuscated]
|
66
|
-
|
64
|
+
|
67
65
|
u
|
68
66
|
end
|
69
67
|
|
@@ -98,13 +96,13 @@ module Swagger
|
|
98
96
|
#
|
99
97
|
# p = p.sub("{format}", self.format.to_s)
|
100
98
|
#
|
101
|
-
URI.encode [
|
99
|
+
URI.encode [self.configuration.base_path, p].join("/").gsub(/\/+/, '/')
|
102
100
|
end
|
103
|
-
|
101
|
+
|
104
102
|
# Massage the request body into a state of readiness
|
105
103
|
# If body is a hash, camelize all keys then convert to a json string
|
106
104
|
#
|
107
|
-
def body=(value)
|
105
|
+
def body=(value)
|
108
106
|
#if value.is_a?(Hash)
|
109
107
|
# value = value.inject({}) do |memo, (k,v)|
|
110
108
|
# memo[k.to_s.camelize(:lower).to_sym] = v
|
@@ -113,13 +111,13 @@ module Swagger
|
|
113
111
|
#end
|
114
112
|
@body = value
|
115
113
|
end
|
116
|
-
|
114
|
+
|
117
115
|
# If body is an object, JSONify it before making the actual request.
|
118
|
-
#
|
116
|
+
#
|
119
117
|
def outgoing_body
|
120
118
|
body.is_a?(String) ? body : body.to_json
|
121
119
|
end
|
122
|
-
|
120
|
+
|
123
121
|
# Construct a query string from the query-string-type params
|
124
122
|
def query_string
|
125
123
|
|
@@ -130,7 +128,7 @@ module Swagger
|
|
130
128
|
self.params.each_pair do |key, value|
|
131
129
|
next if self.path.include? "{#{key}}" # skip path params
|
132
130
|
next if value.blank? && value.class != FalseClass # skip empties
|
133
|
-
if
|
131
|
+
if self.configuration.camelize_params
|
134
132
|
key = key.to_s.camelize(:lower).to_sym unless key.to_sym == :api_key # api_key is not a camelCased param
|
135
133
|
end
|
136
134
|
query_values[key.to_s] = value.to_s
|
@@ -147,8 +145,9 @@ module Swagger
|
|
147
145
|
end
|
148
146
|
|
149
147
|
def make
|
150
|
-
|
151
|
-
|
148
|
+
if self.configuration && self.configuration.logger
|
149
|
+
self.configuration.logger.debug self.url
|
150
|
+
end
|
152
151
|
response = case self.http_method.to_sym
|
153
152
|
when :get,:GET
|
154
153
|
Typhoeus::Request.get(
|
data/lib/taxamo.rb
CHANGED
@@ -64,7 +64,7 @@ module Taxamo
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
67
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
68
68
|
CreateRefundOut.new(response)
|
69
69
|
|
70
70
|
end
|
@@ -89,7 +89,7 @@ module Taxamo
|
|
89
89
|
|
90
90
|
headers = nil
|
91
91
|
post_body = nil
|
92
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
92
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
93
93
|
ListRefundsOut.new(response)
|
94
94
|
|
95
95
|
end
|
@@ -136,7 +136,7 @@ module Taxamo
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
end
|
139
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
139
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
140
140
|
CreatePaymentOut.new(response)
|
141
141
|
|
142
142
|
end
|
@@ -163,7 +163,7 @@ module Taxamo
|
|
163
163
|
|
164
164
|
headers = nil
|
165
165
|
post_body = nil
|
166
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
166
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
167
167
|
ListPaymentsOut.new(response)
|
168
168
|
|
169
169
|
end
|
@@ -188,7 +188,7 @@ module Taxamo
|
|
188
188
|
|
189
189
|
headers = nil
|
190
190
|
post_body = nil
|
191
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
191
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
192
192
|
CapturePaymentOut.new(response)
|
193
193
|
|
194
194
|
end
|
@@ -235,7 +235,7 @@ module Taxamo
|
|
235
235
|
end
|
236
236
|
end
|
237
237
|
end
|
238
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
238
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
239
239
|
EmailInvoiceOut.new(response)
|
240
240
|
|
241
241
|
end
|
@@ -284,7 +284,7 @@ module Taxamo
|
|
284
284
|
end
|
285
285
|
end
|
286
286
|
end
|
287
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
287
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
288
288
|
EmailRefundOut.new(response)
|
289
289
|
|
290
290
|
end
|
@@ -329,7 +329,7 @@ module Taxamo
|
|
329
329
|
end
|
330
330
|
end
|
331
331
|
end
|
332
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
332
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
333
333
|
CreateTransactionOut.new(response)
|
334
334
|
|
335
335
|
end
|
@@ -354,7 +354,7 @@ module Taxamo
|
|
354
354
|
|
355
355
|
headers = nil
|
356
356
|
post_body = nil
|
357
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
357
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
358
358
|
GetTransactionOut.new(response)
|
359
359
|
|
360
360
|
end
|
@@ -401,7 +401,7 @@ module Taxamo
|
|
401
401
|
end
|
402
402
|
end
|
403
403
|
end
|
404
|
-
response = Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
404
|
+
response = Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
405
405
|
UpdateTransactionOut.new(response)
|
406
406
|
|
407
407
|
end
|
@@ -448,7 +448,7 @@ module Taxamo
|
|
448
448
|
end
|
449
449
|
end
|
450
450
|
end
|
451
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
451
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
452
452
|
ConfirmTransactionOut.new(response)
|
453
453
|
|
454
454
|
end
|
@@ -473,7 +473,7 @@ module Taxamo
|
|
473
473
|
|
474
474
|
headers = nil
|
475
475
|
post_body = nil
|
476
|
-
response = Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
476
|
+
response = Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
477
477
|
CancelTransactionOut.new(response)
|
478
478
|
|
479
479
|
end
|
@@ -520,7 +520,7 @@ module Taxamo
|
|
520
520
|
end
|
521
521
|
end
|
522
522
|
end
|
523
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
523
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
524
524
|
UnconfirmTransactionOut.new(response)
|
525
525
|
|
526
526
|
end
|
@@ -559,7 +559,7 @@ module Taxamo
|
|
559
559
|
|
560
560
|
headers = nil
|
561
561
|
post_body = nil
|
562
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
562
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
563
563
|
ListTransactionsOut.new(response)
|
564
564
|
|
565
565
|
end
|
@@ -604,13 +604,13 @@ module Taxamo
|
|
604
604
|
end
|
605
605
|
end
|
606
606
|
end
|
607
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
607
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
608
608
|
CalculateTaxOut.new(response)
|
609
609
|
|
610
610
|
end
|
611
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]
|
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,b2b_number_service_on_error=nil,b2b_number_service_timeoutms=nil,b2b_number_service_cache_expiry_days=nil,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,:b2b_number_service_on_error,:b2b_number_service_timeoutms,:b2b_number_service_cache_expiry_days]
|
614
614
|
|
615
615
|
# verify existence of params
|
616
616
|
raise "currency_code is required" if currency_code.nil?
|
@@ -630,7 +630,10 @@ module Taxamo
|
|
630
630
|
:billing_country_code => billing_country_code,
|
631
631
|
:invoice_address_postal_code => invoice_address_postal_code,
|
632
632
|
:total_amount => total_amount,
|
633
|
-
:tax_deducted => tax_deducted
|
633
|
+
:tax_deducted => tax_deducted,
|
634
|
+
:b2b_number_service_on_error => b2b_number_service_on_error,
|
635
|
+
:b2b_number_service_timeoutms => b2b_number_service_timeoutms,
|
636
|
+
:b2b_number_service_cache_expiry_days => b2b_number_service_cache_expiry_days}.merge(opts)
|
634
637
|
|
635
638
|
#resource path
|
636
639
|
path = "/api/v1/tax/calculate".sub('{format}','json')
|
@@ -643,7 +646,7 @@ module Taxamo
|
|
643
646
|
|
644
647
|
headers = nil
|
645
648
|
post_body = nil
|
646
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
649
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
647
650
|
CalculateSimpleTaxOut.new(response)
|
648
651
|
|
649
652
|
end
|
@@ -669,7 +672,7 @@ module Taxamo
|
|
669
672
|
|
670
673
|
headers = nil
|
671
674
|
post_body = nil
|
672
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
675
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
673
676
|
ValidateTaxNumberOut.new(response)
|
674
677
|
|
675
678
|
end
|
@@ -693,7 +696,7 @@ module Taxamo
|
|
693
696
|
|
694
697
|
headers = nil
|
695
698
|
post_body = nil
|
696
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
699
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
697
700
|
CalculateTaxLocationOut.new(response)
|
698
701
|
|
699
702
|
end
|
@@ -716,7 +719,7 @@ module Taxamo
|
|
716
719
|
|
717
720
|
headers = nil
|
718
721
|
post_body = nil
|
719
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
722
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
720
723
|
LocateMyIPOut.new(response)
|
721
724
|
|
722
725
|
end
|
@@ -741,7 +744,7 @@ module Taxamo
|
|
741
744
|
|
742
745
|
headers = nil
|
743
746
|
post_body = nil
|
744
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
747
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
745
748
|
LocateGivenIPOut.new(response)
|
746
749
|
|
747
750
|
end
|
@@ -769,7 +772,7 @@ module Taxamo
|
|
769
772
|
|
770
773
|
headers = nil
|
771
774
|
post_body = nil
|
772
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
775
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
773
776
|
GetTransactionsStatsByCountryOut.new(response)
|
774
777
|
|
775
778
|
end
|
@@ -797,7 +800,7 @@ module Taxamo
|
|
797
800
|
|
798
801
|
headers = nil
|
799
802
|
post_body = nil
|
800
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
803
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
801
804
|
GetTransactionsStatsOut.new(response)
|
802
805
|
|
803
806
|
end
|
@@ -824,7 +827,7 @@ module Taxamo
|
|
824
827
|
|
825
828
|
headers = nil
|
826
829
|
post_body = nil
|
827
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
830
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
828
831
|
GetSettlementStatsByCountryOut.new(response)
|
829
832
|
|
830
833
|
end
|
@@ -851,7 +854,7 @@ module Taxamo
|
|
851
854
|
|
852
855
|
headers = nil
|
853
856
|
post_body = nil
|
854
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
857
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
855
858
|
GetSettlementStatsByTaxationTypeOut.new(response)
|
856
859
|
|
857
860
|
end
|
@@ -880,7 +883,7 @@ module Taxamo
|
|
880
883
|
|
881
884
|
headers = nil
|
882
885
|
post_body = nil
|
883
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
886
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
884
887
|
GetDailySettlementStatsOut.new(response)
|
885
888
|
|
886
889
|
end
|
@@ -916,7 +919,7 @@ module Taxamo
|
|
916
919
|
|
917
920
|
headers = nil
|
918
921
|
post_body = nil
|
919
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
922
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
920
923
|
GetEuViesReportOut.new(response)
|
921
924
|
|
922
925
|
end
|
@@ -948,7 +951,7 @@ module Taxamo
|
|
948
951
|
|
949
952
|
headers = nil
|
950
953
|
post_body = nil
|
951
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
954
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
952
955
|
GetDomesticSummaryReportOut.new(response)
|
953
956
|
|
954
957
|
end
|
@@ -976,7 +979,7 @@ module Taxamo
|
|
976
979
|
|
977
980
|
headers = nil
|
978
981
|
post_body = nil
|
979
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
982
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
980
983
|
GetDetailedRefundsOut.new(response)
|
981
984
|
|
982
985
|
end
|
@@ -1004,7 +1007,7 @@ module Taxamo
|
|
1004
1007
|
|
1005
1008
|
headers = nil
|
1006
1009
|
post_body = nil
|
1007
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1010
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1008
1011
|
GetRefundsOut.new(response)
|
1009
1012
|
|
1010
1013
|
end
|
@@ -1038,7 +1041,7 @@ module Taxamo
|
|
1038
1041
|
|
1039
1042
|
headers = nil
|
1040
1043
|
post_body = nil
|
1041
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1044
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1042
1045
|
GetSettlementOut.new(response)
|
1043
1046
|
|
1044
1047
|
end
|
@@ -1067,7 +1070,7 @@ module Taxamo
|
|
1067
1070
|
|
1068
1071
|
headers = nil
|
1069
1072
|
post_body = nil
|
1070
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1073
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1071
1074
|
GetSettlementSummaryOut.new(response)
|
1072
1075
|
|
1073
1076
|
end
|
@@ -1112,7 +1115,7 @@ module Taxamo
|
|
1112
1115
|
end
|
1113
1116
|
end
|
1114
1117
|
end
|
1115
|
-
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1118
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1116
1119
|
CreateSMSTokenOut.new(response)
|
1117
1120
|
|
1118
1121
|
end
|
@@ -1137,7 +1140,7 @@ module Taxamo
|
|
1137
1140
|
|
1138
1141
|
headers = nil
|
1139
1142
|
post_body = nil
|
1140
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1143
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1141
1144
|
VerifySMSTokenOut.new(response)
|
1142
1145
|
|
1143
1146
|
end
|
@@ -1160,7 +1163,7 @@ module Taxamo
|
|
1160
1163
|
|
1161
1164
|
headers = nil
|
1162
1165
|
post_body = nil
|
1163
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1166
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1164
1167
|
GetCurrenciesDictOut.new(response)
|
1165
1168
|
|
1166
1169
|
end
|
@@ -1183,7 +1186,7 @@ module Taxamo
|
|
1183
1186
|
|
1184
1187
|
headers = nil
|
1185
1188
|
post_body = nil
|
1186
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1189
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1187
1190
|
GetProductTypesDictOut.new(response)
|
1188
1191
|
|
1189
1192
|
end
|
@@ -1206,7 +1209,7 @@ module Taxamo
|
|
1206
1209
|
|
1207
1210
|
headers = nil
|
1208
1211
|
post_body = nil
|
1209
|
-
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
1212
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }, opts[:configuration]).make.body
|
1210
1213
|
GetCountriesDictOut.new(response)
|
1211
1214
|
|
1212
1215
|
end
|
@@ -0,0 +1,68 @@
|
|
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
|
+
module Taxamo
|
14
|
+
class ControlFlags
|
15
|
+
attr_accessor :key, :value
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:key => :key,
|
21
|
+
:value => :value
|
22
|
+
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(attributes = {})
|
27
|
+
return if attributes.nil? or attributes.empty?
|
28
|
+
# Morph attribute keys into undescored rubyish style
|
29
|
+
if attributes.key?("key")
|
30
|
+
@key = attributes["key"]
|
31
|
+
|
32
|
+
end
|
33
|
+
if attributes.key?("value")
|
34
|
+
@value = attributes["value"]
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_body
|
42
|
+
body = {}
|
43
|
+
self.class.attribute_map.each_pair do |key, value|
|
44
|
+
v = self.send(key)
|
45
|
+
unless v.nil?
|
46
|
+
if v.is_a?(Array)
|
47
|
+
array = Array.new
|
48
|
+
v.each do |item|
|
49
|
+
if item.respond_to?("to_body".to_sym)
|
50
|
+
array.push item.to_body
|
51
|
+
else
|
52
|
+
array.push item
|
53
|
+
end
|
54
|
+
end
|
55
|
+
body[value] = array
|
56
|
+
else
|
57
|
+
if v.respond_to?("to_body".to_sym)
|
58
|
+
body[value] = v.to_body
|
59
|
+
else
|
60
|
+
body[value] = v
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
body
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
module Taxamo
|
14
14
|
class InputTransaction
|
15
|
-
attr_accessor :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :currency_code, :sub_account_id, :supply_date, :invoice_address, :verification_token, :note, :tax_data, :transaction_lines, :buyer_tax_number, :status, :custom_fields, :force_country_code, :invoice_number, :order_date, :customer_id, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :additional_currencies, :invoice_place, :evidence, :description, :tax_deducted, :tax_country_code
|
15
|
+
attr_accessor :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :currency_code, :sub_account_id, :supply_date, :control_flags, :invoice_address, :verification_token, :note, :tax_data, :transaction_lines, :buyer_tax_number, :status, :custom_fields, :force_country_code, :invoice_number, :order_date, :customer_id, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :additional_currencies, :invoice_place, :evidence, :description, :tax_deducted, :tax_country_code
|
16
16
|
|
17
17
|
# :internal => :external
|
18
18
|
def self.attribute_map
|
@@ -25,6 +25,7 @@ class InputTransaction
|
|
25
25
|
:currency_code => :currency_code,
|
26
26
|
:sub_account_id => :sub_account_id,
|
27
27
|
:supply_date => :supply_date,
|
28
|
+
:control_flags => :control_flags,
|
28
29
|
:invoice_address => :invoice_address,
|
29
30
|
:verification_token => :verification_token,
|
30
31
|
:note => :note,
|
@@ -88,6 +89,11 @@ class InputTransaction
|
|
88
89
|
@supply_date = attributes["supply_date"]
|
89
90
|
|
90
91
|
end
|
92
|
+
if attributes.key?("control_flags")
|
93
|
+
if (value = attributes["control_flags"]).is_a?(Array)
|
94
|
+
@control_flags = value.map{ |v| ControlFlags.new(v) }
|
95
|
+
end
|
96
|
+
end
|
91
97
|
if attributes.key?("invoice_address")
|
92
98
|
@invoice_address = InvoiceAddress.new(attributes["invoice_address"])
|
93
99
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
module Taxamo
|
14
14
|
class InputTransactionUpdate
|
15
|
-
attr_accessor :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :currency_code, :sub_account_id, :supply_date, :invoice_address, :verification_token, :note, :tax_data, :transaction_lines, :buyer_tax_number, :status, :custom_fields, :force_country_code, :invoice_number, :order_date, :customer_id, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :additional_currencies, :invoice_place, :evidence, :description, :tax_deducted, :tax_country_code
|
15
|
+
attr_accessor :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :currency_code, :sub_account_id, :supply_date, :control_flags, :invoice_address, :verification_token, :note, :tax_data, :transaction_lines, :buyer_tax_number, :status, :custom_fields, :force_country_code, :invoice_number, :order_date, :customer_id, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :additional_currencies, :invoice_place, :evidence, :description, :tax_deducted, :tax_country_code
|
16
16
|
|
17
17
|
# :internal => :external
|
18
18
|
def self.attribute_map
|
@@ -25,6 +25,7 @@ class InputTransactionUpdate
|
|
25
25
|
:currency_code => :currency_code,
|
26
26
|
:sub_account_id => :sub_account_id,
|
27
27
|
:supply_date => :supply_date,
|
28
|
+
:control_flags => :control_flags,
|
28
29
|
:invoice_address => :invoice_address,
|
29
30
|
:verification_token => :verification_token,
|
30
31
|
:note => :note,
|
@@ -88,6 +89,11 @@ class InputTransactionUpdate
|
|
88
89
|
@supply_date = attributes["supply_date"]
|
89
90
|
|
90
91
|
end
|
92
|
+
if attributes.key?("control_flags")
|
93
|
+
if (value = attributes["control_flags"]).is_a?(Array)
|
94
|
+
@control_flags = value.map{ |v| ControlFlags.new(v) }
|
95
|
+
end
|
96
|
+
end
|
91
97
|
if attributes.key?("invoice_address")
|
92
98
|
@invoice_address = InvoiceAddress.new(attributes["invoice_address"])
|
93
99
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
module Taxamo
|
14
14
|
class Transaction
|
15
|
-
attr_accessor :confirm_timestamp, :fully_informative, :deducted_tax_amount, :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :create_timestamp, :currency_code, :sub_account_id, :supply_date, :buyer_tax_number_normalized, :invoice_image_url, :key, :buyer_tax_number_format_valid, :tax_number_service, :invoice_address, :buyer_tax_number_valid, :verification_token, :note, :tax_supported, :tax_data, :transaction_lines, :buyer_tax_number, :external_key, :status, :custom_fields, :force_country_code, :countries, :invoice_number, :order_date, :customer_id, :kind, :source, :amount, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :tax_amount, :additional_currencies, :invoice_place, :total_amount, :tax_entity_name, :evidence, :refunded_tax_amount, :manual, :tax_timezone, :description, :test, :tax_deducted, :tax_country_code, :refunded_total_amount
|
15
|
+
attr_accessor :confirm_timestamp, :fully_informative, :deducted_tax_amount, :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :create_timestamp, :currency_code, :sub_account_id, :supply_date, :buyer_tax_number_normalized, :invoice_image_url, :key, :buyer_tax_number_format_valid, :tax_number_service, :control_flags, :invoice_address, :buyer_tax_number_valid, :verification_token, :note, :tax_supported, :tax_data, :transaction_lines, :buyer_tax_number, :external_key, :status, :custom_fields, :force_country_code, :countries, :invoice_number, :order_date, :customer_id, :kind, :source, :amount, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :tax_amount, :tax_entity_additional_id, :warnings, :additional_currencies, :invoice_place, :total_amount, :tax_entity_name, :evidence, :refunded_tax_amount, :manual, :tax_timezone, :description, :test, :tax_deducted, :tax_country_code, :refunded_total_amount
|
16
16
|
|
17
17
|
# :internal => :external
|
18
18
|
def self.attribute_map
|
@@ -34,6 +34,7 @@ class Transaction
|
|
34
34
|
:key => :key,
|
35
35
|
:buyer_tax_number_format_valid => :buyer_tax_number_format_valid,
|
36
36
|
:tax_number_service => :tax_number_service,
|
37
|
+
:control_flags => :control_flags,
|
37
38
|
:invoice_address => :invoice_address,
|
38
39
|
:buyer_tax_number_valid => :buyer_tax_number_valid,
|
39
40
|
:verification_token => :verification_token,
|
@@ -60,6 +61,8 @@ class Transaction
|
|
60
61
|
:billing_country_code => :billing_country_code,
|
61
62
|
:custom_id => :custom_id,
|
62
63
|
:tax_amount => :tax_amount,
|
64
|
+
:tax_entity_additional_id => :tax_entity_additional_id,
|
65
|
+
:warnings => :warnings,
|
63
66
|
:additional_currencies => :additional_currencies,
|
64
67
|
:invoice_place => :invoice_place,
|
65
68
|
:total_amount => :total_amount,
|
@@ -148,6 +151,11 @@ class Transaction
|
|
148
151
|
@tax_number_service = attributes["tax_number_service"]
|
149
152
|
|
150
153
|
end
|
154
|
+
if attributes.key?("control_flags")
|
155
|
+
if (value = attributes["control_flags"]).is_a?(Array)
|
156
|
+
@control_flags = value.map{ |v| ControlFlags.new(v) }
|
157
|
+
end
|
158
|
+
end
|
151
159
|
if attributes.key?("invoice_address")
|
152
160
|
@invoice_address = InvoiceAddress.new(attributes["invoice_address"])
|
153
161
|
|
@@ -254,6 +262,15 @@ class Transaction
|
|
254
262
|
@tax_amount = attributes["tax_amount"]
|
255
263
|
|
256
264
|
end
|
265
|
+
if attributes.key?("tax_entity_additional_id")
|
266
|
+
@tax_entity_additional_id = attributes["tax_entity_additional_id"]
|
267
|
+
|
268
|
+
end
|
269
|
+
if attributes.key?("warnings")
|
270
|
+
if (value = attributes["warnings"]).is_a?(Array)
|
271
|
+
@warnings = value.map{ |v| Warnings.new(v) }
|
272
|
+
end
|
273
|
+
end
|
257
274
|
if attributes.key?("additional_currencies")
|
258
275
|
@additional_currencies = AdditionalCurrencies.new(attributes["additional_currencies"])
|
259
276
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
module Taxamo
|
14
14
|
class Transactions
|
15
|
-
attr_accessor :confirm_timestamp, :fully_informative, :deducted_tax_amount, :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :create_timestamp, :currency_code, :sub_account_id, :supply_date, :buyer_tax_number_normalized, :invoice_image_url, :key, :buyer_tax_number_format_valid, :tax_number_service, :invoice_address, :buyer_tax_number_valid, :verification_token, :note, :tax_supported, :tax_data, :transaction_lines, :buyer_tax_number, :external_key, :status, :custom_fields, :force_country_code, :countries, :invoice_number, :order_date, :customer_id, :kind, :source, :amount, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :tax_amount, :additional_currencies, :invoice_place, :total_amount, :tax_entity_name, :evidence, :refunded_tax_amount, :manual, :tax_timezone, :description, :test, :tax_deducted, :tax_country_code, :refunded_total_amount
|
15
|
+
attr_accessor :confirm_timestamp, :fully_informative, :deducted_tax_amount, :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :create_timestamp, :currency_code, :sub_account_id, :supply_date, :buyer_tax_number_normalized, :invoice_image_url, :key, :buyer_tax_number_format_valid, :tax_number_service, :control_flags, :invoice_address, :buyer_tax_number_valid, :verification_token, :note, :tax_supported, :tax_data, :transaction_lines, :buyer_tax_number, :external_key, :status, :custom_fields, :force_country_code, :countries, :invoice_number, :order_date, :customer_id, :kind, :source, :amount, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :tax_amount, :tax_entity_additional_id, :warnings, :additional_currencies, :invoice_place, :total_amount, :tax_entity_name, :evidence, :refunded_tax_amount, :manual, :tax_timezone, :description, :test, :tax_deducted, :tax_country_code, :refunded_total_amount
|
16
16
|
|
17
17
|
# :internal => :external
|
18
18
|
def self.attribute_map
|
@@ -34,6 +34,7 @@ class Transactions
|
|
34
34
|
:key => :key,
|
35
35
|
:buyer_tax_number_format_valid => :buyer_tax_number_format_valid,
|
36
36
|
:tax_number_service => :tax_number_service,
|
37
|
+
:control_flags => :control_flags,
|
37
38
|
:invoice_address => :invoice_address,
|
38
39
|
:buyer_tax_number_valid => :buyer_tax_number_valid,
|
39
40
|
:verification_token => :verification_token,
|
@@ -60,6 +61,8 @@ class Transactions
|
|
60
61
|
:billing_country_code => :billing_country_code,
|
61
62
|
:custom_id => :custom_id,
|
62
63
|
:tax_amount => :tax_amount,
|
64
|
+
:tax_entity_additional_id => :tax_entity_additional_id,
|
65
|
+
:warnings => :warnings,
|
63
66
|
:additional_currencies => :additional_currencies,
|
64
67
|
:invoice_place => :invoice_place,
|
65
68
|
:total_amount => :total_amount,
|
@@ -148,6 +151,11 @@ class Transactions
|
|
148
151
|
@tax_number_service = attributes["tax_number_service"]
|
149
152
|
|
150
153
|
end
|
154
|
+
if attributes.key?("control_flags")
|
155
|
+
if (value = attributes["control_flags"]).is_a?(Array)
|
156
|
+
@control_flags = value.map{ |v| ControlFlags.new(v) }
|
157
|
+
end
|
158
|
+
end
|
151
159
|
if attributes.key?("invoice_address")
|
152
160
|
@invoice_address = InvoiceAddress.new(attributes["invoice_address"])
|
153
161
|
|
@@ -254,6 +262,15 @@ class Transactions
|
|
254
262
|
@tax_amount = attributes["tax_amount"]
|
255
263
|
|
256
264
|
end
|
265
|
+
if attributes.key?("tax_entity_additional_id")
|
266
|
+
@tax_entity_additional_id = attributes["tax_entity_additional_id"]
|
267
|
+
|
268
|
+
end
|
269
|
+
if attributes.key?("warnings")
|
270
|
+
if (value = attributes["warnings"]).is_a?(Array)
|
271
|
+
@warnings = value.map{ |v| Warnings.new(v) }
|
272
|
+
end
|
273
|
+
end
|
257
274
|
if attributes.key?("additional_currencies")
|
258
275
|
@additional_currencies = AdditionalCurrencies.new(attributes["additional_currencies"])
|
259
276
|
|
@@ -0,0 +1,68 @@
|
|
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
|
+
module Taxamo
|
14
|
+
class Warnings
|
15
|
+
attr_accessor :type, :message
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:type => :type,
|
21
|
+
:message => :message
|
22
|
+
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(attributes = {})
|
27
|
+
return if attributes.nil? or attributes.empty?
|
28
|
+
# Morph attribute keys into undescored rubyish style
|
29
|
+
if attributes.key?("type")
|
30
|
+
@type = attributes["type"]
|
31
|
+
|
32
|
+
end
|
33
|
+
if attributes.key?("message")
|
34
|
+
@message = attributes["message"]
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_body
|
42
|
+
body = {}
|
43
|
+
self.class.attribute_map.each_pair do |key, value|
|
44
|
+
v = self.send(key)
|
45
|
+
unless v.nil?
|
46
|
+
if v.is_a?(Array)
|
47
|
+
array = Array.new
|
48
|
+
v.each do |item|
|
49
|
+
if item.respond_to?("to_body".to_sym)
|
50
|
+
array.push item.to_body
|
51
|
+
else
|
52
|
+
array.push item
|
53
|
+
end
|
54
|
+
end
|
55
|
+
body[value] = array
|
56
|
+
else
|
57
|
+
if v.respond_to?("to_body".to_sym)
|
58
|
+
body[value] = v.to_body
|
59
|
+
else
|
60
|
+
body[value] = v
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
body
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/taxamo/version.rb
CHANGED
data/taxamo.gemspec
CHANGED
@@ -14,7 +14,7 @@ spec = Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency('addressable', '~> 2')
|
16
16
|
s.add_dependency('typhoeus', '> 0.6.0')
|
17
|
-
s.add_dependency('require_all', '~> 1.
|
17
|
+
s.add_dependency('require_all', '~> 1.4.0')
|
18
18
|
|
19
19
|
s.add_development_dependency('mocha', '~> 0.13.2')
|
20
20
|
s.add_development_dependency('shoulda', '~> 3.4.0')
|
@@ -36,20 +36,19 @@ class ConnectivityTest < Test::Unit::TestCase
|
|
36
36
|
|
37
37
|
should 'test_auth' do
|
38
38
|
Swagger.configure do |config|
|
39
|
-
config.api_key = 'SamplePrivateTestKey1
|
39
|
+
config.api_key = 'SamplePrivateTestKey1'
|
40
40
|
end
|
41
41
|
assert_raise(AuthenticationError) {
|
42
|
-
Taxamo.calculate_tax
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
42
|
+
Taxamo.calculate_tax({'transaction' => {
|
43
|
+
'currency_code' => 'USD',
|
44
|
+
'buyer_ip' => '127.0.0.1',
|
45
|
+
'billing_country_code' => 'IE',
|
46
|
+
'force_country_code' => 'FR',
|
47
|
+
'transaction_lines' => [{'amount' => 200,
|
48
|
+
'custom_id' => 'line1'},
|
49
|
+
{'amount' => 100,
|
50
|
+
'product_type' => 'e-book',
|
51
|
+
'custom_id' => 'line2'}]}},
|
52
|
+
{:configuration => {:api_key => 'SamplePrivateTestKey1!'}})}
|
54
53
|
end
|
55
54
|
end
|
data/test/taxamo/tax_test.rb
CHANGED
@@ -114,6 +114,46 @@ class TaxTest < Test::Unit::TestCase
|
|
114
114
|
assert_equal resp.transaction.transaction_lines[0].tax_rate, 5.5
|
115
115
|
assert_equal resp.transaction.transaction_lines[0].total_amount, 105.5
|
116
116
|
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
should 'test simple calculate with b2b flags' do
|
121
|
+
|
122
|
+
Swagger.configure do |config|
|
123
|
+
config.api_key = 'SamplePrivateTestKey1'
|
124
|
+
end
|
125
|
+
|
126
|
+
resp = Taxamo.calculate_simple_tax('e-book', #product_type
|
127
|
+
nil, #invoice_address_city
|
128
|
+
nil, #buyer_credit_card_prefix
|
129
|
+
'USD', #currency_code
|
130
|
+
nil, #invoice_address_region
|
131
|
+
nil, #unit_price
|
132
|
+
nil, #quantity
|
133
|
+
"PL0000000000", #buyer_tax_number
|
134
|
+
nil, #force_country_code
|
135
|
+
nil, #order_date
|
136
|
+
100, #amount
|
137
|
+
'IE', #billing_country_code
|
138
|
+
nil, #invoice_address_postal_code
|
139
|
+
nil, #total_amount
|
140
|
+
nil, #tax_deducted
|
141
|
+
"accept", #b2b_number_service_on_error
|
142
|
+
"001", #b2b_number_service_timeoutms
|
143
|
+
"0" #b2b_number_service_cache_expiry_days
|
144
|
+
)
|
145
|
+
|
146
|
+
assert_equal resp.transaction.buyer_tax_number_valid, true
|
147
|
+
assert_equal resp.transaction.note, "b2b_error_accept"
|
148
|
+
assert_equal resp.transaction.warnings[0].type, "vies-error"
|
149
|
+
assert_equal resp.transaction.warnings[0].message, "Read timed out"
|
150
|
+
|
151
|
+
#assert_equal resp.transaction.tax_country_code, 'PL'
|
152
|
+
assert_equal resp.transaction.amount, 100
|
153
|
+
assert_equal resp.transaction.tax_amount, 0
|
154
|
+
assert_equal resp.transaction.total_amount, 100
|
155
|
+
assert_equal resp.transaction.tax_deducted, true
|
156
|
+
|
117
157
|
end
|
118
158
|
|
119
159
|
should 'test validate tax number' do
|
@@ -111,8 +111,13 @@ class TransactionsApiTest < Test::Unit::TestCase
|
|
111
111
|
createRefundIn.custom_id='line1'
|
112
112
|
|
113
113
|
refundResp = Taxamo.create_refund(resp.transaction.key, {'total_amount' => 100, 'custom_id' => 'line1'})
|
114
|
+
assert_equal refundResp.total_amount, 100
|
115
|
+
assert_equal refundResp.refunded_total_amount, 100
|
116
|
+
|
114
117
|
refundResp = Taxamo.create_refund(resp.transaction.key, createRefundIn)
|
115
118
|
|
119
|
+
assert_equal refundResp.total_amount, 100
|
120
|
+
assert_equal refundResp.refunded_total_amount, 200
|
116
121
|
resp = Taxamo.get_transaction(resp.transaction.key)
|
117
122
|
|
118
123
|
assert_false resp.transaction.key.nil?
|
@@ -235,7 +240,7 @@ class TransactionsApiTest < Test::Unit::TestCase
|
|
235
240
|
|
236
241
|
end
|
237
242
|
|
238
|
-
should "test custom fields" do
|
243
|
+
should "test custom fields and control flags" do
|
239
244
|
resp = Taxamo.create_transaction(
|
240
245
|
{'transaction' => {
|
241
246
|
'currency_code' => 'USD',
|
@@ -245,6 +250,8 @@ class TransactionsApiTest < Test::Unit::TestCase
|
|
245
250
|
'order_date' => '2014-06-01',
|
246
251
|
'custom_fields' => [{'key' => 'test1', 'value' => 'test2'},
|
247
252
|
{'key' => 'test1', 'value' => 'test3'}],
|
253
|
+
'control_flags' => [{'key' => 'test4', 'value' => 'test5'},
|
254
|
+
{'key' => 'test6', 'value' => 'test7'}],
|
248
255
|
'transaction_lines' => [{'amount' => 200,
|
249
256
|
'custom_id' => 'line1',
|
250
257
|
'custom_fields' => [{'key' => 'test11', 'value' => 'test22'},
|
@@ -258,6 +265,8 @@ class TransactionsApiTest < Test::Unit::TestCase
|
|
258
265
|
assert_equal resp.transaction.status, 'N'
|
259
266
|
assert_equal resp.transaction.custom_fields[0].key, 'test1'
|
260
267
|
assert_equal resp.transaction.custom_fields[1].value, 'test3'
|
268
|
+
assert_equal resp.transaction.control_flags[0].key, 'test4'
|
269
|
+
assert_equal resp.transaction.control_flags[1].value, 'test7'
|
261
270
|
|
262
271
|
resp = Taxamo.get_transaction(resp.transaction.key)
|
263
272
|
|
@@ -266,6 +275,8 @@ class TransactionsApiTest < Test::Unit::TestCase
|
|
266
275
|
assert_equal resp.transaction.custom_fields[0].key, 'test1'
|
267
276
|
assert_equal resp.transaction.custom_fields[1].value, 'test3'
|
268
277
|
assert_equal resp.transaction.transaction_lines[0].custom_fields[1].value, 'test23'
|
278
|
+
assert_equal resp.transaction.control_flags[0].key, 'test4'
|
279
|
+
assert_equal resp.transaction.control_flags[1].value, 'test7'
|
269
280
|
|
270
281
|
resp = Taxamo.update_transaction(resp.transaction.key,
|
271
282
|
{'transaction' =>
|
@@ -297,6 +308,10 @@ class TransactionsApiTest < Test::Unit::TestCase
|
|
297
308
|
assert_equal resp.transaction.custom_fields[0].key, 'test51'
|
298
309
|
assert_equal resp.transaction.custom_fields[1].value, 'test53'
|
299
310
|
assert_equal resp.transaction.custom_fields[2].value, 'test63'
|
311
|
+
|
312
|
+
assert_equal resp.transaction.control_flags[0].key, 'test4'
|
313
|
+
assert_equal resp.transaction.control_flags[1].value, 'test7'
|
314
|
+
|
300
315
|
assert_equal resp.transaction.transaction_lines[0].custom_fields[1].value, 'test43'
|
301
316
|
assert_equal resp.transaction.transaction_lines[1].custom_fields[1].value, 'test83'
|
302
317
|
|
@@ -326,6 +341,10 @@ class TransactionsApiTest < Test::Unit::TestCase
|
|
326
341
|
assert_equal resp.transactions[0].custom_fields[0].key, 'test51'
|
327
342
|
assert_equal resp.transactions[0].custom_fields[1].value, 'test53'
|
328
343
|
assert_equal resp.transactions[0].custom_fields[2].value, 'test63'
|
344
|
+
|
345
|
+
assert_equal resp.transactions[0].control_flags[0].key, 'test4'
|
346
|
+
assert_equal resp.transactions[0].control_flags[1].value, 'test7'
|
347
|
+
|
329
348
|
assert_equal resp.transactions[0].transaction_lines[0].custom_fields[1].value, 'test43'
|
330
349
|
assert_equal resp.transactions[0].transaction_lines[1].custom_fields[1].value, 'test83'
|
331
350
|
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taxamo-ns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomek Lipski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: typhoeus
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: require_all
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.4.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.4.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.13.2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.13.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: shoulda
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 3.4.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.4.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: test-unit
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Taxamo provides a real-time Software as a Service (SaaS) solution for
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/taxamo/models/capturepaymentout.rb
|
141
141
|
- lib/taxamo/models/confirmtransactionin.rb
|
142
142
|
- lib/taxamo/models/confirmtransactionout.rb
|
143
|
+
- lib/taxamo/models/controlflags.rb
|
143
144
|
- lib/taxamo/models/countries.rb
|
144
145
|
- lib/taxamo/models/country.rb
|
145
146
|
- lib/taxamo/models/countryschema.rb
|
@@ -206,6 +207,7 @@ files:
|
|
206
207
|
- lib/taxamo/models/ustaxid.rb
|
207
208
|
- lib/taxamo/models/validatetaxnumberout.rb
|
208
209
|
- lib/taxamo/models/verifysmstokenout.rb
|
210
|
+
- lib/taxamo/models/warnings.rb
|
209
211
|
- lib/taxamo/version.rb
|
210
212
|
- taxamo.gemspec
|
211
213
|
- test/taxamo/connectivity_test.rb
|
@@ -222,17 +224,17 @@ require_paths:
|
|
222
224
|
- lib
|
223
225
|
required_ruby_version: !ruby/object:Gem::Requirement
|
224
226
|
requirements:
|
225
|
-
- -
|
227
|
+
- - ">="
|
226
228
|
- !ruby/object:Gem::Version
|
227
229
|
version: '0'
|
228
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
231
|
requirements:
|
230
|
-
- -
|
232
|
+
- - ">="
|
231
233
|
- !ruby/object:Gem::Version
|
232
234
|
version: '0'
|
233
235
|
requirements: []
|
234
236
|
rubyforge_project:
|
235
|
-
rubygems_version: 2.
|
237
|
+
rubygems_version: 2.7.6
|
236
238
|
signing_key:
|
237
239
|
specification_version: 4
|
238
240
|
summary: Ruby bindings for the Taxamo API (namespaced)
|