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

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/bf_ruby2/models/invoice.rb', line 311

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“: }



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

def 
  @account_id
end

#changed_byObject

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



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

def changed_by
  @changed_by
end

#chargesObject

Returns the value of attribute charges.



171
172
173
# File 'lib/bf_ruby2/models/invoice.rb', line 171

def charges
  @charges
end

#childrenObject

Returns the value of attribute children.



173
174
175
# File 'lib/bf_ruby2/models/invoice.rb', line 173

def children
  @children
end

#cost_excluding_taxObject

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



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

def cost_excluding_tax
  @cost_excluding_tax
end

#createdObject

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



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

def created
  @created
end

#credit_rolled_overObject

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



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

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“: }



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

def credit_rolled_over_excluding_tax
  @credit_rolled_over_excluding_tax
end

#crm_idObject

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



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

def crm_id
  @crm_id
end

#currencyObject

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



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

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":[] }



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

def deleted
  @deleted
end

#descriptionObject

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



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

def description
  @description
end

#discount_amountObject

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



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

def discount_amount
  @discount_amount
end

#discount_amount_excluding_taxObject

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



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

def discount_amount_excluding_tax
  @discount_amount_excluding_tax
end

#dueObject

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



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

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“: }



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

def final_execution_attempt
  @final_execution_attempt
end

#idObject

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



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

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“: }



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

def initial_invoice
  @initial_invoice
end

#invoice_costObject

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



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

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“: }



169
170
171
# File 'lib/bf_ruby2/models/invoice.rb', line 169

def invoice_credit_notes
  @invoice_credit_notes
end

#invoice_linesObject

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



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

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“: }



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

def invoice_paid
  @invoice_paid
end

#invoice_paymentsObject

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



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

def invoice_payments
  @invoice_payments
end

#invoice_refundedObject

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



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

def invoice_refunded
  @invoice_refunded
end

#invoice_refundsObject

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



166
167
168
# File 'lib/bf_ruby2/models/invoice.rb', line 166

def invoice_refunds
  @invoice_refunds
end

#issuedObject

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



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

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“: }



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

def last_execution_attempt
  @last_execution_attempt
end

#lockedObject

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



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

def locked
  @locked
end

#managed_byObject

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



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

def managed_by
  @managed_by
end

#nameObject

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



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

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“: }



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

def next_execution_attempt
  @next_execution_attempt
end

#non_discounted_costObject

Cost of the invoice before discounts, inclusive of tax.



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

def non_discounted_cost
  @non_discounted_cost
end

#non_discounted_cost_excluding_taxObject

Cost of the invoice before discounts, inclusive of tax.



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

def non_discounted_cost_excluding_tax
  @non_discounted_cost_excluding_tax
end

#organization_idObject

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



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

def organization_id
  @organization_id
end

#parent_invoice_idObject

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



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

def parent_invoice_id
  @parent_invoice_id
end

#payment_receivedObject

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



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

def payment_received
  @payment_received
end

#payment_termsObject

Returns the value of attribute payment_terms.



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

def payment_terms
  @payment_terms
end

#period_endObject

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



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

def period_end
  @period_end
end

#period_startObject

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



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

def period_start
  @period_start
end

#processingObject

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



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

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“: }



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

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“: }



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

def state
  @state
end

#subscription_idObject

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



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

def subscription_id
  @subscription_id
end

#subscription_version_idObject

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



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

def subscription_version_id
  @subscription_version_id
end

#tax_linesObject

Returns the value of attribute tax_lines.



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

def tax_lines
  @tax_lines
end

#total_execution_attemptsObject

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



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

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“: }



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

def type
  @type
end

#updatedObject

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



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

def updated
  @updated
end

#version_idObject

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



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

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“: }



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

def version_number
  @version_number
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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.

Parameters:

  • Object (Object)

    to be compared



604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/bf_ruby2/models/invoice.rb', line 604

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

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
# File 'lib/bf_ruby2/models/invoice.rb', line 695

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 =~ /^(true|t|yes|y|1)$/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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



761
762
763
764
765
766
767
768
769
770
771
772
773
# File 'lib/bf_ruby2/models/invoice.rb', line 761

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
# File 'lib/bf_ruby2/models/invoice.rb', line 674

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


661
662
663
# File 'lib/bf_ruby2/models/invoice.rb', line 661

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



667
668
669
# File 'lib/bf_ruby2/models/invoice.rb', line 667

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?

Returns:

  • Array for valid properies with the reasons



541
542
543
544
# File 'lib/bf_ruby2/models/invoice.rb', line 541

def list_invalid_properties
  invalid_properties = Array.new
  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



741
742
743
# File 'lib/bf_ruby2/models/invoice.rb', line 741

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



747
748
749
750
751
752
753
754
755
# File 'lib/bf_ruby2/models/invoice.rb', line 747

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

Returns:

  • (String)

    String presentation of the object



735
736
737
# File 'lib/bf_ruby2/models/invoice.rb', line 735

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/bf_ruby2/models/invoice.rb', line 548

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