factpulse 3.0.32 β†’ 3.0.34

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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -16
  3. data/Gemfile.lock +1 -1
  4. data/docs/ActionCodeInfo.md +22 -0
  5. data/docs/ActionCodesResponse.md +22 -0
  6. data/docs/BodySubmitCdarApiV1CdarSubmitPost.md +20 -0
  7. data/docs/BodySubmitCdarXmlApiV1CdarSubmitXmlPost.md +20 -0
  8. data/docs/CDARCycleDeVieApi.md +489 -0
  9. data/docs/ChorusProCredentials.md +8 -8
  10. data/docs/ChorusProDestination.md +1 -1
  11. data/docs/CreateCDARRequest.md +52 -0
  12. data/docs/Encaisseamount.md +15 -0
  13. data/docs/Encaisseamount1.md +15 -0
  14. data/docs/FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md +24 -0
  15. data/docs/FactureElectroniqueRestApiSchemasChorusProChorusProCredentials.md +26 -0
  16. data/docs/GenerateCDARResponse.md +26 -0
  17. data/docs/GetChorusProIdRequest.md +1 -1
  18. data/docs/GetInvoiceRequest.md +1 -1
  19. data/docs/GetStructureRequest.md +1 -1
  20. data/docs/ReasonCodeInfo.md +22 -0
  21. data/docs/ReasonCodesResponse.md +22 -0
  22. data/docs/RecipientInput.md +26 -0
  23. data/docs/SearchStructureRequest.md +1 -1
  24. data/docs/StatusCodeInfo.md +22 -0
  25. data/docs/StatusCodesResponse.md +22 -0
  26. data/docs/SubmitCDARRequest.md +54 -0
  27. data/docs/SubmitCDARResponse.md +24 -0
  28. data/docs/SubmitCDARXMLRequest.md +22 -0
  29. data/docs/SubmitInvoiceRequest.md +1 -1
  30. data/docs/ValidateCDARRequest.md +32 -0
  31. data/docs/ValidateCDARResponse.md +22 -0
  32. data/lib/factpulse/api/cdar_cycle_de_vie_api.rb +491 -0
  33. data/lib/factpulse/helpers/client.rb +17 -1
  34. data/lib/factpulse/models/action_code_info.rb +220 -0
  35. data/lib/factpulse/models/action_codes_response.rb +207 -0
  36. data/lib/factpulse/models/body_submit_cdar_api_v1_cdar_submit_post.rb +174 -0
  37. data/lib/factpulse/models/body_submit_cdar_xml_api_v1_cdar_submit_xml_post.rb +174 -0
  38. data/lib/factpulse/models/chorus_pro_credentials.rb +26 -94
  39. data/lib/factpulse/models/chorus_pro_destination.rb +1 -1
  40. data/lib/factpulse/models/create_cdar_request.rb +414 -0
  41. data/lib/factpulse/models/encaisseamount.rb +104 -0
  42. data/lib/factpulse/models/encaisseamount1.rb +103 -0
  43. data/lib/factpulse/models/facture_electronique_rest_api_schemas_cdar_validation_error_response.rb +215 -0
  44. data/lib/factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.rb +259 -0
  45. data/lib/factpulse/models/generate_cdar_response.rb +273 -0
  46. data/lib/factpulse/models/get_chorus_pro_id_request.rb +1 -1
  47. data/lib/factpulse/models/get_invoice_request.rb +1 -1
  48. data/lib/factpulse/models/get_structure_request.rb +1 -1
  49. data/lib/factpulse/models/reason_code_info.rb +220 -0
  50. data/lib/factpulse/models/reason_codes_response.rb +207 -0
  51. data/lib/factpulse/models/recipient_input.rb +191 -0
  52. data/lib/factpulse/models/search_structure_request.rb +1 -1
  53. data/lib/factpulse/models/status_code_info.rb +220 -0
  54. data/lib/factpulse/models/status_codes_response.rb +207 -0
  55. data/lib/factpulse/models/submit_cdar_request.rb +426 -0
  56. data/lib/factpulse/models/submit_cdar_response.rb +213 -0
  57. data/lib/factpulse/models/submit_cdarxml_request.rb +188 -0
  58. data/lib/factpulse/models/submit_invoice_request.rb +1 -1
  59. data/lib/factpulse/models/validate_cdar_request.rb +219 -0
  60. data/lib/factpulse/models/{facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb β†’ validate_cdar_response.rb} +47 -48
  61. data/lib/factpulse/version.rb +1 -1
  62. data/lib/factpulse.rb +21 -1
  63. metadata +44 -4
  64. data/docs/FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md +0 -26
@@ -0,0 +1,414 @@
1
+ =begin
2
+ #FactPulse REST API
3
+
4
+ # REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### πŸ“„ Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **πŸ†• Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### βœ… Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### πŸ“‘ AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### πŸ”„ Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## πŸ”’ Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### πŸ”‘ Method 1: `/api/token/` API (Recommended) **URL:** `https://factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - βœ… Full automation (CI/CD, scripts) - βœ… Programmatic token management - βœ… Refresh token support for automatic access renewal - βœ… Easy integration in any language/tool #### πŸ–₯️ Method 2: Dashboard Generation (Alternative) **URL:** https://factpulse.fr/api/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - βœ… Quick for API testing - βœ… No password required - βœ… Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### πŸ“š Full Documentation For more information on authentication and API usage: https://factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: contact@factpulse.fr
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # RequΓͺte de crΓ©ation d'un message CDAR.
18
+ class CreateCDARRequest < ApiModelBase
19
+ # Identifiant unique du message CDAR
20
+ attr_accessor :document_id
21
+
22
+ # Code processus mΓ©tier (REGULATED, B2C, B2BINT, etc.)
23
+ attr_accessor :business_process
24
+
25
+ # Type de message (23=Traitement, 305=Transmission)
26
+ attr_accessor :type_code
27
+
28
+ # SIREN de l'Γ©metteur (9 chiffres)
29
+ attr_accessor :sender_siren
30
+
31
+ # RΓ΄le de l'Γ©metteur (WK, SE, BY, etc.)
32
+ attr_accessor :sender_role
33
+
34
+ attr_accessor :sender_name
35
+
36
+ attr_accessor :sender_email
37
+
38
+ # Liste des destinataires
39
+ attr_accessor :recipients
40
+
41
+ # Identifiant de la facture (BT-1)
42
+ attr_accessor :invoice_id
43
+
44
+ # Date d'Γ©mission de la facture (YYYY-MM-DD)
45
+ attr_accessor :invoice_issue_date
46
+
47
+ # Type de document (380=Facture, 381=Avoir)
48
+ attr_accessor :invoice_type_code
49
+
50
+ attr_accessor :invoice_seller_siren
51
+
52
+ attr_accessor :invoice_buyer_siren
53
+
54
+ # Code statut de la facture (200-601)
55
+ attr_accessor :status
56
+
57
+ attr_accessor :reason_code
58
+
59
+ attr_accessor :reason_text
60
+
61
+ attr_accessor :action_code
62
+
63
+ attr_accessor :encaisse_amount
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'document_id' => :'documentId',
69
+ :'business_process' => :'businessProcess',
70
+ :'type_code' => :'typeCode',
71
+ :'sender_siren' => :'senderSiren',
72
+ :'sender_role' => :'senderRole',
73
+ :'sender_name' => :'senderName',
74
+ :'sender_email' => :'senderEmail',
75
+ :'recipients' => :'recipients',
76
+ :'invoice_id' => :'invoiceId',
77
+ :'invoice_issue_date' => :'invoiceIssueDate',
78
+ :'invoice_type_code' => :'invoiceTypeCode',
79
+ :'invoice_seller_siren' => :'invoiceSellerSiren',
80
+ :'invoice_buyer_siren' => :'invoiceBuyerSiren',
81
+ :'status' => :'status',
82
+ :'reason_code' => :'reasonCode',
83
+ :'reason_text' => :'reasonText',
84
+ :'action_code' => :'actionCode',
85
+ :'encaisse_amount' => :'encaisseAmount'
86
+ }
87
+ end
88
+
89
+ # Returns attribute mapping this model knows about
90
+ def self.acceptable_attribute_map
91
+ attribute_map
92
+ end
93
+
94
+ # Returns all the JSON keys this model knows about
95
+ def self.acceptable_attributes
96
+ acceptable_attribute_map.values
97
+ end
98
+
99
+ # Attribute type mapping.
100
+ def self.openapi_types
101
+ {
102
+ :'document_id' => :'String',
103
+ :'business_process' => :'String',
104
+ :'type_code' => :'String',
105
+ :'sender_siren' => :'String',
106
+ :'sender_role' => :'String',
107
+ :'sender_name' => :'String',
108
+ :'sender_email' => :'String',
109
+ :'recipients' => :'Array<RecipientInput>',
110
+ :'invoice_id' => :'String',
111
+ :'invoice_issue_date' => :'Date',
112
+ :'invoice_type_code' => :'String',
113
+ :'invoice_seller_siren' => :'String',
114
+ :'invoice_buyer_siren' => :'String',
115
+ :'status' => :'String',
116
+ :'reason_code' => :'String',
117
+ :'reason_text' => :'String',
118
+ :'action_code' => :'String',
119
+ :'encaisse_amount' => :'Encaisseamount'
120
+ }
121
+ end
122
+
123
+ # List of attributes with nullable: true
124
+ def self.openapi_nullable
125
+ Set.new([
126
+ :'sender_name',
127
+ :'sender_email',
128
+ :'invoice_seller_siren',
129
+ :'invoice_buyer_siren',
130
+ :'reason_code',
131
+ :'reason_text',
132
+ :'action_code',
133
+ :'encaisse_amount'
134
+ ])
135
+ end
136
+
137
+ # Initializes the object
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ def initialize(attributes = {})
140
+ if (!attributes.is_a?(Hash))
141
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::CreateCDARRequest` initialize method"
142
+ end
143
+
144
+ # check to see if the attribute exists and convert string to symbol for hash key
145
+ acceptable_attribute_map = self.class.acceptable_attribute_map
146
+ attributes = attributes.each_with_object({}) { |(k, v), h|
147
+ if (!acceptable_attribute_map.key?(k.to_sym))
148
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::CreateCDARRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
149
+ end
150
+ h[k.to_sym] = v
151
+ }
152
+
153
+ if attributes.key?(:'document_id')
154
+ self.document_id = attributes[:'document_id']
155
+ else
156
+ self.document_id = nil
157
+ end
158
+
159
+ if attributes.key?(:'business_process')
160
+ self.business_process = attributes[:'business_process']
161
+ else
162
+ self.business_process = 'REGULATED'
163
+ end
164
+
165
+ if attributes.key?(:'type_code')
166
+ self.type_code = attributes[:'type_code']
167
+ else
168
+ self.type_code = '23'
169
+ end
170
+
171
+ if attributes.key?(:'sender_siren')
172
+ self.sender_siren = attributes[:'sender_siren']
173
+ else
174
+ self.sender_siren = nil
175
+ end
176
+
177
+ if attributes.key?(:'sender_role')
178
+ self.sender_role = attributes[:'sender_role']
179
+ else
180
+ self.sender_role = 'WK'
181
+ end
182
+
183
+ if attributes.key?(:'sender_name')
184
+ self.sender_name = attributes[:'sender_name']
185
+ end
186
+
187
+ if attributes.key?(:'sender_email')
188
+ self.sender_email = attributes[:'sender_email']
189
+ end
190
+
191
+ if attributes.key?(:'recipients')
192
+ if (value = attributes[:'recipients']).is_a?(Array)
193
+ self.recipients = value
194
+ end
195
+ end
196
+
197
+ if attributes.key?(:'invoice_id')
198
+ self.invoice_id = attributes[:'invoice_id']
199
+ else
200
+ self.invoice_id = nil
201
+ end
202
+
203
+ if attributes.key?(:'invoice_issue_date')
204
+ self.invoice_issue_date = attributes[:'invoice_issue_date']
205
+ else
206
+ self.invoice_issue_date = nil
207
+ end
208
+
209
+ if attributes.key?(:'invoice_type_code')
210
+ self.invoice_type_code = attributes[:'invoice_type_code']
211
+ else
212
+ self.invoice_type_code = '380'
213
+ end
214
+
215
+ if attributes.key?(:'invoice_seller_siren')
216
+ self.invoice_seller_siren = attributes[:'invoice_seller_siren']
217
+ end
218
+
219
+ if attributes.key?(:'invoice_buyer_siren')
220
+ self.invoice_buyer_siren = attributes[:'invoice_buyer_siren']
221
+ end
222
+
223
+ if attributes.key?(:'status')
224
+ self.status = attributes[:'status']
225
+ else
226
+ self.status = nil
227
+ end
228
+
229
+ if attributes.key?(:'reason_code')
230
+ self.reason_code = attributes[:'reason_code']
231
+ end
232
+
233
+ if attributes.key?(:'reason_text')
234
+ self.reason_text = attributes[:'reason_text']
235
+ end
236
+
237
+ if attributes.key?(:'action_code')
238
+ self.action_code = attributes[:'action_code']
239
+ end
240
+
241
+ if attributes.key?(:'encaisse_amount')
242
+ self.encaisse_amount = attributes[:'encaisse_amount']
243
+ end
244
+ end
245
+
246
+ # Show invalid properties with the reasons. Usually used together with valid?
247
+ # @return Array for valid properties with the reasons
248
+ def list_invalid_properties
249
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
250
+ invalid_properties = Array.new
251
+ if @document_id.nil?
252
+ invalid_properties.push('invalid value for "document_id", document_id cannot be nil.')
253
+ end
254
+
255
+ if @sender_siren.nil?
256
+ invalid_properties.push('invalid value for "sender_siren", sender_siren cannot be nil.')
257
+ end
258
+
259
+ if @invoice_id.nil?
260
+ invalid_properties.push('invalid value for "invoice_id", invoice_id cannot be nil.')
261
+ end
262
+
263
+ if @invoice_issue_date.nil?
264
+ invalid_properties.push('invalid value for "invoice_issue_date", invoice_issue_date cannot be nil.')
265
+ end
266
+
267
+ if @status.nil?
268
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
269
+ end
270
+
271
+ invalid_properties
272
+ end
273
+
274
+ # Check to see if the all the properties in the model are valid
275
+ # @return true if the model is valid
276
+ def valid?
277
+ warn '[DEPRECATED] the `valid?` method is obsolete'
278
+ return false if @document_id.nil?
279
+ return false if @sender_siren.nil?
280
+ return false if @invoice_id.nil?
281
+ return false if @invoice_issue_date.nil?
282
+ return false if @status.nil?
283
+ true
284
+ end
285
+
286
+ # Custom attribute writer method with validation
287
+ # @param [Object] document_id Value to be assigned
288
+ def document_id=(document_id)
289
+ if document_id.nil?
290
+ fail ArgumentError, 'document_id cannot be nil'
291
+ end
292
+
293
+ @document_id = document_id
294
+ end
295
+
296
+ # Custom attribute writer method with validation
297
+ # @param [Object] sender_siren Value to be assigned
298
+ def sender_siren=(sender_siren)
299
+ if sender_siren.nil?
300
+ fail ArgumentError, 'sender_siren cannot be nil'
301
+ end
302
+
303
+ @sender_siren = sender_siren
304
+ end
305
+
306
+ # Custom attribute writer method with validation
307
+ # @param [Object] invoice_id Value to be assigned
308
+ def invoice_id=(invoice_id)
309
+ if invoice_id.nil?
310
+ fail ArgumentError, 'invoice_id cannot be nil'
311
+ end
312
+
313
+ @invoice_id = invoice_id
314
+ end
315
+
316
+ # Custom attribute writer method with validation
317
+ # @param [Object] invoice_issue_date Value to be assigned
318
+ def invoice_issue_date=(invoice_issue_date)
319
+ if invoice_issue_date.nil?
320
+ fail ArgumentError, 'invoice_issue_date cannot be nil'
321
+ end
322
+
323
+ @invoice_issue_date = invoice_issue_date
324
+ end
325
+
326
+ # Custom attribute writer method with validation
327
+ # @param [Object] status Value to be assigned
328
+ def status=(status)
329
+ if status.nil?
330
+ fail ArgumentError, 'status cannot be nil'
331
+ end
332
+
333
+ @status = status
334
+ end
335
+
336
+ # Checks equality by comparing each attribute.
337
+ # @param [Object] Object to be compared
338
+ def ==(o)
339
+ return true if self.equal?(o)
340
+ self.class == o.class &&
341
+ document_id == o.document_id &&
342
+ business_process == o.business_process &&
343
+ type_code == o.type_code &&
344
+ sender_siren == o.sender_siren &&
345
+ sender_role == o.sender_role &&
346
+ sender_name == o.sender_name &&
347
+ sender_email == o.sender_email &&
348
+ recipients == o.recipients &&
349
+ invoice_id == o.invoice_id &&
350
+ invoice_issue_date == o.invoice_issue_date &&
351
+ invoice_type_code == o.invoice_type_code &&
352
+ invoice_seller_siren == o.invoice_seller_siren &&
353
+ invoice_buyer_siren == o.invoice_buyer_siren &&
354
+ status == o.status &&
355
+ reason_code == o.reason_code &&
356
+ reason_text == o.reason_text &&
357
+ action_code == o.action_code &&
358
+ encaisse_amount == o.encaisse_amount
359
+ end
360
+
361
+ # @see the `==` method
362
+ # @param [Object] Object to be compared
363
+ def eql?(o)
364
+ self == o
365
+ end
366
+
367
+ # Calculates hash code according to all attributes.
368
+ # @return [Integer] Hash code
369
+ def hash
370
+ [document_id, business_process, type_code, sender_siren, sender_role, sender_name, sender_email, recipients, invoice_id, invoice_issue_date, invoice_type_code, invoice_seller_siren, invoice_buyer_siren, status, reason_code, reason_text, action_code, encaisse_amount].hash
371
+ end
372
+
373
+ # Builds the object from hash
374
+ # @param [Hash] attributes Model attributes in the form of hash
375
+ # @return [Object] Returns the model itself
376
+ def self.build_from_hash(attributes)
377
+ return nil unless attributes.is_a?(Hash)
378
+ attributes = attributes.transform_keys(&:to_sym)
379
+ transformed_hash = {}
380
+ openapi_types.each_pair do |key, type|
381
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
382
+ transformed_hash["#{key}"] = nil
383
+ elsif type =~ /\AArray<(.*)>/i
384
+ # check to ensure the input is an array given that the attribute
385
+ # is documented as an array but the input is not
386
+ if attributes[attribute_map[key]].is_a?(Array)
387
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
388
+ end
389
+ elsif !attributes[attribute_map[key]].nil?
390
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
391
+ end
392
+ end
393
+ new(transformed_hash)
394
+ end
395
+
396
+ # Returns the object in the form of hash
397
+ # @return [Hash] Returns the object in the form of hash
398
+ def to_hash
399
+ hash = {}
400
+ self.class.attribute_map.each_pair do |attr, param|
401
+ value = self.send(attr)
402
+ if value.nil?
403
+ is_nullable = self.class.openapi_nullable.include?(attr)
404
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
405
+ end
406
+
407
+ hash[param] = _to_hash(value)
408
+ end
409
+ hash
410
+ end
411
+
412
+ end
413
+
414
+ end
@@ -0,0 +1,104 @@
1
+ =begin
2
+ #FactPulse REST API
3
+
4
+ # REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### πŸ“„ Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **πŸ†• Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### βœ… Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### πŸ“‘ AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### πŸ”„ Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## πŸ”’ Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### πŸ”‘ Method 1: `/api/token/` API (Recommended) **URL:** `https://factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - βœ… Full automation (CI/CD, scripts) - βœ… Programmatic token management - βœ… Refresh token support for automatic access renewal - βœ… Easy integration in any language/tool #### πŸ–₯️ Method 2: Dashboard Generation (Alternative) **URL:** https://factpulse.fr/api/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - βœ… Quick for API testing - βœ… No password required - βœ… Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### πŸ“š Full Documentation For more information on authentication and API usage: https://factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: contact@factpulse.fr
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Montant encaissΓ© (requis pour statut 212)
18
+ module Encaisseamount
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Float',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_any_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = FactPulse.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #FactPulse REST API
3
+
4
+ # REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### πŸ“„ Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **πŸ†• Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### βœ… Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### πŸ“‘ AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### πŸ”„ Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## πŸ”’ Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### πŸ”‘ Method 1: `/api/token/` API (Recommended) **URL:** `https://factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - βœ… Full automation (CI/CD, scripts) - βœ… Programmatic token management - βœ… Refresh token support for automatic access renewal - βœ… Easy integration in any language/tool #### πŸ–₯️ Method 2: Dashboard Generation (Alternative) **URL:** https://factpulse.fr/api/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - βœ… Quick for API testing - βœ… No password required - βœ… Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### πŸ“š Full Documentation For more information on authentication and API usage: https://factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: contact@factpulse.fr
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ module Encaisseamount1
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Float',
23
+ :'String'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = FactPulse.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end