Class: FactPulse::FacturXInvoice

Inherits:
ApiModelBase show all
Defined in:
lib/factpulse/models/factur_x_invoice.rb

Overview

Data model for an invoice to be converted to Factur-X.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ FacturXInvoice

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/factpulse/models/factur_x_invoice.rb', line 209

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::FacturXInvoice` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::FacturXInvoice`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'invoice_number')
    self.invoice_number = attributes[:'invoice_number']
  else
    self.invoice_number = nil
  end

  if attributes.key?(:'payment_due_date')
    self.payment_due_date = attributes[:'payment_due_date']
  else
    self.payment_due_date = nil
  end

  if attributes.key?(:'invoice_date')
    self.invoice_date = attributes[:'invoice_date']
  end

  if attributes.key?(:'submission_mode')
    self.submission_mode = attributes[:'submission_mode']
  else
    self.submission_mode = nil
  end

  if attributes.key?(:'recipient')
    self.recipient = attributes[:'recipient']
  else
    self.recipient = nil
  end

  if attributes.key?(:'supplier')
    self.supplier = attributes[:'supplier']
  else
    self.supplier = nil
  end

  if attributes.key?(:'invoicing_framework')
    self.invoicing_framework = attributes[:'invoicing_framework']
  else
    self.invoicing_framework = nil
  end

  if attributes.key?(:'references')
    self.references = attributes[:'references']
  else
    self.references = nil
  end

  if attributes.key?(:'totals')
    self.totals = attributes[:'totals']
  else
    self.totals = nil
  end

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

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

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

  if attributes.key?(:'comment')
    self.comment = attributes[:'comment']
  end

  if attributes.key?(:'current_user_id')
    self.current_user_id = attributes[:'current_user_id']
  end

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

  if attributes.key?(:'payee')
    self.payee = attributes[:'payee']
  end

  if attributes.key?(:'delivery_party')
    self.delivery_party = attributes[:'delivery_party']
  end

  if attributes.key?(:'tax_representative')
    self.tax_representative = attributes[:'tax_representative']
  end

  if attributes.key?(:'delivery_date')
    self.delivery_date = attributes[:'delivery_date']
  end

  if attributes.key?(:'billing_period_start')
    self.billing_period_start = attributes[:'billing_period_start']
  end

  if attributes.key?(:'billing_period_end')
    self.billing_period_end = attributes[:'billing_period_end']
  end

  if attributes.key?(:'payment_reference')
    self.payment_reference = attributes[:'payment_reference']
  end

  if attributes.key?(:'creditor_reference_id')
    self.creditor_reference_id = attributes[:'creditor_reference_id']
  end

  if attributes.key?(:'direct_debit_mandate_id')
    self.direct_debit_mandate_id = attributes[:'direct_debit_mandate_id']
  end

  if attributes.key?(:'debtor_iban')
    self.debtor_iban = attributes[:'debtor_iban']
  end

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

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

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

  if attributes.key?(:'buyer_accounting_reference')
    self.buyer_accounting_reference = attributes[:'buyer_accounting_reference']
  end

  if attributes.key?(:'payment_card')
    self.payment_card = attributes[:'payment_card']
  end
end

Instance Attribute Details

#additional_documents ⇒ Object

Returns the value of attribute additional_documents.



73
74
75
# File 'lib/factpulse/models/factur_x_invoice.rb', line 73

def additional_documents
  @additional_documents
end

#allowances_charges ⇒ Object

Returns the value of attribute allowances_charges.



71
72
73
# File 'lib/factpulse/models/factur_x_invoice.rb', line 71

def allowances_charges
  @allowances_charges
end

#billing_period_end ⇒ Object

Returns the value of attribute billing_period_end.



59
60
61
# File 'lib/factpulse/models/factur_x_invoice.rb', line 59

def billing_period_end
  @billing_period_end
end

#billing_period_start ⇒ Object

Returns the value of attribute billing_period_start.



57
58
59
# File 'lib/factpulse/models/factur_x_invoice.rb', line 57

def billing_period_start
  @billing_period_start
end

#buyer_accounting_reference ⇒ Object

Returns the value of attribute buyer_accounting_reference.



75
76
77
# File 'lib/factpulse/models/factur_x_invoice.rb', line 75

def buyer_accounting_reference
  @buyer_accounting_reference
end

#comment ⇒ Object

Returns the value of attribute comment.



43
44
45
# File 'lib/factpulse/models/factur_x_invoice.rb', line 43

def comment
  @comment
end

#creditor_reference_id ⇒ Object

Returns the value of attribute creditor_reference_id.



63
64
65
# File 'lib/factpulse/models/factur_x_invoice.rb', line 63

def creditor_reference_id
  @creditor_reference_id
end

#current_user_id ⇒ Object

Returns the value of attribute current_user_id.



45
46
47
# File 'lib/factpulse/models/factur_x_invoice.rb', line 45

def current_user_id
  @current_user_id
end

#debtor_iban ⇒ Object

Returns the value of attribute debtor_iban.



67
68
69
# File 'lib/factpulse/models/factur_x_invoice.rb', line 67

def debtor_iban
  @debtor_iban
end

#delivery_date ⇒ Object

Returns the value of attribute delivery_date.



55
56
57
# File 'lib/factpulse/models/factur_x_invoice.rb', line 55

def delivery_date
  @delivery_date
end

#delivery_party ⇒ Object

Returns the value of attribute delivery_party.



51
52
53
# File 'lib/factpulse/models/factur_x_invoice.rb', line 51

def delivery_party
  @delivery_party
end

#direct_debit_mandate_id ⇒ Object

Returns the value of attribute direct_debit_mandate_id.



65
66
67
# File 'lib/factpulse/models/factur_x_invoice.rb', line 65

def direct_debit_mandate_id
  @direct_debit_mandate_id
end

#invoice_date ⇒ Object

Returns the value of attribute invoice_date.



23
24
25
# File 'lib/factpulse/models/factur_x_invoice.rb', line 23

def invoice_date
  @invoice_date
end

#invoice_lines ⇒ Object

Returns the value of attribute invoice_lines.



37
38
39
# File 'lib/factpulse/models/factur_x_invoice.rb', line 37

def invoice_lines
  @invoice_lines
end

#invoice_number ⇒ Object

Returns the value of attribute invoice_number.



19
20
21
# File 'lib/factpulse/models/factur_x_invoice.rb', line 19

def invoice_number
  @invoice_number
end

#invoicing_framework ⇒ Object

Returns the value of attribute invoicing_framework.



31
32
33
# File 'lib/factpulse/models/factur_x_invoice.rb', line 31

def invoicing_framework
  @invoicing_framework
end

#notes ⇒ Object

Returns the value of attribute notes.



41
42
43
# File 'lib/factpulse/models/factur_x_invoice.rb', line 41

def notes
  @notes
end

#payee ⇒ Object

Returns the value of attribute payee.



49
50
51
# File 'lib/factpulse/models/factur_x_invoice.rb', line 49

def payee
  @payee
end

#payment_card ⇒ Object

Returns the value of attribute payment_card.



77
78
79
# File 'lib/factpulse/models/factur_x_invoice.rb', line 77

def payment_card
  @payment_card
end

#payment_due_date ⇒ Object

Returns the value of attribute payment_due_date.



21
22
23
# File 'lib/factpulse/models/factur_x_invoice.rb', line 21

def payment_due_date
  @payment_due_date
end

#payment_reference ⇒ Object

Returns the value of attribute payment_reference.



61
62
63
# File 'lib/factpulse/models/factur_x_invoice.rb', line 61

def payment_reference
  @payment_reference
end

#payment_terms ⇒ Object

Returns the value of attribute payment_terms.



69
70
71
# File 'lib/factpulse/models/factur_x_invoice.rb', line 69

def payment_terms
  @payment_terms
end

#recipient ⇒ Object

Returns the value of attribute recipient.



27
28
29
# File 'lib/factpulse/models/factur_x_invoice.rb', line 27

def recipient
  @recipient
end

#references ⇒ Object

Returns the value of attribute references.



33
34
35
# File 'lib/factpulse/models/factur_x_invoice.rb', line 33

def references
  @references
end

#submission_mode ⇒ Object

Returns the value of attribute submission_mode.



25
26
27
# File 'lib/factpulse/models/factur_x_invoice.rb', line 25

def submission_mode
  @submission_mode
end

#supplementary_attachments ⇒ Object

Returns the value of attribute supplementary_attachments.



47
48
49
# File 'lib/factpulse/models/factur_x_invoice.rb', line 47

def supplementary_attachments
  @supplementary_attachments
end

#supplier ⇒ Object

Returns the value of attribute supplier.



29
30
31
# File 'lib/factpulse/models/factur_x_invoice.rb', line 29

def supplier
  @supplier
end

#tax_representative ⇒ Object

Returns the value of attribute tax_representative.



53
54
55
# File 'lib/factpulse/models/factur_x_invoice.rb', line 53

def tax_representative
  @tax_representative
end

#totals ⇒ Object

Returns the value of attribute totals.



35
36
37
# File 'lib/factpulse/models/factur_x_invoice.rb', line 35

def totals
  @totals
end

#vat_lines ⇒ Object

Returns the value of attribute vat_lines.



39
40
41
# File 'lib/factpulse/models/factur_x_invoice.rb', line 39

def vat_lines
  @vat_lines
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



138
139
140
# File 'lib/factpulse/models/factur_x_invoice.rb', line 138

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



143
144
145
# File 'lib/factpulse/models/factur_x_invoice.rb', line 143

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



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
# File 'lib/factpulse/models/factur_x_invoice.rb', line 102

def self.attribute_map
  {
    :'invoice_number' => :'invoice_number',
    :'payment_due_date' => :'payment_due_date',
    :'invoice_date' => :'invoice_date',
    :'submission_mode' => :'submission_mode',
    :'recipient' => :'recipient',
    :'supplier' => :'supplier',
    :'invoicing_framework' => :'invoicing_framework',
    :'references' => :'references',
    :'totals' => :'totals',
    :'invoice_lines' => :'invoice_lines',
    :'vat_lines' => :'vat_lines',
    :'notes' => :'notes',
    :'comment' => :'comment',
    :'current_user_id' => :'current_user_id',
    :'supplementary_attachments' => :'supplementary_attachments',
    :'payee' => :'payee',
    :'delivery_party' => :'delivery_party',
    :'tax_representative' => :'tax_representative',
    :'delivery_date' => :'delivery_date',
    :'billing_period_start' => :'billing_period_start',
    :'billing_period_end' => :'billing_period_end',
    :'payment_reference' => :'payment_reference',
    :'creditor_reference_id' => :'creditor_reference_id',
    :'direct_debit_mandate_id' => :'direct_debit_mandate_id',
    :'debtor_iban' => :'debtor_iban',
    :'payment_terms' => :'payment_terms',
    :'allowances_charges' => :'allowances_charges',
    :'additional_documents' => :'additional_documents',
    :'buyer_accounting_reference' => :'buyer_accounting_reference',
    :'payment_card' => :'payment_card'
  }
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



559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/factpulse/models/factur_x_invoice.rb', line 559

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullable ⇒ Object

List of attributes with nullable: true



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/factpulse/models/factur_x_invoice.rb', line 184

def self.openapi_nullable
  Set.new([
    :'comment',
    :'current_user_id',
    :'supplementary_attachments',
    :'payee',
    :'delivery_party',
    :'tax_representative',
    :'delivery_date',
    :'billing_period_start',
    :'billing_period_end',
    :'payment_reference',
    :'creditor_reference_id',
    :'direct_debit_mandate_id',
    :'debtor_iban',
    :'payment_terms',
    :'allowances_charges',
    :'additional_documents',
    :'buyer_accounting_reference',
    :'payment_card'
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



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
# File 'lib/factpulse/models/factur_x_invoice.rb', line 148

def self.openapi_types
  {
    :'invoice_number' => :'String',
    :'payment_due_date' => :'String',
    :'invoice_date' => :'String',
    :'submission_mode' => :'SubmissionMode',
    :'recipient' => :'Recipient',
    :'supplier' => :'Supplier',
    :'invoicing_framework' => :'InvoicingFramework',
    :'references' => :'InvoiceReferences',
    :'totals' => :'InvoiceTotals',
    :'invoice_lines' => :'Array<InvoiceLine>',
    :'vat_lines' => :'Array<VATLine>',
    :'notes' => :'Array<InvoiceNote>',
    :'comment' => :'String',
    :'current_user_id' => :'Integer',
    :'supplementary_attachments' => :'Array<SupplementaryAttachment>',
    :'payee' => :'Payee',
    :'delivery_party' => :'DeliveryParty',
    :'tax_representative' => :'TaxRepresentative',
    :'delivery_date' => :'String',
    :'billing_period_start' => :'String',
    :'billing_period_end' => :'String',
    :'payment_reference' => :'String',
    :'creditor_reference_id' => :'String',
    :'direct_debit_mandate_id' => :'String',
    :'debtor_iban' => :'String',
    :'payment_terms' => :'String',
    :'allowances_charges' => :'Array<AllowanceCharge>',
    :'additional_documents' => :'Array<AdditionalDocument>',
    :'buyer_accounting_reference' => :'String',
    :'payment_card' => :'PaymentCard'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



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
538
539
540
541
542
# File 'lib/factpulse/models/factur_x_invoice.rb', line 509

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      invoice_number == o.invoice_number &&
      payment_due_date == o.payment_due_date &&
      invoice_date == o.invoice_date &&
      submission_mode == o.submission_mode &&
      recipient == o.recipient &&
      supplier == o.supplier &&
      invoicing_framework == o.invoicing_framework &&
      references == o.references &&
      totals == o.totals &&
      invoice_lines == o.invoice_lines &&
      vat_lines == o.vat_lines &&
      notes == o.notes &&
      comment == o.comment &&
      current_user_id == o.current_user_id &&
      supplementary_attachments == o.supplementary_attachments &&
      payee == o.payee &&
      delivery_party == o.delivery_party &&
      tax_representative == o.tax_representative &&
      delivery_date == o.delivery_date &&
      billing_period_start == o.billing_period_start &&
      billing_period_end == o.billing_period_end &&
      payment_reference == o.payment_reference &&
      creditor_reference_id == o.creditor_reference_id &&
      direct_debit_mandate_id == o.direct_debit_mandate_id &&
      debtor_iban == o.debtor_iban &&
      payment_terms == o.payment_terms &&
      allowances_charges == o.allowances_charges &&
      additional_documents == o.additional_documents &&
      buyer_accounting_reference == o.buyer_accounting_reference &&
      payment_card == o.payment_card
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


546
547
548
# File 'lib/factpulse/models/factur_x_invoice.rb', line 546

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



552
553
554
# File 'lib/factpulse/models/factur_x_invoice.rb', line 552

def hash
  [invoice_number, payment_due_date, invoice_date, submission_mode, recipient, supplier, invoicing_framework, references, totals, invoice_lines, vat_lines, notes, comment, current_user_id, supplementary_attachments, payee, delivery_party, tax_representative, delivery_date, billing_period_start, billing_period_end, payment_reference, creditor_reference_id, direct_debit_mandate_id, debtor_iban, payment_terms, allowances_charges, additional_documents, buyer_accounting_reference, payment_card].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/factpulse/models/factur_x_invoice.rb', line 374

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @invoice_number.nil?
    invalid_properties.push('invalid value for "invoice_number", invoice_number cannot be nil.')
  end

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

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

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

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

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

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

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

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/factpulse/models/factur_x_invoice.rb', line 581

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid? ⇒ Boolean

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

Returns:

  • (Boolean) —

    true if the model is valid



414
415
416
417
418
419
420
421
422
423
424
425
# File 'lib/factpulse/models/factur_x_invoice.rb', line 414

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @invoice_number.nil?
  return false if @payment_due_date.nil?
  return false if @submission_mode.nil?
  return false if @recipient.nil?
  return false if @supplier.nil?
  return false if @invoicing_framework.nil?
  return false if @references.nil?
  return false if @totals.nil?
  true
end