Class: FactPulse::InvoiceInput

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

Overview

Invoice for B2B international reporting (flux 10.1). Used for unitary declaration of international B2B invoices. Supports three scenarios: - B2Bi: French seller → Foreign buyer (issuer role = SE) - Bi2B: Foreign seller → French buyer (issuer role = BY) - Bi2Bi: Foreign seller → Foreign buyer (issuer role = SE or BY) Source: Annexe 6 v1.9, bloc TG-8 \“Invoice\”

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 = {}) ⇒ InvoiceInput

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::InvoiceInput` 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::InvoiceInput`. 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_id')
    self.invoice_id = attributes[:'invoice_id']
  else
    self.invoice_id = nil
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#buyer_countryObject

Returns the value of attribute buyer_country.



44
45
46
# File 'lib/factpulse/models/invoice_input.rb', line 44

def buyer_country
  @buyer_country
end

#buyer_idObject

Returns the value of attribute buyer_id.



40
41
42
# File 'lib/factpulse/models/invoice_input.rb', line 40

def buyer_id
  @buyer_id
end

#buyer_vat_idObject

Returns the value of attribute buyer_vat_id.



42
43
44
# File 'lib/factpulse/models/invoice_input.rb', line 42

def buyer_vat_id
  @buyer_vat_id
end

#currencyObject

Returns the value of attribute currency.



28
29
30
# File 'lib/factpulse/models/invoice_input.rb', line 28

def currency
  @currency
end

#due_dateObject

Returns the value of attribute due_date.



30
31
32
# File 'lib/factpulse/models/invoice_input.rb', line 30

def due_date
  @due_date
end

#invoice_idObject

Invoice identifier



20
21
22
# File 'lib/factpulse/models/invoice_input.rb', line 20

def invoice_id
  @invoice_id
end

#issue_dateObject

Invoice issue date



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

def issue_date
  @issue_date
end

#referenced_invoice_dateObject

Returns the value of attribute referenced_invoice_date.



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

def referenced_invoice_date
  @referenced_invoice_date
end

#referenced_invoice_idObject

Returns the value of attribute referenced_invoice_id.



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

def referenced_invoice_id
  @referenced_invoice_id
end

#seller_countryObject

Returns the value of attribute seller_country.



38
39
40
# File 'lib/factpulse/models/invoice_input.rb', line 38

def seller_country
  @seller_country
end

#seller_idObject

Returns the value of attribute seller_id.



32
33
34
# File 'lib/factpulse/models/invoice_input.rb', line 32

def seller_id
  @seller_id
end

#seller_sirenObject

Returns the value of attribute seller_siren.



34
35
36
# File 'lib/factpulse/models/invoice_input.rb', line 34

def seller_siren
  @seller_siren
end

#seller_vat_idObject

Returns the value of attribute seller_vat_id.



36
37
38
# File 'lib/factpulse/models/invoice_input.rb', line 36

def seller_vat_id
  @seller_vat_id
end

#tax_amountObject

Returns the value of attribute tax_amount.



48
49
50
# File 'lib/factpulse/models/invoice_input.rb', line 48

def tax_amount
  @tax_amount
end

#tax_breakdownObject

VAT breakdown



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

def tax_breakdown
  @tax_breakdown
end

#tax_exclusive_amountObject

Returns the value of attribute tax_exclusive_amount.



46
47
48
# File 'lib/factpulse/models/invoice_input.rb', line 46

def tax_exclusive_amount
  @tax_exclusive_amount
end

#type_codeObject

Invoice type code



26
27
28
# File 'lib/factpulse/models/invoice_input.rb', line 26

def type_code
  @type_code
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



103
104
105
# File 'lib/factpulse/models/invoice_input.rb', line 103

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



108
109
110
# File 'lib/factpulse/models/invoice_input.rb', line 108

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/factpulse/models/invoice_input.rb', line 80

def self.attribute_map
  {
    :'invoice_id' => :'invoiceId',
    :'issue_date' => :'issueDate',
    :'type_code' => :'typeCode',
    :'currency' => :'currency',
    :'due_date' => :'dueDate',
    :'seller_id' => :'sellerId',
    :'seller_siren' => :'sellerSiren',
    :'seller_vat_id' => :'sellerVatId',
    :'seller_country' => :'sellerCountry',
    :'buyer_id' => :'buyerId',
    :'buyer_vat_id' => :'buyerVatId',
    :'buyer_country' => :'buyerCountry',
    :'tax_exclusive_amount' => :'taxExclusiveAmount',
    :'tax_amount' => :'taxAmount',
    :'tax_breakdown' => :'taxBreakdown',
    :'referenced_invoice_id' => :'referencedInvoiceId',
    :'referenced_invoice_date' => :'referencedInvoiceDate'
  }
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



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/factpulse/models/invoice_input.rb', line 401

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_nullableObject

List of attributes with nullable: true



136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/factpulse/models/invoice_input.rb', line 136

def self.openapi_nullable
  Set.new([
    :'due_date',
    :'seller_id',
    :'seller_siren',
    :'seller_vat_id',
    :'buyer_id',
    :'buyer_vat_id',
    :'referenced_invoice_id',
    :'referenced_invoice_date'
  ])
end

.openapi_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/factpulse/models/invoice_input.rb', line 113

def self.openapi_types
  {
    :'invoice_id' => :'String',
    :'issue_date' => :'Date',
    :'type_code' => :'FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode',
    :'currency' => :'Currency',
    :'due_date' => :'Date',
    :'seller_id' => :'String',
    :'seller_siren' => :'String',
    :'seller_vat_id' => :'String',
    :'seller_country' => :'Sellercountry',
    :'buyer_id' => :'String',
    :'buyer_vat_id' => :'String',
    :'buyer_country' => :'Buyercountry',
    :'tax_exclusive_amount' => :'Taxexclusiveamount1',
    :'tax_amount' => :'Taxamount1',
    :'tax_breakdown' => :'Array<TaxBreakdownInput>',
    :'referenced_invoice_id' => :'String',
    :'referenced_invoice_date' => :'Date'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/factpulse/models/invoice_input.rb', line 364

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      invoice_id == o.invoice_id &&
      issue_date == o.issue_date &&
      type_code == o.type_code &&
      currency == o.currency &&
      due_date == o.due_date &&
      seller_id == o.seller_id &&
      seller_siren == o.seller_siren &&
      seller_vat_id == o.seller_vat_id &&
      seller_country == o.seller_country &&
      buyer_id == o.buyer_id &&
      buyer_vat_id == o.buyer_vat_id &&
      buyer_country == o.buyer_country &&
      tax_exclusive_amount == o.tax_exclusive_amount &&
      tax_amount == o.tax_amount &&
      tax_breakdown == o.tax_breakdown &&
      referenced_invoice_id == o.referenced_invoice_id &&
      referenced_invoice_date == o.referenced_invoice_date
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


388
389
390
# File 'lib/factpulse/models/invoice_input.rb', line 388

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



394
395
396
# File 'lib/factpulse/models/invoice_input.rb', line 394

def hash
  [invoice_id, issue_date, type_code, currency, due_date, seller_id, seller_siren, seller_vat_id, seller_country, buyer_id, buyer_vat_id, buyer_country, tax_exclusive_amount, tax_amount, tax_breakdown, referenced_invoice_id, referenced_invoice_date].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

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

  if @tax_breakdown.length < 1
    invalid_properties.push('invalid value for "tax_breakdown", number of items must be greater than or equal to 1.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/factpulse/models/invoice_input.rb', line 423

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



286
287
288
289
290
291
292
293
294
295
296
# File 'lib/factpulse/models/invoice_input.rb', line 286

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @invoice_id.nil?
  return false if @issue_date.nil?
  return false if @buyer_country.nil?
  return false if @tax_exclusive_amount.nil?
  return false if @tax_amount.nil?
  return false if @tax_breakdown.nil?
  return false if @tax_breakdown.length < 1
  true
end