taxamo-ns 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +11 -0
  4. data/README.md +152 -0
  5. data/Rakefile +7 -0
  6. data/lib/monkey.rb +90 -0
  7. data/lib/swagger/configuration.rb +21 -0
  8. data/lib/swagger/request.rb +199 -0
  9. data/lib/swagger/response.rb +87 -0
  10. data/lib/swagger.rb +93 -0
  11. data/lib/taxamo/models/additionalcurrencies.rb +63 -0
  12. data/lib/taxamo/models/additionalcurrency.rb +88 -0
  13. data/lib/taxamo/models/bycountry.rb +78 -0
  14. data/lib/taxamo/models/bystatus.rb +70 -0
  15. data/lib/taxamo/models/bytaxationtype.rb +83 -0
  16. data/lib/taxamo/models/c.rb +78 -0
  17. data/lib/taxamo/models/calculatesimpletaxout.rb +75 -0
  18. data/lib/taxamo/models/calculatetaxin.rb +63 -0
  19. data/lib/taxamo/models/calculatetaxlocationout.rb +98 -0
  20. data/lib/taxamo/models/calculatetaxout.rb +75 -0
  21. data/lib/taxamo/models/canceltransactionout.rb +63 -0
  22. data/lib/taxamo/models/capturepaymentout.rb +63 -0
  23. data/lib/taxamo/models/confirmtransactionin.rb +63 -0
  24. data/lib/taxamo/models/confirmtransactionout.rb +75 -0
  25. data/lib/taxamo/models/countries.rb +113 -0
  26. data/lib/taxamo/models/country.rb +120 -0
  27. data/lib/taxamo/models/countryschema.rb +120 -0
  28. data/lib/taxamo/models/createpaymentin.rb +73 -0
  29. data/lib/taxamo/models/createpaymentout.rb +63 -0
  30. data/lib/taxamo/models/createrefundin.rb +83 -0
  31. data/lib/taxamo/models/createrefundout.rb +78 -0
  32. data/lib/taxamo/models/createsmstokenin.rb +68 -0
  33. data/lib/taxamo/models/createsmstokenout.rb +63 -0
  34. data/lib/taxamo/models/createtransactionin.rb +68 -0
  35. data/lib/taxamo/models/createtransactionout.rb +75 -0
  36. data/lib/taxamo/models/currencyschema.rb +83 -0
  37. data/lib/taxamo/models/customfields.rb +68 -0
  38. data/lib/taxamo/models/emailinvoicein.rb +63 -0
  39. data/lib/taxamo/models/emailinvoiceout.rb +63 -0
  40. data/lib/taxamo/models/emailrefundin.rb +63 -0
  41. data/lib/taxamo/models/emailrefundout.rb +63 -0
  42. data/lib/taxamo/models/evidence.rb +113 -0
  43. data/lib/taxamo/models/evidenceschema.rb +78 -0
  44. data/lib/taxamo/models/getcountriesdictout.rb +64 -0
  45. data/lib/taxamo/models/getcurrenciesdictout.rb +64 -0
  46. data/lib/taxamo/models/getdailysettlementstatsout.rb +64 -0
  47. data/lib/taxamo/models/getdetailedrefundsout.rb +64 -0
  48. data/lib/taxamo/models/getdomesticsummaryreportout.rb +123 -0
  49. data/lib/taxamo/models/geteuviesreportout.rb +79 -0
  50. data/lib/taxamo/models/getproducttypesdictout.rb +64 -0
  51. data/lib/taxamo/models/getrefundsout.rb +64 -0
  52. data/lib/taxamo/models/getsettlementout.rb +84 -0
  53. data/lib/taxamo/models/getsettlementstatsbycountryout.rb +64 -0
  54. data/lib/taxamo/models/getsettlementstatsbytaxationtypeout.rb +63 -0
  55. data/lib/taxamo/models/getsettlementsummaryout.rb +63 -0
  56. data/lib/taxamo/models/gettransactionout.rb +75 -0
  57. data/lib/taxamo/models/gettransactionsstatsbycountryout.rb +64 -0
  58. data/lib/taxamo/models/gettransactionsstatsout.rb +63 -0
  59. data/lib/taxamo/models/inputtransaction.rb +220 -0
  60. data/lib/taxamo/models/inputtransactionline.rb +144 -0
  61. data/lib/taxamo/models/inputtransactionupdate.rb +220 -0
  62. data/lib/taxamo/models/invoiceaddress.rb +98 -0
  63. data/lib/taxamo/models/listpaymentsout.rb +64 -0
  64. data/lib/taxamo/models/listrefundsout.rb +64 -0
  65. data/lib/taxamo/models/listtransactionsout.rb +64 -0
  66. data/lib/taxamo/models/locategivenipout.rb +73 -0
  67. data/lib/taxamo/models/locatemyipout.rb +73 -0
  68. data/lib/taxamo/models/n.rb +78 -0
  69. data/lib/taxamo/models/payments.rb +73 -0
  70. data/lib/taxamo/models/producttypeschema.rb +63 -0
  71. data/lib/taxamo/models/refunds.rb +108 -0
  72. data/lib/taxamo/models/report.rb +103 -0
  73. data/lib/taxamo/models/settlementdailystatsschema.rb +103 -0
  74. data/lib/taxamo/models/storagerequiredfields.rb +63 -0
  75. data/lib/taxamo/models/summary.rb +98 -0
  76. data/lib/taxamo/models/taxdataschema.rb +63 -0
  77. data/lib/taxamo/models/taxrequiredfields.rb +63 -0
  78. data/lib/taxamo/models/transaction.rb +330 -0
  79. data/lib/taxamo/models/transactionlines.rb +174 -0
  80. data/lib/taxamo/models/transactions.rb +330 -0
  81. data/lib/taxamo/models/unconfirmtransactionin.rb +63 -0
  82. data/lib/taxamo/models/unconfirmtransactionout.rb +75 -0
  83. data/lib/taxamo/models/updatetransactionin.rb +63 -0
  84. data/lib/taxamo/models/updatetransactionout.rb +75 -0
  85. data/lib/taxamo/models/ustaxexemptioncertificatedetailsschema.rb +139 -0
  86. data/lib/taxamo/models/ustaxexemptioncertificateschema.rb +68 -0
  87. data/lib/taxamo/models/ustaxexemptstate.rb +73 -0
  88. data/lib/taxamo/models/ustaxid.rb +73 -0
  89. data/lib/taxamo/models/validatetaxnumberout.rb +78 -0
  90. data/lib/taxamo/models/verifysmstokenout.rb +63 -0
  91. data/lib/taxamo/version.rb +17 -0
  92. data/lib/taxamo.rb +1215 -0
  93. data/taxamo.gemspec +28 -0
  94. data/test/taxamo/connectivity_test.rb +55 -0
  95. data/test/taxamo/tax_test.rb +152 -0
  96. data/test/taxamo/transactions_api_test.rb +326 -0
  97. 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 TaxDataSchema
15
+ attr_accessor :us_tax_exemption_certificate
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :us_tax_exemption_certificate => :us_tax_exemption_certificate
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["us_tax_exemption_certificate"]
29
+ @us_tax_exemption_certificate = UsTaxExemptionCertificateSchema.new(attributes["us_tax_exemption_certificate"])
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,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 TaxRequiredFields
15
+ attr_accessor :field_name
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :field_name => :field_name
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["field_name"]
29
+ @field_name = attributes["field_name"]
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,330 @@
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 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, :invoice_image_url, :key, :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
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :confirm_timestamp => :confirm_timestamp,
21
+ :fully_informative => :fully_informative,
22
+ :deducted_tax_amount => :deducted_tax_amount,
23
+ :order_date_type => :order_date_type,
24
+ :buyer_credit_card_prefix => :buyer_credit_card_prefix,
25
+ :custom_data => :custom_data,
26
+ :buyer_name => :buyer_name,
27
+ :invoice_date => :invoice_date,
28
+ :create_timestamp => :create_timestamp,
29
+ :currency_code => :currency_code,
30
+ :sub_account_id => :sub_account_id,
31
+ :supply_date => :supply_date,
32
+ :invoice_image_url => :invoice_image_url,
33
+ :key => :key,
34
+ :tax_number_service => :tax_number_service,
35
+ :invoice_address => :invoice_address,
36
+ :buyer_tax_number_valid => :buyer_tax_number_valid,
37
+ :verification_token => :verification_token,
38
+ :note => :note,
39
+ :tax_supported => :tax_supported,
40
+ :tax_data => :tax_data,
41
+ :transaction_lines => :transaction_lines,
42
+ :buyer_tax_number => :buyer_tax_number,
43
+ :external_key => :external_key,
44
+ :status => :status,
45
+ :custom_fields => :custom_fields,
46
+ :force_country_code => :force_country_code,
47
+ :countries => :countries,
48
+ :invoice_number => :invoice_number,
49
+ :order_date => :order_date,
50
+ :customer_id => :customer_id,
51
+ :kind => :kind,
52
+ :source => :source,
53
+ :amount => :amount,
54
+ :comments => :comments,
55
+ :buyer_ip => :buyer_ip,
56
+ :buyer_email => :buyer_email,
57
+ :original_transaction_key => :original_transaction_key,
58
+ :billing_country_code => :billing_country_code,
59
+ :custom_id => :custom_id,
60
+ :tax_amount => :tax_amount,
61
+ :additional_currencies => :additional_currencies,
62
+ :invoice_place => :invoice_place,
63
+ :total_amount => :total_amount,
64
+ :tax_entity_name => :tax_entity_name,
65
+ :evidence => :evidence,
66
+ :refunded_tax_amount => :refunded_tax_amount,
67
+ :manual => :manual,
68
+ :tax_timezone => :tax_timezone,
69
+ :description => :description,
70
+ :test => :test,
71
+ :tax_deducted => :tax_deducted,
72
+ :tax_country_code => :tax_country_code,
73
+ :refunded_total_amount => :refunded_total_amount
74
+
75
+ }
76
+ end
77
+
78
+ def initialize(attributes = {})
79
+ return if attributes.empty?
80
+ # Morph attribute keys into undescored rubyish style
81
+ if attributes["confirm_timestamp"]
82
+ @confirm_timestamp = attributes["confirm_timestamp"]
83
+
84
+ end
85
+ if attributes["fully_informative"]
86
+ @fully_informative = attributes["fully_informative"]
87
+
88
+ end
89
+ if attributes["deducted_tax_amount"]
90
+ @deducted_tax_amount = attributes["deducted_tax_amount"]
91
+
92
+ end
93
+ if attributes["order_date_type"]
94
+ @order_date_type = attributes["order_date_type"]
95
+
96
+ end
97
+ if attributes["buyer_credit_card_prefix"]
98
+ @buyer_credit_card_prefix = attributes["buyer_credit_card_prefix"]
99
+
100
+ end
101
+ if attributes["custom_data"]
102
+ @custom_data = attributes["custom_data"]
103
+
104
+ end
105
+ if attributes["buyer_name"]
106
+ @buyer_name = attributes["buyer_name"]
107
+
108
+ end
109
+ if attributes["invoice_date"]
110
+ @invoice_date = attributes["invoice_date"]
111
+
112
+ end
113
+ if attributes["create_timestamp"]
114
+ @create_timestamp = attributes["create_timestamp"]
115
+
116
+ end
117
+ if attributes["currency_code"]
118
+ @currency_code = attributes["currency_code"]
119
+
120
+ end
121
+ if attributes["sub_account_id"]
122
+ @sub_account_id = attributes["sub_account_id"]
123
+
124
+ end
125
+ if attributes["supply_date"]
126
+ @supply_date = attributes["supply_date"]
127
+
128
+ end
129
+ if attributes["invoice_image_url"]
130
+ @invoice_image_url = attributes["invoice_image_url"]
131
+
132
+ end
133
+ if attributes["key"]
134
+ @key = attributes["key"]
135
+
136
+ end
137
+ if attributes["tax_number_service"]
138
+ @tax_number_service = attributes["tax_number_service"]
139
+
140
+ end
141
+ if attributes["invoice_address"]
142
+ @invoice_address = InvoiceAddress.new(attributes["invoice_address"])
143
+
144
+ end
145
+ if attributes["buyer_tax_number_valid"]
146
+ @buyer_tax_number_valid = attributes["buyer_tax_number_valid"]
147
+
148
+ end
149
+ if attributes["verification_token"]
150
+ @verification_token = attributes["verification_token"]
151
+
152
+ end
153
+ if attributes["note"]
154
+ @note = attributes["note"]
155
+
156
+ end
157
+ if attributes["tax_supported"]
158
+ @tax_supported = attributes["tax_supported"]
159
+
160
+ end
161
+ if attributes["tax_data"]
162
+ @tax_data = TaxDataSchema.new(attributes["tax_data"])
163
+
164
+ end
165
+ if attributes["transaction_lines"]
166
+ if (value = attributes["transaction_lines"]).is_a?(Array)
167
+ @transaction_lines = value.map{ |v| TransactionLines.new(v) }
168
+ end
169
+ end
170
+ if attributes["buyer_tax_number"]
171
+ @buyer_tax_number = attributes["buyer_tax_number"]
172
+
173
+ end
174
+ if attributes["external_key"]
175
+ @external_key = attributes["external_key"]
176
+
177
+ end
178
+ if attributes["status"]
179
+ @status = attributes["status"]
180
+
181
+ end
182
+ if attributes["custom_fields"]
183
+ if (value = attributes["custom_fields"]).is_a?(Array)
184
+ @custom_fields = value.map{ |v| CustomFields.new(v) }
185
+ end
186
+ end
187
+ if attributes["force_country_code"]
188
+ @force_country_code = attributes["force_country_code"]
189
+
190
+ end
191
+ if attributes["countries"]
192
+ @countries = Countries.new(attributes["countries"])
193
+
194
+ end
195
+ if attributes["invoice_number"]
196
+ @invoice_number = attributes["invoice_number"]
197
+
198
+ end
199
+ if attributes["order_date"]
200
+ @order_date = attributes["order_date"]
201
+
202
+ end
203
+ if attributes["customer_id"]
204
+ @customer_id = attributes["customer_id"]
205
+
206
+ end
207
+ if attributes["kind"]
208
+ @kind = attributes["kind"]
209
+
210
+ end
211
+ if attributes["source"]
212
+ @source = attributes["source"]
213
+
214
+ end
215
+ if attributes["amount"]
216
+ @amount = attributes["amount"]
217
+
218
+ end
219
+ if attributes["comments"]
220
+ @comments = attributes["comments"]
221
+
222
+ end
223
+ if attributes["buyer_ip"]
224
+ @buyer_ip = attributes["buyer_ip"]
225
+
226
+ end
227
+ if attributes["buyer_email"]
228
+ @buyer_email = attributes["buyer_email"]
229
+
230
+ end
231
+ if attributes["original_transaction_key"]
232
+ @original_transaction_key = attributes["original_transaction_key"]
233
+
234
+ end
235
+ if attributes["billing_country_code"]
236
+ @billing_country_code = attributes["billing_country_code"]
237
+
238
+ end
239
+ if attributes["custom_id"]
240
+ @custom_id = attributes["custom_id"]
241
+
242
+ end
243
+ if attributes["tax_amount"]
244
+ @tax_amount = attributes["tax_amount"]
245
+
246
+ end
247
+ if attributes["additional_currencies"]
248
+ @additional_currencies = AdditionalCurrencies.new(attributes["additional_currencies"])
249
+
250
+ end
251
+ if attributes["invoice_place"]
252
+ @invoice_place = attributes["invoice_place"]
253
+
254
+ end
255
+ if attributes["total_amount"]
256
+ @total_amount = attributes["total_amount"]
257
+
258
+ end
259
+ if attributes["tax_entity_name"]
260
+ @tax_entity_name = attributes["tax_entity_name"]
261
+
262
+ end
263
+ if attributes["evidence"]
264
+ @evidence = Evidence.new(attributes["evidence"])
265
+
266
+ end
267
+ if attributes["refunded_tax_amount"]
268
+ @refunded_tax_amount = attributes["refunded_tax_amount"]
269
+
270
+ end
271
+ if attributes["manual"]
272
+ @manual = attributes["manual"]
273
+
274
+ end
275
+ if attributes["tax_timezone"]
276
+ @tax_timezone = attributes["tax_timezone"]
277
+
278
+ end
279
+ if attributes["description"]
280
+ @description = attributes["description"]
281
+
282
+ end
283
+ if attributes["test"]
284
+ @test = attributes["test"]
285
+
286
+ end
287
+ if attributes["tax_deducted"]
288
+ @tax_deducted = attributes["tax_deducted"]
289
+
290
+ end
291
+ if attributes["tax_country_code"]
292
+ @tax_country_code = attributes["tax_country_code"]
293
+
294
+ end
295
+ if attributes["refunded_total_amount"]
296
+ @refunded_total_amount = attributes["refunded_total_amount"]
297
+
298
+ end
299
+
300
+
301
+ end
302
+
303
+ def to_body
304
+ body = {}
305
+ self.class.attribute_map.each_pair do |key, value|
306
+ v = self.send(key)
307
+ unless v.nil?
308
+ if v.is_a?(Array)
309
+ array = Array.new
310
+ v.each do |item|
311
+ if item.respond_to?("to_body".to_sym)
312
+ array.push item.to_body
313
+ else
314
+ array.push item
315
+ end
316
+ end
317
+ body[value] = array
318
+ else
319
+ if v.respond_to?("to_body".to_sym)
320
+ body[value] = v.to_body
321
+ else
322
+ body[value] = v
323
+ end
324
+ end
325
+ end
326
+ end
327
+ body
328
+ end
329
+ end
330
+ end
@@ -0,0 +1,174 @@
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 TransactionLines
15
+ attr_accessor :product_type, :deducted_tax_amount, :deducted_tax_rate, :supply_date, :id, :unit_price, :unit_of_measure, :quantity, :custom_fields, :line_key, :tax_name, :product_code, :amount, :custom_id, :informative, :tax_amount, :tax_rate, :additional_currencies, :total_amount, :product_tax_code, :refunded_tax_amount, :description, :refunded_total_amount
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :product_type => :product_type,
21
+ :deducted_tax_amount => :deducted_tax_amount,
22
+ :deducted_tax_rate => :deducted_tax_rate,
23
+ :supply_date => :supply_date,
24
+ :id => :id,
25
+ :unit_price => :unit_price,
26
+ :unit_of_measure => :unit_of_measure,
27
+ :quantity => :quantity,
28
+ :custom_fields => :custom_fields,
29
+ :line_key => :line_key,
30
+ :tax_name => :tax_name,
31
+ :product_code => :product_code,
32
+ :amount => :amount,
33
+ :custom_id => :custom_id,
34
+ :informative => :informative,
35
+ :tax_amount => :tax_amount,
36
+ :tax_rate => :tax_rate,
37
+ :additional_currencies => :additional_currencies,
38
+ :total_amount => :total_amount,
39
+ :product_tax_code => :product_tax_code,
40
+ :refunded_tax_amount => :refunded_tax_amount,
41
+ :description => :description,
42
+ :refunded_total_amount => :refunded_total_amount
43
+
44
+ }
45
+ end
46
+
47
+ def initialize(attributes = {})
48
+ return if attributes.empty?
49
+ # Morph attribute keys into undescored rubyish style
50
+ if attributes["product_type"]
51
+ @product_type = attributes["product_type"]
52
+
53
+ end
54
+ if attributes["deducted_tax_amount"]
55
+ @deducted_tax_amount = attributes["deducted_tax_amount"]
56
+
57
+ end
58
+ if attributes["deducted_tax_rate"]
59
+ @deducted_tax_rate = attributes["deducted_tax_rate"]
60
+
61
+ end
62
+ if attributes["supply_date"]
63
+ @supply_date = attributes["supply_date"]
64
+
65
+ end
66
+ if attributes["id"]
67
+ @id = attributes["id"]
68
+
69
+ end
70
+ if attributes["unit_price"]
71
+ @unit_price = attributes["unit_price"]
72
+
73
+ end
74
+ if attributes["unit_of_measure"]
75
+ @unit_of_measure = attributes["unit_of_measure"]
76
+
77
+ end
78
+ if attributes["quantity"]
79
+ @quantity = attributes["quantity"]
80
+
81
+ end
82
+ if attributes["custom_fields"]
83
+ if (value = attributes["custom_fields"]).is_a?(Array)
84
+ @custom_fields = value.map{ |v| CustomFields.new(v) }
85
+ end
86
+ end
87
+ if attributes["line_key"]
88
+ @line_key = attributes["line_key"]
89
+
90
+ end
91
+ if attributes["tax_name"]
92
+ @tax_name = attributes["tax_name"]
93
+
94
+ end
95
+ if attributes["product_code"]
96
+ @product_code = attributes["product_code"]
97
+
98
+ end
99
+ if attributes["amount"]
100
+ @amount = attributes["amount"]
101
+
102
+ end
103
+ if attributes["custom_id"]
104
+ @custom_id = attributes["custom_id"]
105
+
106
+ end
107
+ if attributes["informative"]
108
+ @informative = attributes["informative"]
109
+
110
+ end
111
+ if attributes["tax_amount"]
112
+ @tax_amount = attributes["tax_amount"]
113
+
114
+ end
115
+ if attributes["tax_rate"]
116
+ @tax_rate = attributes["tax_rate"]
117
+
118
+ end
119
+ if attributes["additional_currencies"]
120
+ @additional_currencies = AdditionalCurrencies.new(attributes["additional_currencies"])
121
+
122
+ end
123
+ if attributes["total_amount"]
124
+ @total_amount = attributes["total_amount"]
125
+
126
+ end
127
+ if attributes["product_tax_code"]
128
+ @product_tax_code = attributes["product_tax_code"]
129
+
130
+ end
131
+ if attributes["refunded_tax_amount"]
132
+ @refunded_tax_amount = attributes["refunded_tax_amount"]
133
+
134
+ end
135
+ if attributes["description"]
136
+ @description = attributes["description"]
137
+
138
+ end
139
+ if attributes["refunded_total_amount"]
140
+ @refunded_total_amount = attributes["refunded_total_amount"]
141
+
142
+ end
143
+
144
+
145
+ end
146
+
147
+ def to_body
148
+ body = {}
149
+ self.class.attribute_map.each_pair do |key, value|
150
+ v = self.send(key)
151
+ unless v.nil?
152
+ if v.is_a?(Array)
153
+ array = Array.new
154
+ v.each do |item|
155
+ if item.respond_to?("to_body".to_sym)
156
+ array.push item.to_body
157
+ else
158
+ array.push item
159
+ end
160
+ end
161
+ body[value] = array
162
+ else
163
+ if v.respond_to?("to_body".to_sym)
164
+ body[value] = v.to_body
165
+ else
166
+ body[value] = v
167
+ end
168
+ end
169
+ end
170
+ end
171
+ body
172
+ end
173
+ end
174
+ end