Class: Bfwd::Invoice

Inherits:
Object
  • Object
show all
Defined in:
lib/bf_ruby2/models/invoice.rb

Overview

An invoice encapsulates the cumulative charges of a subscription’s pricing-components and their respective pricing-component-values for a specific period of time.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Invoice

Initializes the object



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
329
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/bf_ruby2/models/invoice.rb', line 300

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.has_key?(:'changedBy')
    self.changed_by = attributes[:'changedBy']
  end

  if attributes.has_key?(:'updated')
    self.updated = attributes[:'updated']
  end

  if attributes.has_key?(:'versionID')
    self.version_id = attributes[:'versionID']
  end

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'crmID')
    self.crm_id = attributes[:'crmID']
  end

  if attributes.has_key?(:'subscriptionID')
    self.subscription_id = attributes[:'subscriptionID']
  end

  if attributes.has_key?(:'subscriptionVersionID')
    self.subscription_version_id = attributes[:'subscriptionVersionID']
  end

  if attributes.has_key?(:'accountID')
    self. = attributes[:'accountID']
  end

  if attributes.has_key?(:'organizationID')
    self.organization_id = attributes[:'organizationID']
  end

  if attributes.has_key?(:'parentInvoiceID')
    self.parent_invoice_id = attributes[:'parentInvoiceID']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.has_key?(:'issued')
    self.issued = attributes[:'issued']
  end

  if attributes.has_key?(:'periodStart')
    self.period_start = attributes[:'periodStart']
  end

  if attributes.has_key?(:'periodEnd')
    self.period_end = attributes[:'periodEnd']
  end

  if attributes.has_key?(:'due')
    self.due = attributes[:'due']
  end

  if attributes.has_key?(:'deleted')
    self.deleted = attributes[:'deleted']
  else
    self.deleted = false
  end

  if attributes.has_key?(:'totalExecutionAttempts')
    self.total_execution_attempts = attributes[:'totalExecutionAttempts']
  end

  if attributes.has_key?(:'lastExecutionAttempt')
    self.last_execution_attempt = attributes[:'lastExecutionAttempt']
  end

  if attributes.has_key?(:'nextExecutionAttempt')
    self.next_execution_attempt = attributes[:'nextExecutionAttempt']
  end

  if attributes.has_key?(:'finalExecutionAttempt')
    self.final_execution_attempt = attributes[:'finalExecutionAttempt']
  end

  if attributes.has_key?(:'paymentReceived')
    self.payment_received = attributes[:'paymentReceived']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'costExcludingTax')
    self.cost_excluding_tax = attributes[:'costExcludingTax']
  end

  if attributes.has_key?(:'invoiceCost')
    self.invoice_cost = attributes[:'invoiceCost']
  end

  if attributes.has_key?(:'nonDiscountedCost')
    self.non_discounted_cost = attributes[:'nonDiscountedCost']
  end

  if attributes.has_key?(:'nonDiscountedCostExcludingTax')
    self.non_discounted_cost_excluding_tax = attributes[:'nonDiscountedCostExcludingTax']
  end

  if attributes.has_key?(:'invoicePaid')
    self.invoice_paid = attributes[:'invoicePaid']
  end

  if attributes.has_key?(:'discountAmount')
    self.discount_amount = attributes[:'discountAmount']
  end

  if attributes.has_key?(:'discountAmountExcludingTax')
    self.discount_amount_excluding_tax = attributes[:'discountAmountExcludingTax']
  end

  if attributes.has_key?(:'invoiceRefunded')
    self.invoice_refunded = attributes[:'invoiceRefunded']
  end

  if attributes.has_key?(:'creditRolledOver')
    self.credit_rolled_over = attributes[:'creditRolledOver']
  end

  if attributes.has_key?(:'creditRolledOverExcludingTax')
    self.credit_rolled_over_excluding_tax = attributes[:'creditRolledOverExcludingTax']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'locked')
    self.locked = attributes[:'locked']
  end

  if attributes.has_key?(:'managedBy')
    self.managed_by = attributes[:'managedBy']
  end

  if attributes.has_key?(:'initialInvoice')
    self.initial_invoice = attributes[:'initialInvoice']
  else
    self.initial_invoice = false
  end

  if attributes.has_key?(:'processing')
    self.processing = attributes[:'processing']
  else
    self.processing = false
  end

  if attributes.has_key?(:'paymentTerms')
    self.payment_terms = attributes[:'paymentTerms']
  end

  if attributes.has_key?(:'purchaseOrder')
    self.purchase_order = attributes[:'purchaseOrder']
  end

  if attributes.has_key?(:'versionNumber')
    self.version_number = attributes[:'versionNumber']
  end

  if attributes.has_key?(:'invoiceLines')
    if (value = attributes[:'invoiceLines']).is_a?(Array)
      self.invoice_lines = value
    end
  end

  if attributes.has_key?(:'taxLines')
    if (value = attributes[:'taxLines']).is_a?(Array)
      self.tax_lines = value
    end
  end

  if attributes.has_key?(:'invoicePayments')
    if (value = attributes[:'invoicePayments']).is_a?(Array)
      self.invoice_payments = value
    end
  end

  if attributes.has_key?(:'invoiceRefunds')
    if (value = attributes[:'invoiceRefunds']).is_a?(Array)
      self.invoice_refunds = value
    end
  end

  if attributes.has_key?(:'invoiceCreditNotes')
    if (value = attributes[:'invoiceCreditNotes']).is_a?(Array)
      self.invoice_credit_notes = value
    end
  end

  if attributes.has_key?(:'charges')
    if (value = attributes[:'charges']).is_a?(Array)
      self.charges = value
    end
  end

  if attributes.has_key?(:'children')
    if (value = attributes[:'children']).is_a?(Array)
      self.children = value
    end
  end

end

Instance Attribute Details

#account_idObject

{ "description" : "", "verbs“: }



43
44
45
# File 'lib/bf_ruby2/models/invoice.rb', line 43

def 
  @account_id
end

#changed_byObject

{ "description" : "ID of the user who last updated the entity.", "verbs":[] }



22
23
24
# File 'lib/bf_ruby2/models/invoice.rb', line 22

def changed_by
  @changed_by
end

#chargesObject

Returns the value of attribute charges.



160
161
162
# File 'lib/bf_ruby2/models/invoice.rb', line 160

def charges
  @charges
end

#childrenObject

Returns the value of attribute children.



162
163
164
# File 'lib/bf_ruby2/models/invoice.rb', line 162

def children
  @children
end

#cost_excluding_taxObject

{ "description" : "Cost of the invoice exclusive of tax.", "verbs“: }



94
95
96
# File 'lib/bf_ruby2/models/invoice.rb', line 94

def cost_excluding_tax
  @cost_excluding_tax
end

#createdObject

{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }



19
20
21
# File 'lib/bf_ruby2/models/invoice.rb', line 19

def created
  @created
end

#credit_rolled_overObject

{ "description" : "The amount of credit to be returned to the pool.", "verbs“: }



118
119
120
# File 'lib/bf_ruby2/models/invoice.rb', line 118

def credit_rolled_over
  @credit_rolled_over
end

#credit_rolled_over_excluding_taxObject

{ "description" : "The amount of credit to be returned to the pool excluding tax.", "verbs“: }



121
122
123
# File 'lib/bf_ruby2/models/invoice.rb', line 121

def credit_rolled_over_excluding_tax
  @credit_rolled_over_excluding_tax
end

#crm_idObject

{ "description" : "CRM identifier of the invoice.", "verbs“: }



34
35
36
# File 'lib/bf_ruby2/models/invoice.rb', line 34

def crm_id
  @crm_id
end

#currencyObject

{ "description" : "Currency of the invoice specified by a three character ISO 4217 currency code.", "verbs“: }



91
92
93
# File 'lib/bf_ruby2/models/invoice.rb', line 91

def currency
  @currency
end

#deletedObject

{ "description" : "Indicates if an invoice has been retired. If an invoice has been retired it can still be retrieved using the appropriate flag on API requests. Generally invoices will not be retired.", "verbs":[] }



73
74
75
# File 'lib/bf_ruby2/models/invoice.rb', line 73

def deleted
  @deleted
end

#descriptionObject

{ "description" : "The description of the invoice", "verbs":[] }



55
56
57
# File 'lib/bf_ruby2/models/invoice.rb', line 55

def description
  @description
end

#discount_amountObject

{ "description" : "The amount of discounts for the invoice.", "verbs“: }



109
110
111
# File 'lib/bf_ruby2/models/invoice.rb', line 109

def discount_amount
  @discount_amount
end

#discount_amount_excluding_taxObject

{ "description" : "The amount of discounts for the invoice excluding tax.", "verbs“: }



112
113
114
# File 'lib/bf_ruby2/models/invoice.rb', line 112

def discount_amount_excluding_tax
  @discount_amount_excluding_tax
end

#dueObject

{ "description" : "Date this invoice is due, UTC DateTime.", "verbs“: }



70
71
72
# File 'lib/bf_ruby2/models/invoice.rb', line 70

def due
  @due
end

#final_execution_attemptObject

{ "description" : "UTC DateTime of the invoice’s final execution attempt. The final execution attempt. This may be less than the next execution attempt if the next execution attempt never occurred.", "verbs“: }



85
86
87
# File 'lib/bf_ruby2/models/invoice.rb', line 85

def final_execution_attempt
  @final_execution_attempt
end

#idObject

{ "description" : "Unique identifier for the invoice.", "verbs“: }



31
32
33
# File 'lib/bf_ruby2/models/invoice.rb', line 31

def id
  @id
end

#initial_invoiceObject

{ "description" : "Is this an initial invoice. An initial invoice is the first invoice generated for a subscription. Initial invoices will not have dunning applied to them and as such will only have a single payment attempt. For trial periods, the trial invoice is the initial invoice.", "verbs“: }



133
134
135
# File 'lib/bf_ruby2/models/invoice.rb', line 133

def initial_invoice
  @initial_invoice
end

#invoice_costObject

{ "description" : "Cost of the invoice inclusive of tax.", "verbs“: }



97
98
99
# File 'lib/bf_ruby2/models/invoice.rb', line 97

def invoice_cost
  @invoice_cost
end

#invoice_credit_notesObject

{ "description" : "Credit Notes associated with this invoice. Multiple credit notes may be associated with the invoice.", "verbs“: }



158
159
160
# File 'lib/bf_ruby2/models/invoice.rb', line 158

def invoice_credit_notes
  @invoice_credit_notes
end

#invoice_linesObject

{ "description" : "The collection of invoice-lines associated with the invoice.", "verbs“: }



147
148
149
# File 'lib/bf_ruby2/models/invoice.rb', line 147

def invoice_lines
  @invoice_lines
end

#invoice_paidObject

{ "description" : "Total amount of the invoice currently paid for. As the invoice may be paid by multiple payments, for example partly paid for by a voucher and then paid for by a card, this indicates the current paid amount of the invoice.", "verbs“: }



106
107
108
# File 'lib/bf_ruby2/models/invoice.rb', line 106

def invoice_paid
  @invoice_paid
end

#invoice_paymentsObject

{ "description" : "Payments used for this invoice. Multiple payments may be associated with the invoice.", "verbs“: }



152
153
154
# File 'lib/bf_ruby2/models/invoice.rb', line 152

def invoice_payments
  @invoice_payments
end

#invoice_refundedObject

{ "description" : "Total amount of the invoice refunded.", "verbs“: }



115
116
117
# File 'lib/bf_ruby2/models/invoice.rb', line 115

def invoice_refunded
  @invoice_refunded
end

#invoice_refundsObject

{ "description" : "Refunds associated with this invoice. Multiple refunds may be associated with the invoice.", "verbs“: }



155
156
157
# File 'lib/bf_ruby2/models/invoice.rb', line 155

def invoice_refunds
  @invoice_refunds
end

#issuedObject

{ "description" : "The UTC DateTime when the invoice was first issued.", "verbs“: }



61
62
63
# File 'lib/bf_ruby2/models/invoice.rb', line 61

def issued
  @issued
end

#last_execution_attemptObject

{ "description" : "UTC DateTime of the invoice’s last execution attempt. This was the last time an attempt was made to take payment for this invoice.", "verbs“: }



79
80
81
# File 'lib/bf_ruby2/models/invoice.rb', line 79

def last_execution_attempt
  @last_execution_attempt
end

#lockedObject

{ "description" : "If the subscription is locked, it will not be processed by the system", "verbs":[] }



127
128
129
# File 'lib/bf_ruby2/models/invoice.rb', line 127

def locked
  @locked
end

#managed_byObject

{ "description" : "Which system is responsible for managing the subscription.", "verbs":[] }



130
131
132
# File 'lib/bf_ruby2/models/invoice.rb', line 130

def managed_by
  @managed_by
end

#nameObject

{ "description" : "The name of the invoice", "verbs":[] }



52
53
54
# File 'lib/bf_ruby2/models/invoice.rb', line 52

def name
  @name
end

#next_execution_attemptObject

{ "description" : "UTC DateTime of the invoice’s next execution attempt. If the next execution attempt is greater than the period end for this invoice, the invoice will not receive another automatic execution attempt.", "verbs“: }



82
83
84
# File 'lib/bf_ruby2/models/invoice.rb', line 82

def next_execution_attempt
  @next_execution_attempt
end

#non_discounted_costObject

Cost of the invoice before discounts, inclusive of tax.



100
101
102
# File 'lib/bf_ruby2/models/invoice.rb', line 100

def non_discounted_cost
  @non_discounted_cost
end

#non_discounted_cost_excluding_taxObject

Cost of the invoice before discounts, inclusive of tax.



103
104
105
# File 'lib/bf_ruby2/models/invoice.rb', line 103

def non_discounted_cost_excluding_tax
  @non_discounted_cost_excluding_tax
end

#organization_idObject

{ "description" : "", "verbs":[] }



46
47
48
# File 'lib/bf_ruby2/models/invoice.rb', line 46

def organization_id
  @organization_id
end

#parent_invoice_idObject

{ "description" : "", "verbs":[] }



49
50
51
# File 'lib/bf_ruby2/models/invoice.rb', line 49

def parent_invoice_id
  @parent_invoice_id
end

#payment_receivedObject

{ "description" : "UTC DateTime specifying when payment was received for the invoice.", "verbs“: }



88
89
90
# File 'lib/bf_ruby2/models/invoice.rb', line 88

def payment_received
  @payment_received
end

#payment_termsObject

Returns the value of attribute payment_terms.



138
139
140
# File 'lib/bf_ruby2/models/invoice.rb', line 138

def payment_terms
  @payment_terms
end

#period_endObject

{ "description" : "End of the period being billed by this invoice, UTC DateTime.", "verbs“: }



67
68
69
# File 'lib/bf_ruby2/models/invoice.rb', line 67

def period_end
  @period_end
end

#period_startObject

{ "description" : "Start of the period being billed by this invoice, UTC DateTime", "verbs“: }



64
65
66
# File 'lib/bf_ruby2/models/invoice.rb', line 64

def period_start
  @period_start
end

#processingObject

{ "processing" : "If true, the invoice is processing.", "verbs":[] }



136
137
138
# File 'lib/bf_ruby2/models/invoice.rb', line 136

def processing
  @processing
end

#purchase_orderObject

{ "description" : "Purchase order associated with the subscription. If specified this is copied to any invoices issued for this subscription.", "verbs“: }



141
142
143
# File 'lib/bf_ruby2/models/invoice.rb', line 141

def purchase_order
  @purchase_order
end

#stateObject

{ "description" : "Initially an invoice is set as unpaid. Once payment for the full value of the invoice has been received it is marked as paid. An invoice may be paid from various sources including cards, coupons or manual payments.", "verbs“: }



58
59
60
# File 'lib/bf_ruby2/models/invoice.rb', line 58

def state
  @state
end

#subscription_idObject

{ "description" : "", "verbs“: }



37
38
39
# File 'lib/bf_ruby2/models/invoice.rb', line 37

def subscription_id
  @subscription_id
end

#subscription_version_idObject

{ "description" : "", "verbs“: }



40
41
42
# File 'lib/bf_ruby2/models/invoice.rb', line 40

def subscription_version_id
  @subscription_version_id
end

#tax_linesObject

Returns the value of attribute tax_lines.



149
150
151
# File 'lib/bf_ruby2/models/invoice.rb', line 149

def tax_lines
  @tax_lines
end

#total_execution_attemptsObject

{ "description" : "Number of payment attempts for this invoice. This includes any manual execution attempts.", "verbs“: }



76
77
78
# File 'lib/bf_ruby2/models/invoice.rb', line 76

def total_execution_attempts
  @total_execution_attempts
end

#typeObject

{ "description" : "The type of the invoice. A subscription invoice is raised every time a subscription recurs. An amendment is created for intra-contract changes. An Adhoc invoice is created for payment that is taken out-of-band of a subscription. Finally the invoice generated for a trial period is marked as Trial.", "verbs“: }



124
125
126
# File 'lib/bf_ruby2/models/invoice.rb', line 124

def type
  @type
end

#updatedObject

{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }



25
26
27
# File 'lib/bf_ruby2/models/invoice.rb', line 25

def updated
  @updated
end

#version_idObject

{ "description" : "Version identifier of the invoice.", "verbs“: }



28
29
30
# File 'lib/bf_ruby2/models/invoice.rb', line 28

def version_id
  @version_id
end

#version_numberObject

{ "description" : "The version number of the Invoice. The first version of an Invoice is version number 1", "verbs“: }



144
145
146
# File 'lib/bf_ruby2/models/invoice.rb', line 144

def version_number
  @version_number
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/bf_ruby2/models/invoice.rb', line 187

def self.attribute_map
  {
    :'created' => :'created',
    :'changed_by' => :'changedBy',
    :'updated' => :'updated',
    :'version_id' => :'versionID',
    :'id' => :'id',
    :'crm_id' => :'crmID',
    :'subscription_id' => :'subscriptionID',
    :'subscription_version_id' => :'subscriptionVersionID',
    :'account_id' => :'accountID',
    :'organization_id' => :'organizationID',
    :'parent_invoice_id' => :'parentInvoiceID',
    :'name' => :'name',
    :'description' => :'description',
    :'state' => :'state',
    :'issued' => :'issued',
    :'period_start' => :'periodStart',
    :'period_end' => :'periodEnd',
    :'due' => :'due',
    :'deleted' => :'deleted',
    :'total_execution_attempts' => :'totalExecutionAttempts',
    :'last_execution_attempt' => :'lastExecutionAttempt',
    :'next_execution_attempt' => :'nextExecutionAttempt',
    :'final_execution_attempt' => :'finalExecutionAttempt',
    :'payment_received' => :'paymentReceived',
    :'currency' => :'currency',
    :'cost_excluding_tax' => :'costExcludingTax',
    :'invoice_cost' => :'invoiceCost',
    :'non_discounted_cost' => :'nonDiscountedCost',
    :'non_discounted_cost_excluding_tax' => :'nonDiscountedCostExcludingTax',
    :'invoice_paid' => :'invoicePaid',
    :'discount_amount' => :'discountAmount',
    :'discount_amount_excluding_tax' => :'discountAmountExcludingTax',
    :'invoice_refunded' => :'invoiceRefunded',
    :'credit_rolled_over' => :'creditRolledOver',
    :'credit_rolled_over_excluding_tax' => :'creditRolledOverExcludingTax',
    :'type' => :'type',
    :'locked' => :'locked',
    :'managed_by' => :'managedBy',
    :'initial_invoice' => :'initialInvoice',
    :'processing' => :'processing',
    :'payment_terms' => :'paymentTerms',
    :'purchase_order' => :'purchaseOrder',
    :'version_number' => :'versionNumber',
    :'invoice_lines' => :'invoiceLines',
    :'tax_lines' => :'taxLines',
    :'invoice_payments' => :'invoicePayments',
    :'invoice_refunds' => :'invoiceRefunds',
    :'invoice_credit_notes' => :'invoiceCreditNotes',
    :'charges' => :'charges',
    :'children' => :'children'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/bf_ruby2/models/invoice.rb', line 243

def self.swagger_types
  {
    :'created' => :'DateTime',
    :'changed_by' => :'String',
    :'updated' => :'DateTime',
    :'version_id' => :'String',
    :'id' => :'String',
    :'crm_id' => :'String',
    :'subscription_id' => :'String',
    :'subscription_version_id' => :'String',
    :'account_id' => :'String',
    :'organization_id' => :'String',
    :'parent_invoice_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'state' => :'String',
    :'issued' => :'DateTime',
    :'period_start' => :'DateTime',
    :'period_end' => :'DateTime',
    :'due' => :'DateTime',
    :'deleted' => :'BOOLEAN',
    :'total_execution_attempts' => :'Integer',
    :'last_execution_attempt' => :'DateTime',
    :'next_execution_attempt' => :'DateTime',
    :'final_execution_attempt' => :'DateTime',
    :'payment_received' => :'DateTime',
    :'currency' => :'String',
    :'cost_excluding_tax' => :'Float',
    :'invoice_cost' => :'Float',
    :'non_discounted_cost' => :'Float',
    :'non_discounted_cost_excluding_tax' => :'Float',
    :'invoice_paid' => :'Float',
    :'discount_amount' => :'Float',
    :'discount_amount_excluding_tax' => :'Float',
    :'invoice_refunded' => :'Float',
    :'credit_rolled_over' => :'Float',
    :'credit_rolled_over_excluding_tax' => :'Float',
    :'type' => :'String',
    :'locked' => :'String',
    :'managed_by' => :'String',
    :'initial_invoice' => :'BOOLEAN',
    :'processing' => :'BOOLEAN',
    :'payment_terms' => :'Integer',
    :'purchase_order' => :'String',
    :'version_number' => :'Integer',
    :'invoice_lines' => :'Array<InvoiceLine>',
    :'tax_lines' => :'Array<InsertableBillingEntity>',
    :'invoice_payments' => :'Array<InvoicePayment>',
    :'invoice_refunds' => :'Array<Refund>',
    :'invoice_credit_notes' => :'Array<CreditNote>',
    :'charges' => :'Array<SubscriptionCharge>',
    :'children' => :'Array<Invoice>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
# File 'lib/bf_ruby2/models/invoice.rb', line 649

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created == o.created &&
      changed_by == o.changed_by &&
      updated == o.updated &&
      version_id == o.version_id &&
      id == o.id &&
      crm_id == o.crm_id &&
      subscription_id == o.subscription_id &&
      subscription_version_id == o.subscription_version_id &&
       == o. &&
      organization_id == o.organization_id &&
      parent_invoice_id == o.parent_invoice_id &&
      name == o.name &&
      description == o.description &&
      state == o.state &&
      issued == o.issued &&
      period_start == o.period_start &&
      period_end == o.period_end &&
      due == o.due &&
      deleted == o.deleted &&
      total_execution_attempts == o.total_execution_attempts &&
      last_execution_attempt == o.last_execution_attempt &&
      next_execution_attempt == o.next_execution_attempt &&
      final_execution_attempt == o.final_execution_attempt &&
      payment_received == o.payment_received &&
      currency == o.currency &&
      cost_excluding_tax == o.cost_excluding_tax &&
      invoice_cost == o.invoice_cost &&
      non_discounted_cost == o.non_discounted_cost &&
      non_discounted_cost_excluding_tax == o.non_discounted_cost_excluding_tax &&
      invoice_paid == o.invoice_paid &&
      discount_amount == o.discount_amount &&
      discount_amount_excluding_tax == o.discount_amount_excluding_tax &&
      invoice_refunded == o.invoice_refunded &&
      credit_rolled_over == o.credit_rolled_over &&
      credit_rolled_over_excluding_tax == o.credit_rolled_over_excluding_tax &&
      type == o.type &&
      locked == o.locked &&
      managed_by == o.managed_by &&
      initial_invoice == o.initial_invoice &&
      processing == o.processing &&
      payment_terms == o.payment_terms &&
      purchase_order == o.purchase_order &&
      version_number == o.version_number &&
      invoice_lines == o.invoice_lines &&
      tax_lines == o.tax_lines &&
      invoice_payments == o.invoice_payments &&
      invoice_refunds == o.invoice_refunds &&
      invoice_credit_notes == o.invoice_credit_notes &&
      charges == o.charges &&
      children == o.children
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
# File 'lib/bf_ruby2/models/invoice.rb', line 740

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Bfwd.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value



806
807
808
809
810
811
812
813
814
815
816
817
818
# File 'lib/bf_ruby2/models/invoice.rb', line 806

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash



719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/bf_ruby2/models/invoice.rb', line 719

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

See Also:

  • `==` method


706
707
708
# File 'lib/bf_ruby2/models/invoice.rb', line 706

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.



712
713
714
# File 'lib/bf_ruby2/models/invoice.rb', line 712

def hash
  [created, changed_by, updated, version_id, id, crm_id, subscription_id, subscription_version_id, , organization_id, parent_invoice_id, name, description, state, issued, period_start, period_end, due, deleted, total_execution_attempts, last_execution_attempt, next_execution_attempt, final_execution_attempt, payment_received, currency, cost_excluding_tax, invoice_cost, non_discounted_cost, non_discounted_cost_excluding_tax, invoice_paid, discount_amount, discount_amount_excluding_tax, invoice_refunded, credit_rolled_over, credit_rolled_over_excluding_tax, type, locked, managed_by, initial_invoice, processing, payment_terms, purchase_order, version_number, invoice_lines, tax_lines, invoice_payments, invoice_refunds, invoice_credit_notes, charges, children].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/bf_ruby2/models/invoice.rb', line 530

def list_invalid_properties
  invalid_properties = Array.new
  if @subscription_version_id.nil?
    invalid_properties.push("invalid value for 'subscription_version_id', subscription_version_id cannot be nil.")
  end

  if @account_id.nil?
    invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.")
  end

  if @organization_id.nil?
    invalid_properties.push("invalid value for 'organization_id', organization_id cannot be nil.")
  end

  if @state.nil?
    invalid_properties.push("invalid value for 'state', state cannot be nil.")
  end

  if @deleted.nil?
    invalid_properties.push("invalid value for 'deleted', deleted cannot be nil.")
  end

  if @currency.nil?
    invalid_properties.push("invalid value for 'currency', currency cannot be nil.")
  end

  if @cost_excluding_tax.nil?
    invalid_properties.push("invalid value for 'cost_excluding_tax', cost_excluding_tax cannot be nil.")
  end

  if @invoice_cost.nil?
    invalid_properties.push("invalid value for 'invoice_cost', invoice_cost cannot be nil.")
  end

  if @non_discounted_cost.nil?
    invalid_properties.push("invalid value for 'non_discounted_cost', non_discounted_cost cannot be nil.")
  end

  if @non_discounted_cost_excluding_tax.nil?
    invalid_properties.push("invalid value for 'non_discounted_cost_excluding_tax', non_discounted_cost_excluding_tax cannot be nil.")
  end

  if @credit_rolled_over.nil?
    invalid_properties.push("invalid value for 'credit_rolled_over', credit_rolled_over cannot be nil.")
  end

  if @type.nil?
    invalid_properties.push("invalid value for 'type', type cannot be nil.")
  end

  if @initial_invoice.nil?
    invalid_properties.push("invalid value for 'initial_invoice', initial_invoice cannot be nil.")
  end

  if @version_number.nil?
    invalid_properties.push("invalid value for 'version_number', version_number cannot be nil.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



786
787
788
# File 'lib/bf_ruby2/models/invoice.rb', line 786

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



792
793
794
795
796
797
798
799
800
# File 'lib/bf_ruby2/models/invoice.rb', line 792

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object



780
781
782
# File 'lib/bf_ruby2/models/invoice.rb', line 780

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/bf_ruby2/models/invoice.rb', line 593

def valid?
  return false if @subscription_version_id.nil?
  return false if @account_id.nil?
  return false if @organization_id.nil?
  return false if @state.nil?
  state_validator = EnumAttributeValidator.new('String', ["Paid", "Unpaid", "Pending", "Voided"])
  return false unless state_validator.valid?(@state)
  return false if @deleted.nil?
  return false if @currency.nil?
  return false if @cost_excluding_tax.nil?
  return false if @invoice_cost.nil?
  return false if @non_discounted_cost.nil?
  return false if @non_discounted_cost_excluding_tax.nil?
  return false if @credit_rolled_over.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["Subscription", "Trial", "Charge", "FinalArrears", "Amendment", "Aggregated"])
  return false unless type_validator.valid?(@type)
  managed_by_validator = EnumAttributeValidator.new('String', ["BillForward", "Stripe"])
  return false unless managed_by_validator.valid?(@managed_by)
  return false if @initial_invoice.nil?
  return false if @version_number.nil?
  return true
end