factpulse 2.0.29 → 2.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,492 @@
1
+ =begin
2
+ #API REST FactPulse
3
+
4
+ # API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Paramètre optionnel `client_uid` :** Pour sélectionner les credentials d'un client spécifique (PA/PDP, Chorus Pro, certificats de signature), ajoutez `client_uid` : ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` Le `client_uid` sera inclus dans le JWT et permettra à l'API d'utiliser automatiquement : - Les credentials AFNOR/PDP configurés pour ce client - Les credentials Chorus Pro configurés pour ce client - Les certificats de signature électronique configurés pour ce client **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # 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.
18
+ class FactureEntrante < ApiModelBase
19
+ attr_accessor :flow_id
20
+
21
+ # Format source de la facture
22
+ attr_accessor :format_source
23
+
24
+ # Numéro de facture émis par le fournisseur (BT-1)
25
+ attr_accessor :ref_fournisseur
26
+
27
+ # Type de document (BT-3)
28
+ attr_accessor :type_document
29
+
30
+ # Émetteur de la facture (SellerTradeParty)
31
+ attr_accessor :fournisseur
32
+
33
+ # Nom du destinataire / votre entreprise (BT-44)
34
+ attr_accessor :site_facturation_nom
35
+
36
+ attr_accessor :site_facturation_siret
37
+
38
+ # Date de la facture (BT-2) - YYYY-MM-DD
39
+ attr_accessor :date_de_piece
40
+
41
+ attr_accessor :date_reglement
42
+
43
+ # Code devise ISO (BT-5)
44
+ attr_accessor :devise
45
+
46
+ # Montant HT total (BT-109)
47
+ attr_accessor :montant_ht
48
+
49
+ # Montant TVA total (BT-110)
50
+ attr_accessor :montant_tva
51
+
52
+ # Montant TTC total (BT-112)
53
+ attr_accessor :montant_ttc
54
+
55
+ attr_accessor :numero_bon_commande
56
+
57
+ attr_accessor :reference_contrat
58
+
59
+ attr_accessor :objet_facture
60
+
61
+ class EnumAttributeValidator
62
+ attr_reader :datatype
63
+ attr_reader :allowable_values
64
+
65
+ def initialize(datatype, allowable_values)
66
+ @allowable_values = allowable_values.map do |value|
67
+ case datatype.to_s
68
+ when /Integer/i
69
+ value.to_i
70
+ when /Float/i
71
+ value.to_f
72
+ else
73
+ value
74
+ end
75
+ end
76
+ end
77
+
78
+ def valid?(value)
79
+ !value || allowable_values.include?(value)
80
+ end
81
+ end
82
+
83
+ # Attribute mapping from ruby-style variable name to JSON key.
84
+ def self.attribute_map
85
+ {
86
+ :'flow_id' => :'flow_id',
87
+ :'format_source' => :'format_source',
88
+ :'ref_fournisseur' => :'ref_fournisseur',
89
+ :'type_document' => :'type_document',
90
+ :'fournisseur' => :'fournisseur',
91
+ :'site_facturation_nom' => :'site_facturation_nom',
92
+ :'site_facturation_siret' => :'site_facturation_siret',
93
+ :'date_de_piece' => :'date_de_piece',
94
+ :'date_reglement' => :'date_reglement',
95
+ :'devise' => :'devise',
96
+ :'montant_ht' => :'montant_ht',
97
+ :'montant_tva' => :'montant_tva',
98
+ :'montant_ttc' => :'montant_ttc',
99
+ :'numero_bon_commande' => :'numero_bon_commande',
100
+ :'reference_contrat' => :'reference_contrat',
101
+ :'objet_facture' => :'objet_facture'
102
+ }
103
+ end
104
+
105
+ # Returns attribute mapping this model knows about
106
+ def self.acceptable_attribute_map
107
+ attribute_map
108
+ end
109
+
110
+ # Returns all the JSON keys this model knows about
111
+ def self.acceptable_attributes
112
+ acceptable_attribute_map.values
113
+ end
114
+
115
+ # Attribute type mapping.
116
+ def self.openapi_types
117
+ {
118
+ :'flow_id' => :'String',
119
+ :'format_source' => :'FormatFacture',
120
+ :'ref_fournisseur' => :'String',
121
+ :'type_document' => :'TypeDocument',
122
+ :'fournisseur' => :'FournisseurEntrant',
123
+ :'site_facturation_nom' => :'String',
124
+ :'site_facturation_siret' => :'String',
125
+ :'date_de_piece' => :'String',
126
+ :'date_reglement' => :'String',
127
+ :'devise' => :'String',
128
+ :'montant_ht' => :'String',
129
+ :'montant_tva' => :'String',
130
+ :'montant_ttc' => :'String',
131
+ :'numero_bon_commande' => :'String',
132
+ :'reference_contrat' => :'String',
133
+ :'objet_facture' => :'String'
134
+ }
135
+ end
136
+
137
+ # List of attributes with nullable: true
138
+ def self.openapi_nullable
139
+ Set.new([
140
+ :'flow_id',
141
+ :'site_facturation_siret',
142
+ :'date_reglement',
143
+ :'numero_bon_commande',
144
+ :'reference_contrat',
145
+ :'objet_facture'
146
+ ])
147
+ end
148
+
149
+ # Initializes the object
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ def initialize(attributes = {})
152
+ if (!attributes.is_a?(Hash))
153
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::FactureEntrante` initialize method"
154
+ end
155
+
156
+ # check to see if the attribute exists and convert string to symbol for hash key
157
+ acceptable_attribute_map = self.class.acceptable_attribute_map
158
+ attributes = attributes.each_with_object({}) { |(k, v), h|
159
+ if (!acceptable_attribute_map.key?(k.to_sym))
160
+ 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
161
+ end
162
+ h[k.to_sym] = v
163
+ }
164
+
165
+ if attributes.key?(:'flow_id')
166
+ self.flow_id = attributes[:'flow_id']
167
+ end
168
+
169
+ if attributes.key?(:'format_source')
170
+ self.format_source = attributes[:'format_source']
171
+ else
172
+ self.format_source = nil
173
+ end
174
+
175
+ if attributes.key?(:'ref_fournisseur')
176
+ self.ref_fournisseur = attributes[:'ref_fournisseur']
177
+ else
178
+ self.ref_fournisseur = nil
179
+ end
180
+
181
+ if attributes.key?(:'type_document')
182
+ self.type_document = attributes[:'type_document']
183
+ end
184
+
185
+ if attributes.key?(:'fournisseur')
186
+ self.fournisseur = attributes[:'fournisseur']
187
+ else
188
+ self.fournisseur = nil
189
+ end
190
+
191
+ if attributes.key?(:'site_facturation_nom')
192
+ self.site_facturation_nom = attributes[:'site_facturation_nom']
193
+ else
194
+ self.site_facturation_nom = nil
195
+ end
196
+
197
+ if attributes.key?(:'site_facturation_siret')
198
+ self.site_facturation_siret = attributes[:'site_facturation_siret']
199
+ end
200
+
201
+ if attributes.key?(:'date_de_piece')
202
+ self.date_de_piece = attributes[:'date_de_piece']
203
+ else
204
+ self.date_de_piece = nil
205
+ end
206
+
207
+ if attributes.key?(:'date_reglement')
208
+ self.date_reglement = attributes[:'date_reglement']
209
+ end
210
+
211
+ if attributes.key?(:'devise')
212
+ self.devise = attributes[:'devise']
213
+ else
214
+ self.devise = 'EUR'
215
+ end
216
+
217
+ if attributes.key?(:'montant_ht')
218
+ self.montant_ht = attributes[:'montant_ht']
219
+ else
220
+ self.montant_ht = nil
221
+ end
222
+
223
+ if attributes.key?(:'montant_tva')
224
+ self.montant_tva = attributes[:'montant_tva']
225
+ else
226
+ self.montant_tva = nil
227
+ end
228
+
229
+ if attributes.key?(:'montant_ttc')
230
+ self.montant_ttc = attributes[:'montant_ttc']
231
+ else
232
+ self.montant_ttc = nil
233
+ end
234
+
235
+ if attributes.key?(:'numero_bon_commande')
236
+ self.numero_bon_commande = attributes[:'numero_bon_commande']
237
+ end
238
+
239
+ if attributes.key?(:'reference_contrat')
240
+ self.reference_contrat = attributes[:'reference_contrat']
241
+ end
242
+
243
+ if attributes.key?(:'objet_facture')
244
+ self.objet_facture = attributes[:'objet_facture']
245
+ end
246
+ end
247
+
248
+ # Show invalid properties with the reasons. Usually used together with valid?
249
+ # @return Array for valid properties with the reasons
250
+ def list_invalid_properties
251
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
252
+ invalid_properties = Array.new
253
+ if @format_source.nil?
254
+ invalid_properties.push('invalid value for "format_source", format_source cannot be nil.')
255
+ end
256
+
257
+ if @ref_fournisseur.nil?
258
+ invalid_properties.push('invalid value for "ref_fournisseur", ref_fournisseur cannot be nil.')
259
+ end
260
+
261
+ if @fournisseur.nil?
262
+ invalid_properties.push('invalid value for "fournisseur", fournisseur cannot be nil.')
263
+ end
264
+
265
+ if @site_facturation_nom.nil?
266
+ invalid_properties.push('invalid value for "site_facturation_nom", site_facturation_nom cannot be nil.')
267
+ end
268
+
269
+ if @date_de_piece.nil?
270
+ invalid_properties.push('invalid value for "date_de_piece", date_de_piece cannot be nil.')
271
+ end
272
+
273
+ if @montant_ht.nil?
274
+ invalid_properties.push('invalid value for "montant_ht", montant_ht cannot be nil.')
275
+ end
276
+
277
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
278
+ if @montant_ht !~ pattern
279
+ invalid_properties.push("invalid value for \"montant_ht\", must conform to the pattern #{pattern}.")
280
+ end
281
+
282
+ if @montant_tva.nil?
283
+ invalid_properties.push('invalid value for "montant_tva", montant_tva cannot be nil.')
284
+ end
285
+
286
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
287
+ if @montant_tva !~ pattern
288
+ invalid_properties.push("invalid value for \"montant_tva\", must conform to the pattern #{pattern}.")
289
+ end
290
+
291
+ if @montant_ttc.nil?
292
+ invalid_properties.push('invalid value for "montant_ttc", montant_ttc cannot be nil.')
293
+ end
294
+
295
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
296
+ if @montant_ttc !~ pattern
297
+ invalid_properties.push("invalid value for \"montant_ttc\", must conform to the pattern #{pattern}.")
298
+ end
299
+
300
+ invalid_properties
301
+ end
302
+
303
+ # Check to see if the all the properties in the model are valid
304
+ # @return true if the model is valid
305
+ def valid?
306
+ warn '[DEPRECATED] the `valid?` method is obsolete'
307
+ return false if @format_source.nil?
308
+ return false if @ref_fournisseur.nil?
309
+ return false if @fournisseur.nil?
310
+ return false if @site_facturation_nom.nil?
311
+ return false if @date_de_piece.nil?
312
+ return false if @montant_ht.nil?
313
+ return false if @montant_ht !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
314
+ return false if @montant_tva.nil?
315
+ return false if @montant_tva !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
316
+ return false if @montant_ttc.nil?
317
+ return false if @montant_ttc !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
318
+ true
319
+ end
320
+
321
+ # Custom attribute writer method with validation
322
+ # @param [Object] format_source Value to be assigned
323
+ def format_source=(format_source)
324
+ if format_source.nil?
325
+ fail ArgumentError, 'format_source cannot be nil'
326
+ end
327
+
328
+ @format_source = format_source
329
+ end
330
+
331
+ # Custom attribute writer method with validation
332
+ # @param [Object] ref_fournisseur Value to be assigned
333
+ def ref_fournisseur=(ref_fournisseur)
334
+ if ref_fournisseur.nil?
335
+ fail ArgumentError, 'ref_fournisseur cannot be nil'
336
+ end
337
+
338
+ @ref_fournisseur = ref_fournisseur
339
+ end
340
+
341
+ # Custom attribute writer method with validation
342
+ # @param [Object] fournisseur Value to be assigned
343
+ def fournisseur=(fournisseur)
344
+ if fournisseur.nil?
345
+ fail ArgumentError, 'fournisseur cannot be nil'
346
+ end
347
+
348
+ @fournisseur = fournisseur
349
+ end
350
+
351
+ # Custom attribute writer method with validation
352
+ # @param [Object] site_facturation_nom Value to be assigned
353
+ def site_facturation_nom=(site_facturation_nom)
354
+ if site_facturation_nom.nil?
355
+ fail ArgumentError, 'site_facturation_nom cannot be nil'
356
+ end
357
+
358
+ @site_facturation_nom = site_facturation_nom
359
+ end
360
+
361
+ # Custom attribute writer method with validation
362
+ # @param [Object] date_de_piece Value to be assigned
363
+ def date_de_piece=(date_de_piece)
364
+ if date_de_piece.nil?
365
+ fail ArgumentError, 'date_de_piece cannot be nil'
366
+ end
367
+
368
+ @date_de_piece = date_de_piece
369
+ end
370
+
371
+ # Custom attribute writer method with validation
372
+ # @param [Object] montant_ht Value to be assigned
373
+ def montant_ht=(montant_ht)
374
+ if montant_ht.nil?
375
+ fail ArgumentError, 'montant_ht cannot be nil'
376
+ end
377
+
378
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
379
+ if montant_ht !~ pattern
380
+ fail ArgumentError, "invalid value for \"montant_ht\", must conform to the pattern #{pattern}."
381
+ end
382
+
383
+ @montant_ht = montant_ht
384
+ end
385
+
386
+ # Custom attribute writer method with validation
387
+ # @param [Object] montant_tva Value to be assigned
388
+ def montant_tva=(montant_tva)
389
+ if montant_tva.nil?
390
+ fail ArgumentError, 'montant_tva cannot be nil'
391
+ end
392
+
393
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
394
+ if montant_tva !~ pattern
395
+ fail ArgumentError, "invalid value for \"montant_tva\", must conform to the pattern #{pattern}."
396
+ end
397
+
398
+ @montant_tva = montant_tva
399
+ end
400
+
401
+ # Custom attribute writer method with validation
402
+ # @param [Object] montant_ttc Value to be assigned
403
+ def montant_ttc=(montant_ttc)
404
+ if montant_ttc.nil?
405
+ fail ArgumentError, 'montant_ttc cannot be nil'
406
+ end
407
+
408
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
409
+ if montant_ttc !~ pattern
410
+ fail ArgumentError, "invalid value for \"montant_ttc\", must conform to the pattern #{pattern}."
411
+ end
412
+
413
+ @montant_ttc = montant_ttc
414
+ end
415
+
416
+ # Checks equality by comparing each attribute.
417
+ # @param [Object] Object to be compared
418
+ def ==(o)
419
+ return true if self.equal?(o)
420
+ self.class == o.class &&
421
+ flow_id == o.flow_id &&
422
+ format_source == o.format_source &&
423
+ ref_fournisseur == o.ref_fournisseur &&
424
+ type_document == o.type_document &&
425
+ fournisseur == o.fournisseur &&
426
+ site_facturation_nom == o.site_facturation_nom &&
427
+ site_facturation_siret == o.site_facturation_siret &&
428
+ date_de_piece == o.date_de_piece &&
429
+ date_reglement == o.date_reglement &&
430
+ devise == o.devise &&
431
+ montant_ht == o.montant_ht &&
432
+ montant_tva == o.montant_tva &&
433
+ montant_ttc == o.montant_ttc &&
434
+ numero_bon_commande == o.numero_bon_commande &&
435
+ reference_contrat == o.reference_contrat &&
436
+ objet_facture == o.objet_facture
437
+ end
438
+
439
+ # @see the `==` method
440
+ # @param [Object] Object to be compared
441
+ def eql?(o)
442
+ self == o
443
+ end
444
+
445
+ # Calculates hash code according to all attributes.
446
+ # @return [Integer] Hash code
447
+ def hash
448
+ [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].hash
449
+ end
450
+
451
+ # Builds the object from hash
452
+ # @param [Hash] attributes Model attributes in the form of hash
453
+ # @return [Object] Returns the model itself
454
+ def self.build_from_hash(attributes)
455
+ return nil unless attributes.is_a?(Hash)
456
+ attributes = attributes.transform_keys(&:to_sym)
457
+ transformed_hash = {}
458
+ openapi_types.each_pair do |key, type|
459
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
460
+ transformed_hash["#{key}"] = nil
461
+ elsif type =~ /\AArray<(.*)>/i
462
+ # check to ensure the input is an array given that the attribute
463
+ # is documented as an array but the input is not
464
+ if attributes[attribute_map[key]].is_a?(Array)
465
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
466
+ end
467
+ elsif !attributes[attribute_map[key]].nil?
468
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
469
+ end
470
+ end
471
+ new(transformed_hash)
472
+ end
473
+
474
+ # Returns the object in the form of hash
475
+ # @return [Hash] Returns the object in the form of hash
476
+ def to_hash
477
+ hash = {}
478
+ self.class.attribute_map.each_pair do |attr, param|
479
+ value = self.send(attr)
480
+ if value.nil?
481
+ is_nullable = self.class.openapi_nullable.include?(attr)
482
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
483
+ end
484
+
485
+ hash[param] = _to_hash(value)
486
+ end
487
+ hash
488
+ end
489
+
490
+ end
491
+
492
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #API REST FactPulse
3
+
4
+ # API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Paramètre optionnel `client_uid` :** Pour sélectionner les credentials d'un client spécifique (PA/PDP, Chorus Pro, certificats de signature), ajoutez `client_uid` : ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` Le `client_uid` sera inclus dans le JWT et permettra à l'API d'utiliser automatiquement : - Les credentials AFNOR/PDP configurés pour ce client - Les credentials Chorus Pro configurés pour ce client - Les certificats de signature électronique configurés pour ce client **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ class FormatFacture
18
+ CII = "CII".freeze
19
+ UBL = "UBL".freeze
20
+ FACTUR_X = "Factur-X".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [CII, UBL, FACTUR_X].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if FormatFacture.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #FormatFacture"
39
+ end
40
+ end
41
+ end