Class: Taxamo::Transaction

Inherits:
Object show all
Defined in:
lib/taxamo/models/transaction.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Transaction

Returns a new instance of Transaction.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/taxamo/models/transaction.rb', line 83

def initialize(attributes = {})
  return if attributes.nil? or attributes.empty?
  # Morph attribute keys into undescored rubyish style
  if attributes.key?("confirm_timestamp")
    @confirm_timestamp = attributes["confirm_timestamp"]
      
  end
  if attributes.key?("fully_informative")
    @fully_informative = attributes["fully_informative"]
      
  end
  if attributes.key?("deducted_tax_amount")
    @deducted_tax_amount = attributes["deducted_tax_amount"]
      
  end
  if attributes.key?("order_date_type")
    @order_date_type = attributes["order_date_type"]
      
  end
  if attributes.key?("buyer_credit_card_prefix")
    @buyer_credit_card_prefix = attributes["buyer_credit_card_prefix"]
      
  end
  if attributes.key?("custom_data")
    @custom_data = attributes["custom_data"]
      
  end
  if attributes.key?("buyer_name")
    @buyer_name = attributes["buyer_name"]
      
  end
  if attributes.key?("invoice_date")
    @invoice_date = attributes["invoice_date"]
      
  end
  if attributes.key?("create_timestamp")
    @create_timestamp = attributes["create_timestamp"]
      
  end
  if attributes.key?("currency_code")
    @currency_code = attributes["currency_code"]
      
  end
  if attributes.key?("sub_account_id")
     = attributes["sub_account_id"]
      
  end
  if attributes.key?("supply_date")
    @supply_date = attributes["supply_date"]
      
  end
  if attributes.key?("buyer_tax_number_normalized")
    @buyer_tax_number_normalized = attributes["buyer_tax_number_normalized"]
      
  end
  if attributes.key?("invoice_image_url")
    @invoice_image_url = attributes["invoice_image_url"]
      
  end
  if attributes.key?("key")
    @key = attributes["key"]
      
  end
  if attributes.key?("buyer_tax_number_format_valid")
    @buyer_tax_number_format_valid = attributes["buyer_tax_number_format_valid"]
      
  end
  if attributes.key?("tax_number_service")
    @tax_number_service = attributes["tax_number_service"]
      
  end
  if attributes.key?("control_flags")
    if (value = attributes["control_flags"]).is_a?(Array)
        @control_flags = value.map{ |v| ControlFlags.new(v) }
      end
    end
  if attributes.key?("invoice_address")
    @invoice_address = InvoiceAddress.new(attributes["invoice_address"])
      
  end
  if attributes.key?("buyer_tax_number_valid")
    @buyer_tax_number_valid = attributes["buyer_tax_number_valid"]
      
  end
  if attributes.key?("verification_token")
    @verification_token = attributes["verification_token"]
      
  end
  if attributes.key?("note")
    @note = attributes["note"]
      
  end
  if attributes.key?("tax_supported")
    @tax_supported = attributes["tax_supported"]
      
  end
  if attributes.key?("tax_data")
    @tax_data = TaxDataSchema.new(attributes["tax_data"])
      
  end
  if attributes.key?("transaction_lines")
    if (value = attributes["transaction_lines"]).is_a?(Array)
        @transaction_lines = value.map{ |v| TransactionLines.new(v) }
      end
    end
  if attributes.key?("buyer_tax_number")
    @buyer_tax_number = attributes["buyer_tax_number"]
      
  end
  if attributes.key?("external_key")
    @external_key = attributes["external_key"]
      
  end
  if attributes.key?("status")
    @status = attributes["status"]
      
  end
  if attributes.key?("custom_fields")
    if (value = attributes["custom_fields"]).is_a?(Array)
        @custom_fields = value.map{ |v| CustomFields.new(v) }
      end
    end
  if attributes.key?("force_country_code")
    @force_country_code = attributes["force_country_code"]
      
  end
  if attributes.key?("countries")
    @countries = Countries.new(attributes["countries"])
      
  end
  if attributes.key?("invoice_number")
    @invoice_number = attributes["invoice_number"]
      
  end
  if attributes.key?("order_date")
    @order_date = attributes["order_date"]
      
  end
  if attributes.key?("customer_id")
    @customer_id = attributes["customer_id"]
      
  end
  if attributes.key?("kind")
    @kind = attributes["kind"]
      
  end
  if attributes.key?("source")
    @source = attributes["source"]
      
  end
  if attributes.key?("amount")
    @amount = attributes["amount"]
      
  end
  if attributes.key?("comments")
    @comments = attributes["comments"]
      
  end
  if attributes.key?("buyer_ip")
    @buyer_ip = attributes["buyer_ip"]
      
  end
  if attributes.key?("buyer_email")
    @buyer_email = attributes["buyer_email"]
      
  end
  if attributes.key?("original_transaction_key")
    @original_transaction_key = attributes["original_transaction_key"]
      
  end
  if attributes.key?("billing_country_code")
    @billing_country_code = attributes["billing_country_code"]
      
  end
  if attributes.key?("custom_id")
    @custom_id = attributes["custom_id"]
      
  end
  if attributes.key?("tax_amount")
    @tax_amount = attributes["tax_amount"]
      
  end
  if attributes.key?("tax_entity_additional_id")
    @tax_entity_additional_id = attributes["tax_entity_additional_id"]
      
  end
  if attributes.key?("warnings")
    if (value = attributes["warnings"]).is_a?(Array)
        @warnings = value.map{ |v| Warnings.new(v) }
      end
    end
  if attributes.key?("additional_currencies")
    @additional_currencies = AdditionalCurrencies.new(attributes["additional_currencies"])
      
  end
  if attributes.key?("invoice_place")
    @invoice_place = attributes["invoice_place"]
      
  end
  if attributes.key?("total_amount")
    @total_amount = attributes["total_amount"]
      
  end
  if attributes.key?("tax_entity_name")
    @tax_entity_name = attributes["tax_entity_name"]
      
  end
  if attributes.key?("evidence")
    @evidence = Evidence.new(attributes["evidence"])
      
  end
  if attributes.key?("refunded_tax_amount")
    @refunded_tax_amount = attributes["refunded_tax_amount"]
      
  end
  if attributes.key?("manual")
    @manual = attributes["manual"]
      
  end
  if attributes.key?("tax_timezone")
    @tax_timezone = attributes["tax_timezone"]
      
  end
  if attributes.key?("description")
    @description = attributes["description"]
      
  end
  if attributes.key?("test")
    @test = attributes["test"]
      
  end
  if attributes.key?("tax_deducted")
    @tax_deducted = attributes["tax_deducted"]
      
  end
  if attributes.key?("tax_country_code")
    @tax_country_code = attributes["tax_country_code"]
      
  end
  if attributes.key?("refunded_total_amount")
    @refunded_total_amount = attributes["refunded_total_amount"]
      
  end
  

end

Instance Attribute Details

#additional_currenciesObject

Returns the value of attribute additional_currencies.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def additional_currencies
  @additional_currencies
end

#amountObject

Returns the value of attribute amount.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def amount
  @amount
end

#billing_country_codeObject

Returns the value of attribute billing_country_code.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def billing_country_code
  @billing_country_code
end

#buyer_credit_card_prefixObject

Returns the value of attribute buyer_credit_card_prefix.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_credit_card_prefix
  @buyer_credit_card_prefix
end

#buyer_emailObject

Returns the value of attribute buyer_email.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_email
  @buyer_email
end

#buyer_ipObject

Returns the value of attribute buyer_ip.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_ip
  @buyer_ip
end

#buyer_nameObject

Returns the value of attribute buyer_name.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_name
  @buyer_name
end

#buyer_tax_numberObject

Returns the value of attribute buyer_tax_number.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_tax_number
  @buyer_tax_number
end

#buyer_tax_number_format_validObject

Returns the value of attribute buyer_tax_number_format_valid.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_tax_number_format_valid
  @buyer_tax_number_format_valid
end

#buyer_tax_number_normalizedObject

Returns the value of attribute buyer_tax_number_normalized.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_tax_number_normalized
  @buyer_tax_number_normalized
end

#buyer_tax_number_validObject

Returns the value of attribute buyer_tax_number_valid.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def buyer_tax_number_valid
  @buyer_tax_number_valid
end

#commentsObject

Returns the value of attribute comments.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def comments
  @comments
end

#confirm_timestampObject

Returns the value of attribute confirm_timestamp.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def confirm_timestamp
  @confirm_timestamp
end

#control_flagsObject

Returns the value of attribute control_flags.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def control_flags
  @control_flags
end

#countriesObject

Returns the value of attribute countries.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def countries
  @countries
end

#create_timestampObject

Returns the value of attribute create_timestamp.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def create_timestamp
  @create_timestamp
end

#currency_codeObject

Returns the value of attribute currency_code.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def currency_code
  @currency_code
end

#custom_dataObject

Returns the value of attribute custom_data.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def custom_data
  @custom_data
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def custom_fields
  @custom_fields
end

#custom_idObject

Returns the value of attribute custom_id.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def custom_id
  @custom_id
end

#customer_idObject

Returns the value of attribute customer_id.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def customer_id
  @customer_id
end

#deducted_tax_amountObject

Returns the value of attribute deducted_tax_amount.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def deducted_tax_amount
  @deducted_tax_amount
end

#descriptionObject

Returns the value of attribute description.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def description
  @description
end

#evidenceObject

Returns the value of attribute evidence.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def evidence
  @evidence
end

#external_keyObject

Returns the value of attribute external_key.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def external_key
  @external_key
end

#force_country_codeObject

Returns the value of attribute force_country_code.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def force_country_code
  @force_country_code
end

#fully_informativeObject

Returns the value of attribute fully_informative.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def fully_informative
  @fully_informative
end

#invoice_addressObject

Returns the value of attribute invoice_address.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def invoice_address
  @invoice_address
end

#invoice_dateObject

Returns the value of attribute invoice_date.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def invoice_date
  @invoice_date
end

#invoice_image_urlObject

Returns the value of attribute invoice_image_url.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def invoice_image_url
  @invoice_image_url
end

#invoice_numberObject

Returns the value of attribute invoice_number.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def invoice_number
  @invoice_number
end

#invoice_placeObject

Returns the value of attribute invoice_place.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def invoice_place
  @invoice_place
end

#keyObject

Returns the value of attribute key.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def key
  @key
end

#kindObject

Returns the value of attribute kind.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def kind
  @kind
end

#manualObject

Returns the value of attribute manual.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def manual
  @manual
end

#noteObject

Returns the value of attribute note.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def note
  @note
end

#order_dateObject

Returns the value of attribute order_date.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def order_date
  @order_date
end

#order_date_typeObject

Returns the value of attribute order_date_type.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def order_date_type
  @order_date_type
end

#original_transaction_keyObject

Returns the value of attribute original_transaction_key.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def original_transaction_key
  @original_transaction_key
end

#refunded_tax_amountObject

Returns the value of attribute refunded_tax_amount.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def refunded_tax_amount
  @refunded_tax_amount
end

#refunded_total_amountObject

Returns the value of attribute refunded_total_amount.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def refunded_total_amount
  @refunded_total_amount
end

#sourceObject

Returns the value of attribute source.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def source
  @source
end

#statusObject

Returns the value of attribute status.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def status
  @status
end

#sub_account_idObject

Returns the value of attribute sub_account_id.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def 
  
end

#supply_dateObject

Returns the value of attribute supply_date.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def supply_date
  @supply_date
end

#tax_amountObject

Returns the value of attribute tax_amount.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_amount
  @tax_amount
end

#tax_country_codeObject

Returns the value of attribute tax_country_code.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_country_code
  @tax_country_code
end

#tax_dataObject

Returns the value of attribute tax_data.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_data
  @tax_data
end

#tax_deductedObject

Returns the value of attribute tax_deducted.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_deducted
  @tax_deducted
end

#tax_entity_additional_idObject

Returns the value of attribute tax_entity_additional_id.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_entity_additional_id
  @tax_entity_additional_id
end

#tax_entity_nameObject

Returns the value of attribute tax_entity_name.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_entity_name
  @tax_entity_name
end

#tax_number_serviceObject

Returns the value of attribute tax_number_service.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_number_service
  @tax_number_service
end

#tax_supportedObject

Returns the value of attribute tax_supported.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_supported
  @tax_supported
end

#tax_timezoneObject

Returns the value of attribute tax_timezone.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def tax_timezone
  @tax_timezone
end

#testObject

Returns the value of attribute test.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def test
  @test
end

#total_amountObject

Returns the value of attribute total_amount.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def total_amount
  @total_amount
end

#transaction_linesObject

Returns the value of attribute transaction_lines.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def transaction_lines
  @transaction_lines
end

#verification_tokenObject

Returns the value of attribute verification_token.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def verification_token
  @verification_token
end

#warningsObject

Returns the value of attribute warnings.



15
16
17
# File 'lib/taxamo/models/transaction.rb', line 15

def warnings
  @warnings
end

Class Method Details

.attribute_mapObject

:internal => :external



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/taxamo/models/transaction.rb', line 18

def self.attribute_map
  {
    :confirm_timestamp => :confirm_timestamp,
    :fully_informative => :fully_informative,
    :deducted_tax_amount => :deducted_tax_amount,
    :order_date_type => :order_date_type,
    :buyer_credit_card_prefix => :buyer_credit_card_prefix,
    :custom_data => :custom_data,
    :buyer_name => :buyer_name,
    :invoice_date => :invoice_date,
    :create_timestamp => :create_timestamp,
    :currency_code => :currency_code,
    :sub_account_id => :sub_account_id,
    :supply_date => :supply_date,
    :buyer_tax_number_normalized => :buyer_tax_number_normalized,
    :invoice_image_url => :invoice_image_url,
    :key => :key,
    :buyer_tax_number_format_valid => :buyer_tax_number_format_valid,
    :tax_number_service => :tax_number_service,
    :control_flags => :control_flags,
    :invoice_address => :invoice_address,
    :buyer_tax_number_valid => :buyer_tax_number_valid,
    :verification_token => :verification_token,
    :note => :note,
    :tax_supported => :tax_supported,
    :tax_data => :tax_data,
    :transaction_lines => :transaction_lines,
    :buyer_tax_number => :buyer_tax_number,
    :external_key => :external_key,
    :status => :status,
    :custom_fields => :custom_fields,
    :force_country_code => :force_country_code,
    :countries => :countries,
    :invoice_number => :invoice_number,
    :order_date => :order_date,
    :customer_id => :customer_id,
    :kind => :kind,
    :source => :source,
    :amount => :amount,
    :comments => :comments,
    :buyer_ip => :buyer_ip,
    :buyer_email => :buyer_email,
    :original_transaction_key => :original_transaction_key,
    :billing_country_code => :billing_country_code,
    :custom_id => :custom_id,
    :tax_amount => :tax_amount,
    :tax_entity_additional_id => :tax_entity_additional_id,
    :warnings => :warnings,
    :additional_currencies => :additional_currencies,
    :invoice_place => :invoice_place,
    :total_amount => :total_amount,
    :tax_entity_name => :tax_entity_name,
    :evidence => :evidence,
    :refunded_tax_amount => :refunded_tax_amount,
    :manual => :manual,
    :tax_timezone => :tax_timezone,
    :description => :description,
    :test => :test,
    :tax_deducted => :tax_deducted,
    :tax_country_code => :tax_country_code,
    :refunded_total_amount => :refunded_total_amount

  }
end

Instance Method Details

#to_bodyObject



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/taxamo/models/transaction.rb', line 330

def to_body
  body = {}
  self.class.attribute_map.each_pair do |key, value|
    v = self.send(key)
    unless v.nil?
      if v.is_a?(Array)
        array = Array.new
        v.each do |item|
          if item.respond_to?("to_body".to_sym)
            array.push item.to_body
          else
            array.push item
          end
        end
        body[value] = array
      else
        if v.respond_to?("to_body".to_sym)
          body[value] = v.to_body
        else
          body[value] = v
        end
      end
    end
  end
  body
end