Class: FactPulse::FactureEntrante

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

Overview

Facture reçue d’un fournisseur via PDP/PA. Ce modèle contient les métadonnées essentielles extraites des factures entrantes, quel que soit leur format source (CII, UBL, Factur-X). Les montants sont en Decimal en Python mais seront sérialisés en string dans le JSON pour préserver la précision monétaire.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/factpulse/models/facture_entrante.rb', line 166

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'devise')
    self.devise = attributes[:'devise']
  else
    self.devise = 'EUR'
  end

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#date_de_pieceObject

Date de la facture (BT-2) - YYYY-MM-DD



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

def date_de_piece
  @date_de_piece
end

#date_reglementObject

Returns the value of attribute date_reglement.



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

def date_reglement
  @date_reglement
end

#deviseObject

Code devise ISO (BT-5)



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

def devise
  @devise
end

#document_base64Object

Returns the value of attribute document_base64.



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

def document_base64
  @document_base64
end

#document_content_typeObject

Returns the value of attribute document_content_type.



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

def document_content_type
  @document_content_type
end

#document_filenameObject

Returns the value of attribute document_filename.



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

def document_filename
  @document_filename
end

#flow_idObject

Returns the value of attribute flow_id.



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

def flow_id
  @flow_id
end

#format_sourceObject

Format source de la facture



22
23
24
# File 'lib/factpulse/models/facture_entrante.rb', line 22

def format_source
  @format_source
end

#fournisseurObject

Émetteur de la facture (SellerTradeParty)



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

def fournisseur
  @fournisseur
end

#montant_htObject

Montant HT total (BT-109)



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

def montant_ht
  @montant_ht
end

#montant_ttcObject

Montant TTC total (BT-112)



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

def montant_ttc
  @montant_ttc
end

#montant_tvaObject

Montant TVA total (BT-110)



50
51
52
# File 'lib/factpulse/models/facture_entrante.rb', line 50

def montant_tva
  @montant_tva
end

#numero_bon_commandeObject

Returns the value of attribute numero_bon_commande.



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

def numero_bon_commande
  @numero_bon_commande
end

#objet_factureObject

Returns the value of attribute objet_facture.



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

def objet_facture
  @objet_facture
end

#ref_fournisseurObject

Numéro de facture émis par le fournisseur (BT-1)



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

def ref_fournisseur
  @ref_fournisseur
end

#reference_contratObject

Returns the value of attribute reference_contrat.



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

def reference_contrat
  @reference_contrat
end

#site_facturation_nomObject

Nom du destinataire / votre entreprise (BT-44)



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

def site_facturation_nom
  @site_facturation_nom
end

#site_facturation_siretObject

Returns the value of attribute site_facturation_siret.



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

def site_facturation_siret
  @site_facturation_siret
end

#type_documentObject

Type de document (BT-3)



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

def type_document
  @type_document
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



115
116
117
# File 'lib/factpulse/models/facture_entrante.rb', line 115

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



120
121
122
# File 'lib/factpulse/models/facture_entrante.rb', line 120

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/factpulse/models/facture_entrante.rb', line 90

def self.attribute_map
  {
    :'flow_id' => :'flow_id',
    :'format_source' => :'format_source',
    :'ref_fournisseur' => :'ref_fournisseur',
    :'type_document' => :'type_document',
    :'fournisseur' => :'fournisseur',
    :'site_facturation_nom' => :'site_facturation_nom',
    :'site_facturation_siret' => :'site_facturation_siret',
    :'date_de_piece' => :'date_de_piece',
    :'date_reglement' => :'date_reglement',
    :'devise' => :'devise',
    :'montant_ht' => :'montant_ht',
    :'montant_tva' => :'montant_tva',
    :'montant_ttc' => :'montant_ttc',
    :'numero_bon_commande' => :'numero_bon_commande',
    :'reference_contrat' => :'reference_contrat',
    :'objet_facture' => :'objet_facture',
    :'document_base64' => :'document_base64',
    :'document_content_type' => :'document_content_type',
    :'document_filename' => :'document_filename'
  }
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



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/factpulse/models/facture_entrante.rb', line 484

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



150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/factpulse/models/facture_entrante.rb', line 150

def self.openapi_nullable
  Set.new([
    :'flow_id',
    :'site_facturation_siret',
    :'date_reglement',
    :'numero_bon_commande',
    :'reference_contrat',
    :'objet_facture',
    :'document_base64',
    :'document_content_type',
    :'document_filename'
  ])
end

.openapi_typesObject

Attribute type mapping.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/factpulse/models/facture_entrante.rb', line 125

def self.openapi_types
  {
    :'flow_id' => :'String',
    :'format_source' => :'FormatFacture',
    :'ref_fournisseur' => :'String',
    :'type_document' => :'TypeDocument',
    :'fournisseur' => :'FournisseurEntrant',
    :'site_facturation_nom' => :'String',
    :'site_facturation_siret' => :'String',
    :'date_de_piece' => :'String',
    :'date_reglement' => :'String',
    :'devise' => :'String',
    :'montant_ht' => :'String',
    :'montant_tva' => :'String',
    :'montant_ttc' => :'String',
    :'numero_bon_commande' => :'String',
    :'reference_contrat' => :'String',
    :'objet_facture' => :'String',
    :'document_base64' => :'String',
    :'document_content_type' => :'String',
    :'document_filename' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/factpulse/models/facture_entrante.rb', line 445

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      flow_id == o.flow_id &&
      format_source == o.format_source &&
      ref_fournisseur == o.ref_fournisseur &&
      type_document == o.type_document &&
      fournisseur == o.fournisseur &&
      site_facturation_nom == o.site_facturation_nom &&
      site_facturation_siret == o.site_facturation_siret &&
      date_de_piece == o.date_de_piece &&
      date_reglement == o.date_reglement &&
      devise == o.devise &&
      montant_ht == o.montant_ht &&
      montant_tva == o.montant_tva &&
      montant_ttc == o.montant_ttc &&
      numero_bon_commande == o.numero_bon_commande &&
      reference_contrat == o.reference_contrat &&
      objet_facture == o.objet_facture &&
      document_base64 == o.document_base64 &&
      document_content_type == o.document_content_type &&
      document_filename == o.document_filename
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


471
472
473
# File 'lib/factpulse/models/facture_entrante.rb', line 471

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



477
478
479
# File 'lib/factpulse/models/facture_entrante.rb', line 477

def hash
  [flow_id, format_source, ref_fournisseur, type_document, fournisseur, site_facturation_nom, site_facturation_siret, date_de_piece, date_reglement, devise, montant_ht, montant_tva, montant_ttc, numero_bon_commande, reference_contrat, objet_facture, document_base64, document_content_type, document_filename].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/factpulse/models/facture_entrante.rb', line 277

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

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

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

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

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

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

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  if @montant_ht !~ pattern
    invalid_properties.push("invalid value for \"montant_ht\", must conform to the pattern #{pattern}.")
  end

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

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  if @montant_tva !~ pattern
    invalid_properties.push("invalid value for \"montant_tva\", must conform to the pattern #{pattern}.")
  end

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

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  if @montant_ttc !~ pattern
    invalid_properties.push("invalid value for \"montant_ttc\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/factpulse/models/facture_entrante.rb', line 506

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



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/factpulse/models/facture_entrante.rb', line 332

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @format_source.nil?
  return false if @ref_fournisseur.nil?
  return false if @fournisseur.nil?
  return false if @site_facturation_nom.nil?
  return false if @date_de_piece.nil?
  return false if @montant_ht.nil?
  return false if @montant_ht !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  return false if @montant_tva.nil?
  return false if @montant_tva !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  return false if @montant_ttc.nil?
  return false if @montant_ttc !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  true
end