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
@@ -0,0 +1,63 @@
|
|
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 AdditionalCurrencies
|
15
|
+
attr_accessor :invoice
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:invoice => :invoice
|
21
|
+
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(attributes = {})
|
26
|
+
return if attributes.empty?
|
27
|
+
# Morph attribute keys into undescored rubyish style
|
28
|
+
if attributes["invoice"]
|
29
|
+
@invoice = AdditionalCurrency.new(attributes["invoice"])
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_body
|
37
|
+
body = {}
|
38
|
+
self.class.attribute_map.each_pair do |key, value|
|
39
|
+
v = self.send(key)
|
40
|
+
unless v.nil?
|
41
|
+
if v.is_a?(Array)
|
42
|
+
array = Array.new
|
43
|
+
v.each do |item|
|
44
|
+
if item.respond_to?("to_body".to_sym)
|
45
|
+
array.push item.to_body
|
46
|
+
else
|
47
|
+
array.push item
|
48
|
+
end
|
49
|
+
end
|
50
|
+
body[value] = array
|
51
|
+
else
|
52
|
+
if v.respond_to?("to_body".to_sym)
|
53
|
+
body[value] = v.to_body
|
54
|
+
else
|
55
|
+
body[value] = v
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
body
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,88 @@
|
|
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 AdditionalCurrency
|
15
|
+
attr_accessor :currency_code, :amount, :tax_amount, :fx_rate, :fx_date, :total_amount
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:currency_code => :currency_code,
|
21
|
+
:amount => :amount,
|
22
|
+
:tax_amount => :tax_amount,
|
23
|
+
:fx_rate => :fx_rate,
|
24
|
+
:fx_date => :fx_date,
|
25
|
+
:total_amount => :total_amount
|
26
|
+
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(attributes = {})
|
31
|
+
return if attributes.empty?
|
32
|
+
# Morph attribute keys into undescored rubyish style
|
33
|
+
if attributes["currency_code"]
|
34
|
+
@currency_code = attributes["currency_code"]
|
35
|
+
|
36
|
+
end
|
37
|
+
if attributes["amount"]
|
38
|
+
@amount = attributes["amount"]
|
39
|
+
|
40
|
+
end
|
41
|
+
if attributes["tax_amount"]
|
42
|
+
@tax_amount = attributes["tax_amount"]
|
43
|
+
|
44
|
+
end
|
45
|
+
if attributes["fx_rate"]
|
46
|
+
@fx_rate = attributes["fx_rate"]
|
47
|
+
|
48
|
+
end
|
49
|
+
if attributes["fx_date"]
|
50
|
+
@fx_date = attributes["fx_date"]
|
51
|
+
|
52
|
+
end
|
53
|
+
if attributes["total_amount"]
|
54
|
+
@total_amount = attributes["total_amount"]
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_body
|
62
|
+
body = {}
|
63
|
+
self.class.attribute_map.each_pair do |key, value|
|
64
|
+
v = self.send(key)
|
65
|
+
unless v.nil?
|
66
|
+
if v.is_a?(Array)
|
67
|
+
array = Array.new
|
68
|
+
v.each do |item|
|
69
|
+
if item.respond_to?("to_body".to_sym)
|
70
|
+
array.push item.to_body
|
71
|
+
else
|
72
|
+
array.push item
|
73
|
+
end
|
74
|
+
end
|
75
|
+
body[value] = array
|
76
|
+
else
|
77
|
+
if v.respond_to?("to_body".to_sym)
|
78
|
+
body[value] = v.to_body
|
79
|
+
else
|
80
|
+
body[value] = v
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
body
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,78 @@
|
|
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 ByCountry
|
15
|
+
attr_accessor :value, :tax_country_name, :tax_country_code, :currency_code
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:value => :value,
|
21
|
+
:tax_country_name => :tax_country_name,
|
22
|
+
:tax_country_code => :tax_country_code,
|
23
|
+
:currency_code => :currency_code
|
24
|
+
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(attributes = {})
|
29
|
+
return if attributes.empty?
|
30
|
+
# Morph attribute keys into undescored rubyish style
|
31
|
+
if attributes["value"]
|
32
|
+
@value = attributes["value"]
|
33
|
+
|
34
|
+
end
|
35
|
+
if attributes["tax_country_name"]
|
36
|
+
@tax_country_name = attributes["tax_country_name"]
|
37
|
+
|
38
|
+
end
|
39
|
+
if attributes["tax_country_code"]
|
40
|
+
@tax_country_code = attributes["tax_country_code"]
|
41
|
+
|
42
|
+
end
|
43
|
+
if attributes["currency_code"]
|
44
|
+
@currency_code = attributes["currency_code"]
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_body
|
52
|
+
body = {}
|
53
|
+
self.class.attribute_map.each_pair do |key, value|
|
54
|
+
v = self.send(key)
|
55
|
+
unless v.nil?
|
56
|
+
if v.is_a?(Array)
|
57
|
+
array = Array.new
|
58
|
+
v.each do |item|
|
59
|
+
if item.respond_to?("to_body".to_sym)
|
60
|
+
array.push item.to_body
|
61
|
+
else
|
62
|
+
array.push item
|
63
|
+
end
|
64
|
+
end
|
65
|
+
body[value] = array
|
66
|
+
else
|
67
|
+
if v.respond_to?("to_body".to_sym)
|
68
|
+
body[value] = v.to_body
|
69
|
+
else
|
70
|
+
body[value] = v
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
body
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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 ByStatus
|
15
|
+
attr_accessor :_n, :_c
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:_n => :N,
|
21
|
+
:_c => :C
|
22
|
+
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(attributes = {})
|
27
|
+
return if attributes.empty?
|
28
|
+
# Morph attribute keys into undescored rubyish style
|
29
|
+
if attributes["_n"]
|
30
|
+
if (value = attributes["N"]).is_a?(Array)
|
31
|
+
@_n = value.map{ |v| N.new(v) }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
if attributes["_c"]
|
35
|
+
if (value = attributes["C"]).is_a?(Array)
|
36
|
+
@_c = value.map{ |v| C.new(v) }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_body
|
44
|
+
body = {}
|
45
|
+
self.class.attribute_map.each_pair do |key, value|
|
46
|
+
v = self.send(key)
|
47
|
+
unless v.nil?
|
48
|
+
if v.is_a?(Array)
|
49
|
+
array = Array.new
|
50
|
+
v.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
|
+
body[value] = array
|
58
|
+
else
|
59
|
+
if v.respond_to?("to_body".to_sym)
|
60
|
+
body[value] = v.to_body
|
61
|
+
else
|
62
|
+
body[value] = v
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
body
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,83 @@
|
|
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 ByTaxationType
|
15
|
+
attr_accessor :taxed_count, :deducted_count, :transactions_count, :eu_b2b, :eu_taxed
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:taxed_count => :taxed_count,
|
21
|
+
:deducted_count => :deducted_count,
|
22
|
+
:transactions_count => :transactions_count,
|
23
|
+
:eu_b2b => :eu_b2b,
|
24
|
+
:eu_taxed => :eu_taxed
|
25
|
+
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(attributes = {})
|
30
|
+
return if attributes.empty?
|
31
|
+
# Morph attribute keys into undescored rubyish style
|
32
|
+
if attributes["taxed_count"]
|
33
|
+
@taxed_count = attributes["taxed_count"]
|
34
|
+
|
35
|
+
end
|
36
|
+
if attributes["deducted_count"]
|
37
|
+
@deducted_count = attributes["deducted_count"]
|
38
|
+
|
39
|
+
end
|
40
|
+
if attributes["transactions_count"]
|
41
|
+
@transactions_count = attributes["transactions_count"]
|
42
|
+
|
43
|
+
end
|
44
|
+
if attributes["eu_b2b"]
|
45
|
+
@eu_b2b = attributes["eu_b2b"]
|
46
|
+
|
47
|
+
end
|
48
|
+
if attributes["eu_taxed"]
|
49
|
+
@eu_taxed = attributes["eu_taxed"]
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_body
|
57
|
+
body = {}
|
58
|
+
self.class.attribute_map.each_pair do |key, value|
|
59
|
+
v = self.send(key)
|
60
|
+
unless v.nil?
|
61
|
+
if v.is_a?(Array)
|
62
|
+
array = Array.new
|
63
|
+
v.each do |item|
|
64
|
+
if item.respond_to?("to_body".to_sym)
|
65
|
+
array.push item.to_body
|
66
|
+
else
|
67
|
+
array.push item
|
68
|
+
end
|
69
|
+
end
|
70
|
+
body[value] = array
|
71
|
+
else
|
72
|
+
if v.respond_to?("to_body".to_sym)
|
73
|
+
body[value] = v.to_body
|
74
|
+
else
|
75
|
+
body[value] = v
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
body
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,78 @@
|
|
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 C
|
15
|
+
attr_accessor :day_raw, :value, :status, :day
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:day_raw => :day_raw,
|
21
|
+
:value => :value,
|
22
|
+
:status => :status,
|
23
|
+
:day => :day
|
24
|
+
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(attributes = {})
|
29
|
+
return if attributes.empty?
|
30
|
+
# Morph attribute keys into undescored rubyish style
|
31
|
+
if attributes["day_raw"]
|
32
|
+
@day_raw = attributes["day_raw"]
|
33
|
+
|
34
|
+
end
|
35
|
+
if attributes["value"]
|
36
|
+
@value = attributes["value"]
|
37
|
+
|
38
|
+
end
|
39
|
+
if attributes["status"]
|
40
|
+
@status = attributes["status"]
|
41
|
+
|
42
|
+
end
|
43
|
+
if attributes["day"]
|
44
|
+
@day = attributes["day"]
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_body
|
52
|
+
body = {}
|
53
|
+
self.class.attribute_map.each_pair do |key, value|
|
54
|
+
v = self.send(key)
|
55
|
+
unless v.nil?
|
56
|
+
if v.is_a?(Array)
|
57
|
+
array = Array.new
|
58
|
+
v.each do |item|
|
59
|
+
if item.respond_to?("to_body".to_sym)
|
60
|
+
array.push item.to_body
|
61
|
+
else
|
62
|
+
array.push item
|
63
|
+
end
|
64
|
+
end
|
65
|
+
body[value] = array
|
66
|
+
else
|
67
|
+
if v.respond_to?("to_body".to_sym)
|
68
|
+
body[value] = v.to_body
|
69
|
+
else
|
70
|
+
body[value] = v
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
body
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,75 @@
|
|
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 CalculateSimpleTaxOut
|
15
|
+
attr_accessor :transaction, :tax_required_fields, :storage_required_fields
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:transaction => :transaction,
|
21
|
+
:tax_required_fields => :tax_required_fields,
|
22
|
+
:storage_required_fields => :storage_required_fields
|
23
|
+
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize(attributes = {})
|
28
|
+
return if attributes.empty?
|
29
|
+
# Morph attribute keys into undescored rubyish style
|
30
|
+
if attributes["transaction"]
|
31
|
+
@transaction = Transaction.new(attributes["transaction"])
|
32
|
+
|
33
|
+
end
|
34
|
+
if attributes["tax_required_fields"]
|
35
|
+
if (value = attributes["tax_required_fields"]).is_a?(Array)
|
36
|
+
@tax_required_fields = value.map{ |v| TaxRequiredFields.new(v) }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
if attributes["storage_required_fields"]
|
40
|
+
if (value = attributes["storage_required_fields"]).is_a?(Array)
|
41
|
+
@storage_required_fields = value.map{ |v| StorageRequiredFields.new(v) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_body
|
49
|
+
body = {}
|
50
|
+
self.class.attribute_map.each_pair do |key, value|
|
51
|
+
v = self.send(key)
|
52
|
+
unless v.nil?
|
53
|
+
if v.is_a?(Array)
|
54
|
+
array = Array.new
|
55
|
+
v.each do |item|
|
56
|
+
if item.respond_to?("to_body".to_sym)
|
57
|
+
array.push item.to_body
|
58
|
+
else
|
59
|
+
array.push item
|
60
|
+
end
|
61
|
+
end
|
62
|
+
body[value] = array
|
63
|
+
else
|
64
|
+
if v.respond_to?("to_body".to_sym)
|
65
|
+
body[value] = v.to_body
|
66
|
+
else
|
67
|
+
body[value] = v
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
body
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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 CalculateTaxIn
|
15
|
+
attr_accessor :transaction
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:transaction => :transaction
|
21
|
+
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(attributes = {})
|
26
|
+
return if attributes.empty?
|
27
|
+
# Morph attribute keys into undescored rubyish style
|
28
|
+
if attributes["transaction"]
|
29
|
+
@transaction = InputTransaction.new(attributes["transaction"])
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_body
|
37
|
+
body = {}
|
38
|
+
self.class.attribute_map.each_pair do |key, value|
|
39
|
+
v = self.send(key)
|
40
|
+
unless v.nil?
|
41
|
+
if v.is_a?(Array)
|
42
|
+
array = Array.new
|
43
|
+
v.each do |item|
|
44
|
+
if item.respond_to?("to_body".to_sym)
|
45
|
+
array.push item.to_body
|
46
|
+
else
|
47
|
+
array.push item
|
48
|
+
end
|
49
|
+
end
|
50
|
+
body[value] = array
|
51
|
+
else
|
52
|
+
if v.respond_to?("to_body".to_sym)
|
53
|
+
body[value] = v.to_body
|
54
|
+
else
|
55
|
+
body[value] = v
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
body
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,98 @@
|
|
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 CalculateTaxLocationOut
|
15
|
+
attr_accessor :tax_country_code, :tax_deducted, :tax_supported, :countries, :buyer_ip, :billing_country_code, :buyer_credit_card_prefix, :evidence
|
16
|
+
|
17
|
+
# :internal => :external
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:tax_country_code => :tax_country_code,
|
21
|
+
:tax_deducted => :tax_deducted,
|
22
|
+
:tax_supported => :tax_supported,
|
23
|
+
:countries => :countries,
|
24
|
+
:buyer_ip => :buyer_ip,
|
25
|
+
:billing_country_code => :billing_country_code,
|
26
|
+
:buyer_credit_card_prefix => :buyer_credit_card_prefix,
|
27
|
+
:evidence => :evidence
|
28
|
+
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(attributes = {})
|
33
|
+
return if attributes.empty?
|
34
|
+
# Morph attribute keys into undescored rubyish style
|
35
|
+
if attributes["tax_country_code"]
|
36
|
+
@tax_country_code = attributes["tax_country_code"]
|
37
|
+
|
38
|
+
end
|
39
|
+
if attributes["tax_deducted"]
|
40
|
+
@tax_deducted = attributes["tax_deducted"]
|
41
|
+
|
42
|
+
end
|
43
|
+
if attributes["tax_supported"]
|
44
|
+
@tax_supported = attributes["tax_supported"]
|
45
|
+
|
46
|
+
end
|
47
|
+
if attributes["countries"]
|
48
|
+
@countries = Countries.new(attributes["countries"])
|
49
|
+
|
50
|
+
end
|
51
|
+
if attributes["buyer_ip"]
|
52
|
+
@buyer_ip = attributes["buyer_ip"]
|
53
|
+
|
54
|
+
end
|
55
|
+
if attributes["billing_country_code"]
|
56
|
+
@billing_country_code = attributes["billing_country_code"]
|
57
|
+
|
58
|
+
end
|
59
|
+
if attributes["buyer_credit_card_prefix"]
|
60
|
+
@buyer_credit_card_prefix = attributes["buyer_credit_card_prefix"]
|
61
|
+
|
62
|
+
end
|
63
|
+
if attributes["evidence"]
|
64
|
+
@evidence = Evidence.new(attributes["evidence"])
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
def to_body
|
72
|
+
body = {}
|
73
|
+
self.class.attribute_map.each_pair do |key, value|
|
74
|
+
v = self.send(key)
|
75
|
+
unless v.nil?
|
76
|
+
if v.is_a?(Array)
|
77
|
+
array = Array.new
|
78
|
+
v.each do |item|
|
79
|
+
if item.respond_to?("to_body".to_sym)
|
80
|
+
array.push item.to_body
|
81
|
+
else
|
82
|
+
array.push item
|
83
|
+
end
|
84
|
+
end
|
85
|
+
body[value] = array
|
86
|
+
else
|
87
|
+
if v.respond_to?("to_body".to_sym)
|
88
|
+
body[value] = v.to_body
|
89
|
+
else
|
90
|
+
body[value] = v
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
body
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|