factpulse 2.0.35 → 2.0.36

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -3
  3. data/Gemfile.lock +1 -1
  4. data/docs/BoundingBoxSchema.md +30 -0
  5. data/docs/CadreDeFacturation.md +2 -0
  6. data/docs/ChampVerifieSchema.md +34 -0
  7. data/docs/DimensionPageSchema.md +20 -0
  8. data/docs/DirectionFlux.md +15 -0
  9. data/docs/FluxResume.md +32 -0
  10. data/docs/LigneDeTVA.md +5 -1
  11. data/docs/NatureOperation.md +15 -0
  12. data/docs/NoteObligatoireSchema.md +30 -0
  13. data/docs/PDPCredentials.md +26 -0
  14. data/docs/ProfilFlux.md +15 -0
  15. data/docs/ReponseHealthcheckAFNOR.md +22 -0
  16. data/docs/ReponseRechercheFlux.md +24 -0
  17. data/docs/ReponseSoumissionFlux.md +30 -0
  18. data/docs/ReponseVerificationSucces.md +36 -0
  19. data/docs/RequeteRechercheFlux.md +34 -0
  20. data/docs/RequeteSoumissionFlux.md +28 -0
  21. data/docs/StatutAcquittement.md +15 -0
  22. data/docs/StatutChampAPI.md +15 -0
  23. data/docs/SyntaxeFlux.md +15 -0
  24. data/docs/TraitementFactureApi.md +2 -2
  25. data/docs/TypeFlux.md +15 -0
  26. data/docs/VrificationPDFXMLApi.md +435 -0
  27. data/lib/factpulse/api/traitement_facture_api.rb +4 -4
  28. data/lib/factpulse/api/vrification_pdfxml_api.rb +430 -0
  29. data/lib/factpulse/helpers/client.rb +2 -1
  30. data/lib/factpulse/models/bounding_box_schema.rb +332 -0
  31. data/lib/factpulse/models/cadre_de_facturation.rb +12 -2
  32. data/lib/factpulse/models/champ_verifie_schema.rb +334 -0
  33. data/lib/factpulse/models/dimension_page_schema.rb +193 -0
  34. data/lib/factpulse/models/direction_flux.rb +40 -0
  35. data/lib/factpulse/models/flux_resume.rb +251 -0
  36. data/lib/factpulse/models/ligne_de_tva.rb +26 -6
  37. data/lib/factpulse/models/nature_operation.rb +66 -0
  38. data/lib/factpulse/models/note_obligatoire_schema.rb +265 -0
  39. data/lib/factpulse/models/pdp_credentials.rb +257 -0
  40. data/lib/factpulse/models/profil_flux.rb +41 -0
  41. data/lib/factpulse/models/reponse_healthcheck_afnor.rb +220 -0
  42. data/lib/factpulse/models/reponse_recherche_flux.rb +249 -0
  43. data/lib/factpulse/models/reponse_soumission_flux.rb +294 -0
  44. data/lib/factpulse/models/reponse_verification_succes.rb +343 -0
  45. data/lib/factpulse/models/requete_recherche_flux.rb +306 -0
  46. data/lib/factpulse/models/requete_soumission_flux.rb +238 -0
  47. data/lib/factpulse/models/statut_acquittement.rb +41 -0
  48. data/lib/factpulse/models/statut_champ_api.rb +43 -0
  49. data/lib/factpulse/models/syntaxe_flux.rb +43 -0
  50. data/lib/factpulse/models/type_flux.rb +43 -0
  51. data/lib/factpulse/version.rb +1 -1
  52. data/lib/factpulse.rb +20 -0
  53. metadata +42 -2
@@ -0,0 +1,332 @@
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
+ # Coordonnées d'une zone rectangulaire dans le PDF. Les coordonnées sont en points PDF (1 point = 1/72 pouce). L'origine (0,0) est en bas à gauche de la page.
18
+ class BoundingBoxSchema < ApiModelBase
19
+ # Coordonnée X gauche
20
+ attr_accessor :x0
21
+
22
+ # Coordonnée Y bas
23
+ attr_accessor :y0
24
+
25
+ # Coordonnée X droite
26
+ attr_accessor :x1
27
+
28
+ # Coordonnée Y haut
29
+ attr_accessor :y1
30
+
31
+ # Numéro de page (0-indexed)
32
+ attr_accessor :page
33
+
34
+ # Largeur de la zone
35
+ attr_accessor :width
36
+
37
+ # Hauteur de la zone
38
+ attr_accessor :height
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'x0' => :'x0',
44
+ :'y0' => :'y0',
45
+ :'x1' => :'x1',
46
+ :'y1' => :'y1',
47
+ :'page' => :'page',
48
+ :'width' => :'width',
49
+ :'height' => :'height'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'x0' => :'Float',
67
+ :'y0' => :'Float',
68
+ :'x1' => :'Float',
69
+ :'y1' => :'Float',
70
+ :'page' => :'Integer',
71
+ :'width' => :'Float',
72
+ :'height' => :'Float'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::BoundingBoxSchema` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::BoundingBoxSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'x0')
99
+ self.x0 = attributes[:'x0']
100
+ else
101
+ self.x0 = nil
102
+ end
103
+
104
+ if attributes.key?(:'y0')
105
+ self.y0 = attributes[:'y0']
106
+ else
107
+ self.y0 = nil
108
+ end
109
+
110
+ if attributes.key?(:'x1')
111
+ self.x1 = attributes[:'x1']
112
+ else
113
+ self.x1 = nil
114
+ end
115
+
116
+ if attributes.key?(:'y1')
117
+ self.y1 = attributes[:'y1']
118
+ else
119
+ self.y1 = nil
120
+ end
121
+
122
+ if attributes.key?(:'page')
123
+ self.page = attributes[:'page']
124
+ else
125
+ self.page = 0
126
+ end
127
+
128
+ if attributes.key?(:'width')
129
+ self.width = attributes[:'width']
130
+ else
131
+ self.width = nil
132
+ end
133
+
134
+ if attributes.key?(:'height')
135
+ self.height = attributes[:'height']
136
+ else
137
+ self.height = nil
138
+ end
139
+ end
140
+
141
+ # Show invalid properties with the reasons. Usually used together with valid?
142
+ # @return Array for valid properties with the reasons
143
+ def list_invalid_properties
144
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
145
+ invalid_properties = Array.new
146
+ if @x0.nil?
147
+ invalid_properties.push('invalid value for "x0", x0 cannot be nil.')
148
+ end
149
+
150
+ if @y0.nil?
151
+ invalid_properties.push('invalid value for "y0", y0 cannot be nil.')
152
+ end
153
+
154
+ if @x1.nil?
155
+ invalid_properties.push('invalid value for "x1", x1 cannot be nil.')
156
+ end
157
+
158
+ if @y1.nil?
159
+ invalid_properties.push('invalid value for "y1", y1 cannot be nil.')
160
+ end
161
+
162
+ if !@page.nil? && @page < 0
163
+ invalid_properties.push('invalid value for "page", must be greater than or equal to 0.')
164
+ end
165
+
166
+ if @width.nil?
167
+ invalid_properties.push('invalid value for "width", width cannot be nil.')
168
+ end
169
+
170
+ if @height.nil?
171
+ invalid_properties.push('invalid value for "height", height cannot be nil.')
172
+ end
173
+
174
+ invalid_properties
175
+ end
176
+
177
+ # Check to see if the all the properties in the model are valid
178
+ # @return true if the model is valid
179
+ def valid?
180
+ warn '[DEPRECATED] the `valid?` method is obsolete'
181
+ return false if @x0.nil?
182
+ return false if @y0.nil?
183
+ return false if @x1.nil?
184
+ return false if @y1.nil?
185
+ return false if !@page.nil? && @page < 0
186
+ return false if @width.nil?
187
+ return false if @height.nil?
188
+ true
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] x0 Value to be assigned
193
+ def x0=(x0)
194
+ if x0.nil?
195
+ fail ArgumentError, 'x0 cannot be nil'
196
+ end
197
+
198
+ @x0 = x0
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] y0 Value to be assigned
203
+ def y0=(y0)
204
+ if y0.nil?
205
+ fail ArgumentError, 'y0 cannot be nil'
206
+ end
207
+
208
+ @y0 = y0
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] x1 Value to be assigned
213
+ def x1=(x1)
214
+ if x1.nil?
215
+ fail ArgumentError, 'x1 cannot be nil'
216
+ end
217
+
218
+ @x1 = x1
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] y1 Value to be assigned
223
+ def y1=(y1)
224
+ if y1.nil?
225
+ fail ArgumentError, 'y1 cannot be nil'
226
+ end
227
+
228
+ @y1 = y1
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] page Value to be assigned
233
+ def page=(page)
234
+ if page.nil?
235
+ fail ArgumentError, 'page cannot be nil'
236
+ end
237
+
238
+ if page < 0
239
+ fail ArgumentError, 'invalid value for "page", must be greater than or equal to 0.'
240
+ end
241
+
242
+ @page = page
243
+ end
244
+
245
+ # Custom attribute writer method with validation
246
+ # @param [Object] width Value to be assigned
247
+ def width=(width)
248
+ if width.nil?
249
+ fail ArgumentError, 'width cannot be nil'
250
+ end
251
+
252
+ @width = width
253
+ end
254
+
255
+ # Custom attribute writer method with validation
256
+ # @param [Object] height Value to be assigned
257
+ def height=(height)
258
+ if height.nil?
259
+ fail ArgumentError, 'height cannot be nil'
260
+ end
261
+
262
+ @height = height
263
+ end
264
+
265
+ # Checks equality by comparing each attribute.
266
+ # @param [Object] Object to be compared
267
+ def ==(o)
268
+ return true if self.equal?(o)
269
+ self.class == o.class &&
270
+ x0 == o.x0 &&
271
+ y0 == o.y0 &&
272
+ x1 == o.x1 &&
273
+ y1 == o.y1 &&
274
+ page == o.page &&
275
+ width == o.width &&
276
+ height == o.height
277
+ end
278
+
279
+ # @see the `==` method
280
+ # @param [Object] Object to be compared
281
+ def eql?(o)
282
+ self == o
283
+ end
284
+
285
+ # Calculates hash code according to all attributes.
286
+ # @return [Integer] Hash code
287
+ def hash
288
+ [x0, y0, x1, y1, page, width, height].hash
289
+ end
290
+
291
+ # Builds the object from hash
292
+ # @param [Hash] attributes Model attributes in the form of hash
293
+ # @return [Object] Returns the model itself
294
+ def self.build_from_hash(attributes)
295
+ return nil unless attributes.is_a?(Hash)
296
+ attributes = attributes.transform_keys(&:to_sym)
297
+ transformed_hash = {}
298
+ openapi_types.each_pair do |key, type|
299
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
300
+ transformed_hash["#{key}"] = nil
301
+ elsif type =~ /\AArray<(.*)>/i
302
+ # check to ensure the input is an array given that the attribute
303
+ # is documented as an array but the input is not
304
+ if attributes[attribute_map[key]].is_a?(Array)
305
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
306
+ end
307
+ elsif !attributes[attribute_map[key]].nil?
308
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
309
+ end
310
+ end
311
+ new(transformed_hash)
312
+ end
313
+
314
+ # Returns the object in the form of hash
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_hash
317
+ hash = {}
318
+ self.class.attribute_map.each_pair do |attr, param|
319
+ value = self.send(attr)
320
+ if value.nil?
321
+ is_nullable = self.class.openapi_nullable.include?(attr)
322
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
323
+ end
324
+
325
+ hash[param] = _to_hash(value)
326
+ end
327
+ hash
328
+ end
329
+
330
+ end
331
+
332
+ end
@@ -14,10 +14,12 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module FactPulse
17
- # Définit le cadre de facturation (ex: A1 pour une facture fournisseur).
17
+ # Définit le cadre de facturation. - code_cadre_facturation: Code Chorus Pro (A1, A2, A9, A12) - utilisé pour B2G - nature_operation: Nature de l'opération (B1, S1, M1, etc.) - prioritaire pour Factur-X Si nature_operation est fourni, il sera utilisé directement dans le XML Factur-X (BT-23). Sinon, le code sera déduit de code_cadre_facturation via un mapping automatique. Exemple: >>> cadre = CadreDeFacturation( ... code_cadre_facturation=CodeCadreFacturation.A1_FACTURE_FOURNISSEUR, ... nature_operation=NatureOperation.BIENS # Force B1 au lieu de S1 ... )
18
18
  class CadreDeFacturation < ApiModelBase
19
19
  attr_accessor :code_cadre_facturation
20
20
 
21
+ attr_accessor :nature_operation
22
+
21
23
  attr_accessor :code_service_valideur
22
24
 
23
25
  attr_accessor :code_structure_valideur
@@ -48,6 +50,7 @@ module FactPulse
48
50
  def self.attribute_map
49
51
  {
50
52
  :'code_cadre_facturation' => :'codeCadreFacturation',
53
+ :'nature_operation' => :'natureOperation',
51
54
  :'code_service_valideur' => :'codeServiceValideur',
52
55
  :'code_structure_valideur' => :'codeStructureValideur'
53
56
  }
@@ -67,6 +70,7 @@ module FactPulse
67
70
  def self.openapi_types
68
71
  {
69
72
  :'code_cadre_facturation' => :'CodeCadreFacturation',
73
+ :'nature_operation' => :'NatureOperation',
70
74
  :'code_service_valideur' => :'String',
71
75
  :'code_structure_valideur' => :'String'
72
76
  }
@@ -75,6 +79,7 @@ module FactPulse
75
79
  # List of attributes with nullable: true
76
80
  def self.openapi_nullable
77
81
  Set.new([
82
+ :'nature_operation',
78
83
  :'code_service_valideur',
79
84
  :'code_structure_valideur'
80
85
  ])
@@ -102,6 +107,10 @@ module FactPulse
102
107
  self.code_cadre_facturation = nil
103
108
  end
104
109
 
110
+ if attributes.key?(:'nature_operation')
111
+ self.nature_operation = attributes[:'nature_operation']
112
+ end
113
+
105
114
  if attributes.key?(:'code_service_valideur')
106
115
  self.code_service_valideur = attributes[:'code_service_valideur']
107
116
  end
@@ -147,6 +156,7 @@ module FactPulse
147
156
  return true if self.equal?(o)
148
157
  self.class == o.class &&
149
158
  code_cadre_facturation == o.code_cadre_facturation &&
159
+ nature_operation == o.nature_operation &&
150
160
  code_service_valideur == o.code_service_valideur &&
151
161
  code_structure_valideur == o.code_structure_valideur
152
162
  end
@@ -160,7 +170,7 @@ module FactPulse
160
170
  # Calculates hash code according to all attributes.
161
171
  # @return [Integer] Hash code
162
172
  def hash
163
- [code_cadre_facturation, code_service_valideur, code_structure_valideur].hash
173
+ [code_cadre_facturation, nature_operation, code_service_valideur, code_structure_valideur].hash
164
174
  end
165
175
 
166
176
  # Builds the object from hash