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,491 @@
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 'cgi'
14
+
15
+ module FactPulse
16
+ class CDARCycleDeVieApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Générer un message CDAR
23
+ # Génère un message XML CDAR (Cross Domain Acknowledgement and Response) pour communiquer le statut d'une facture. **Types de messages:** - **23** (Traitement): Message de cycle de vie standard - **305** (Transmission): Message de transmission entre plateformes **Règles métier:** - BR-FR-CDV-14: Le statut 212 (ENCAISSEE) requiert un montant encaissé - BR-FR-CDV-15: Les statuts 206/207/208/210/213/501 requièrent un code motif
24
+ # @param create_cdar_request [CreateCDARRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [GenerateCDARResponse]
27
+ def generate_cdar_api_v1_cdar_generate_post(create_cdar_request, opts = {})
28
+ data, _status_code, _headers = generate_cdar_api_v1_cdar_generate_post_with_http_info(create_cdar_request, opts)
29
+ data
30
+ end
31
+
32
+ # Générer un message CDAR
33
+ # Génère un message XML CDAR (Cross Domain Acknowledgement and Response) pour communiquer le statut d'une facture. **Types de messages:** - **23** (Traitement): Message de cycle de vie standard - **305** (Transmission): Message de transmission entre plateformes **Règles métier:** - BR-FR-CDV-14: Le statut 212 (ENCAISSEE) requiert un montant encaissé - BR-FR-CDV-15: Les statuts 206/207/208/210/213/501 requièrent un code motif
34
+ # @param create_cdar_request [CreateCDARRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(GenerateCDARResponse, Integer, Hash)>] GenerateCDARResponse data, response status code and response headers
37
+ def generate_cdar_api_v1_cdar_generate_post_with_http_info(create_cdar_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: CDARCycleDeVieApi.generate_cdar_api_v1_cdar_generate_post ...'
40
+ end
41
+ # verify the required parameter 'create_cdar_request' is set
42
+ if @api_client.config.client_side_validation && create_cdar_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'create_cdar_request' when calling CDARCycleDeVieApi.generate_cdar_api_v1_cdar_generate_post"
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/v1/cdar/generate'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_cdar_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'GenerateCDARResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"CDARCycleDeVieApi.generate_cdar_api_v1_cdar_generate_post",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: CDARCycleDeVieApi#generate_cdar_api_v1_cdar_generate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Liste des codes action CDAR
91
+ # Retourne la liste complète des codes action (BR-FR-CDV-CL-10). Ces codes indiquent l'action demandée sur la facture.
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [ActionCodesResponse]
94
+ def get_action_codes_api_v1_cdar_action_codes_get(opts = {})
95
+ data, _status_code, _headers = get_action_codes_api_v1_cdar_action_codes_get_with_http_info(opts)
96
+ data
97
+ end
98
+
99
+ # Liste des codes action CDAR
100
+ # Retourne la liste complète des codes action (BR-FR-CDV-CL-10). Ces codes indiquent l&#39;action demandée sur la facture.
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [Array<(ActionCodesResponse, Integer, Hash)>] ActionCodesResponse data, response status code and response headers
103
+ def get_action_codes_api_v1_cdar_action_codes_get_with_http_info(opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: CDARCycleDeVieApi.get_action_codes_api_v1_cdar_action_codes_get ...'
106
+ end
107
+ # resource path
108
+ local_var_path = '/api/v1/cdar/action-codes'
109
+
110
+ # query parameters
111
+ query_params = opts[:query_params] || {}
112
+
113
+ # header parameters
114
+ header_params = opts[:header_params] || {}
115
+ # HTTP header 'Accept' (if needed)
116
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
117
+
118
+ # form parameters
119
+ form_params = opts[:form_params] || {}
120
+
121
+ # http body (model)
122
+ post_body = opts[:debug_body]
123
+
124
+ # return_type
125
+ return_type = opts[:debug_return_type] || 'ActionCodesResponse'
126
+
127
+ # auth_names
128
+ auth_names = opts[:debug_auth_names] || []
129
+
130
+ new_options = opts.merge(
131
+ :operation => :"CDARCycleDeVieApi.get_action_codes_api_v1_cdar_action_codes_get",
132
+ :header_params => header_params,
133
+ :query_params => query_params,
134
+ :form_params => form_params,
135
+ :body => post_body,
136
+ :auth_names => auth_names,
137
+ :return_type => return_type
138
+ )
139
+
140
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: CDARCycleDeVieApi#get_action_codes_api_v1_cdar_action_codes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
143
+ end
144
+ return data, status_code, headers
145
+ end
146
+
147
+ # Liste des codes motif CDAR
148
+ # Retourne la liste complète des codes motif de statut (BR-FR-CDV-CL-09). Ces codes expliquent la raison d'un statut particulier.
149
+ # @param [Hash] opts the optional parameters
150
+ # @return [ReasonCodesResponse]
151
+ def get_reason_codes_api_v1_cdar_reason_codes_get(opts = {})
152
+ data, _status_code, _headers = get_reason_codes_api_v1_cdar_reason_codes_get_with_http_info(opts)
153
+ data
154
+ end
155
+
156
+ # Liste des codes motif CDAR
157
+ # Retourne la liste complète des codes motif de statut (BR-FR-CDV-CL-09). Ces codes expliquent la raison d&#39;un statut particulier.
158
+ # @param [Hash] opts the optional parameters
159
+ # @return [Array<(ReasonCodesResponse, Integer, Hash)>] ReasonCodesResponse data, response status code and response headers
160
+ def get_reason_codes_api_v1_cdar_reason_codes_get_with_http_info(opts = {})
161
+ if @api_client.config.debugging
162
+ @api_client.config.logger.debug 'Calling API: CDARCycleDeVieApi.get_reason_codes_api_v1_cdar_reason_codes_get ...'
163
+ end
164
+ # resource path
165
+ local_var_path = '/api/v1/cdar/reason-codes'
166
+
167
+ # query parameters
168
+ query_params = opts[:query_params] || {}
169
+
170
+ # header parameters
171
+ header_params = opts[:header_params] || {}
172
+ # HTTP header 'Accept' (if needed)
173
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
174
+
175
+ # form parameters
176
+ form_params = opts[:form_params] || {}
177
+
178
+ # http body (model)
179
+ post_body = opts[:debug_body]
180
+
181
+ # return_type
182
+ return_type = opts[:debug_return_type] || 'ReasonCodesResponse'
183
+
184
+ # auth_names
185
+ auth_names = opts[:debug_auth_names] || []
186
+
187
+ new_options = opts.merge(
188
+ :operation => :"CDARCycleDeVieApi.get_reason_codes_api_v1_cdar_reason_codes_get",
189
+ :header_params => header_params,
190
+ :query_params => query_params,
191
+ :form_params => form_params,
192
+ :body => post_body,
193
+ :auth_names => auth_names,
194
+ :return_type => return_type
195
+ )
196
+
197
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
198
+ if @api_client.config.debugging
199
+ @api_client.config.logger.debug "API called: CDARCycleDeVieApi#get_reason_codes_api_v1_cdar_reason_codes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
200
+ end
201
+ return data, status_code, headers
202
+ end
203
+
204
+ # Liste des codes statut CDAR
205
+ # Retourne la liste complète des codes statut de facture (BR-FR-CDV-CL-06). Ces codes indiquent l'état du cycle de vie d'une facture.
206
+ # @param [Hash] opts the optional parameters
207
+ # @return [StatusCodesResponse]
208
+ def get_status_codes_api_v1_cdar_status_codes_get(opts = {})
209
+ data, _status_code, _headers = get_status_codes_api_v1_cdar_status_codes_get_with_http_info(opts)
210
+ data
211
+ end
212
+
213
+ # Liste des codes statut CDAR
214
+ # Retourne la liste complète des codes statut de facture (BR-FR-CDV-CL-06). Ces codes indiquent l&#39;état du cycle de vie d&#39;une facture.
215
+ # @param [Hash] opts the optional parameters
216
+ # @return [Array<(StatusCodesResponse, Integer, Hash)>] StatusCodesResponse data, response status code and response headers
217
+ def get_status_codes_api_v1_cdar_status_codes_get_with_http_info(opts = {})
218
+ if @api_client.config.debugging
219
+ @api_client.config.logger.debug 'Calling API: CDARCycleDeVieApi.get_status_codes_api_v1_cdar_status_codes_get ...'
220
+ end
221
+ # resource path
222
+ local_var_path = '/api/v1/cdar/status-codes'
223
+
224
+ # query parameters
225
+ query_params = opts[:query_params] || {}
226
+
227
+ # header parameters
228
+ header_params = opts[:header_params] || {}
229
+ # HTTP header 'Accept' (if needed)
230
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
231
+
232
+ # form parameters
233
+ form_params = opts[:form_params] || {}
234
+
235
+ # http body (model)
236
+ post_body = opts[:debug_body]
237
+
238
+ # return_type
239
+ return_type = opts[:debug_return_type] || 'StatusCodesResponse'
240
+
241
+ # auth_names
242
+ auth_names = opts[:debug_auth_names] || []
243
+
244
+ new_options = opts.merge(
245
+ :operation => :"CDARCycleDeVieApi.get_status_codes_api_v1_cdar_status_codes_get",
246
+ :header_params => header_params,
247
+ :query_params => query_params,
248
+ :form_params => form_params,
249
+ :body => post_body,
250
+ :auth_names => auth_names,
251
+ :return_type => return_type
252
+ )
253
+
254
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
255
+ if @api_client.config.debugging
256
+ @api_client.config.logger.debug "API called: CDARCycleDeVieApi#get_status_codes_api_v1_cdar_status_codes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
257
+ end
258
+ return data, status_code, headers
259
+ end
260
+
261
+ # Générer et soumettre un message CDAR
262
+ # Génère un message CDAR et le soumet à la plateforme PA/PDP. Nécessite une authentification AFNOR valide. **Types de flux (flowType):** - `CustomerInvoiceLC`: Cycle de vie côté client (acheteur) - `SupplierInvoiceLC`: Cycle de vie côté fournisseur (vendeur)
263
+ # @param user_id [Integer]
264
+ # @param body_submit_cdar_api_v1_cdar_submit_post [BodySubmitCdarApiV1CdarSubmitPost]
265
+ # @param [Hash] opts the optional parameters
266
+ # @option opts [String] :jwt_token
267
+ # @option opts [String] :client_uid
268
+ # @return [SubmitCDARResponse]
269
+ def submit_cdar_api_v1_cdar_submit_post(user_id, body_submit_cdar_api_v1_cdar_submit_post, opts = {})
270
+ data, _status_code, _headers = submit_cdar_api_v1_cdar_submit_post_with_http_info(user_id, body_submit_cdar_api_v1_cdar_submit_post, opts)
271
+ data
272
+ end
273
+
274
+ # Générer et soumettre un message CDAR
275
+ # Génère un message CDAR et le soumet à la plateforme PA/PDP. Nécessite une authentification AFNOR valide. **Types de flux (flowType):** - &#x60;CustomerInvoiceLC&#x60;: Cycle de vie côté client (acheteur) - &#x60;SupplierInvoiceLC&#x60;: Cycle de vie côté fournisseur (vendeur)
276
+ # @param user_id [Integer]
277
+ # @param body_submit_cdar_api_v1_cdar_submit_post [BodySubmitCdarApiV1CdarSubmitPost]
278
+ # @param [Hash] opts the optional parameters
279
+ # @option opts [String] :jwt_token
280
+ # @option opts [String] :client_uid
281
+ # @return [Array<(SubmitCDARResponse, Integer, Hash)>] SubmitCDARResponse data, response status code and response headers
282
+ def submit_cdar_api_v1_cdar_submit_post_with_http_info(user_id, body_submit_cdar_api_v1_cdar_submit_post, opts = {})
283
+ if @api_client.config.debugging
284
+ @api_client.config.logger.debug 'Calling API: CDARCycleDeVieApi.submit_cdar_api_v1_cdar_submit_post ...'
285
+ end
286
+ # verify the required parameter 'user_id' is set
287
+ if @api_client.config.client_side_validation && user_id.nil?
288
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling CDARCycleDeVieApi.submit_cdar_api_v1_cdar_submit_post"
289
+ end
290
+ # verify the required parameter 'body_submit_cdar_api_v1_cdar_submit_post' is set
291
+ if @api_client.config.client_side_validation && body_submit_cdar_api_v1_cdar_submit_post.nil?
292
+ fail ArgumentError, "Missing the required parameter 'body_submit_cdar_api_v1_cdar_submit_post' when calling CDARCycleDeVieApi.submit_cdar_api_v1_cdar_submit_post"
293
+ end
294
+ # resource path
295
+ local_var_path = '/api/v1/cdar/submit'
296
+
297
+ # query parameters
298
+ query_params = opts[:query_params] || {}
299
+ query_params[:'user_id'] = user_id
300
+ query_params[:'jwt_token'] = opts[:'jwt_token'] if !opts[:'jwt_token'].nil?
301
+ query_params[:'client_uid'] = opts[:'client_uid'] if !opts[:'client_uid'].nil?
302
+
303
+ # header parameters
304
+ header_params = opts[:header_params] || {}
305
+ # HTTP header 'Accept' (if needed)
306
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
307
+ # HTTP header 'Content-Type'
308
+ content_type = @api_client.select_header_content_type(['application/json'])
309
+ if !content_type.nil?
310
+ header_params['Content-Type'] = content_type
311
+ end
312
+
313
+ # form parameters
314
+ form_params = opts[:form_params] || {}
315
+
316
+ # http body (model)
317
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body_submit_cdar_api_v1_cdar_submit_post)
318
+
319
+ # return_type
320
+ return_type = opts[:debug_return_type] || 'SubmitCDARResponse'
321
+
322
+ # auth_names
323
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
324
+
325
+ new_options = opts.merge(
326
+ :operation => :"CDARCycleDeVieApi.submit_cdar_api_v1_cdar_submit_post",
327
+ :header_params => header_params,
328
+ :query_params => query_params,
329
+ :form_params => form_params,
330
+ :body => post_body,
331
+ :auth_names => auth_names,
332
+ :return_type => return_type
333
+ )
334
+
335
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug "API called: CDARCycleDeVieApi#submit_cdar_api_v1_cdar_submit_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
338
+ end
339
+ return data, status_code, headers
340
+ end
341
+
342
+ # Soumettre un XML CDAR pré-généré
343
+ # Soumet un message XML CDAR pré-généré à la plateforme PA/PDP. Utile pour soumettre des XML générés par d'autres systèmes.
344
+ # @param user_id [Integer]
345
+ # @param body_submit_cdar_xml_api_v1_cdar_submit_xml_post [BodySubmitCdarXmlApiV1CdarSubmitXmlPost]
346
+ # @param [Hash] opts the optional parameters
347
+ # @option opts [String] :jwt_token
348
+ # @option opts [String] :client_uid
349
+ # @return [SubmitCDARResponse]
350
+ def submit_cdar_xml_api_v1_cdar_submit_xml_post(user_id, body_submit_cdar_xml_api_v1_cdar_submit_xml_post, opts = {})
351
+ data, _status_code, _headers = submit_cdar_xml_api_v1_cdar_submit_xml_post_with_http_info(user_id, body_submit_cdar_xml_api_v1_cdar_submit_xml_post, opts)
352
+ data
353
+ end
354
+
355
+ # Soumettre un XML CDAR pré-généré
356
+ # Soumet un message XML CDAR pré-généré à la plateforme PA/PDP. Utile pour soumettre des XML générés par d&#39;autres systèmes.
357
+ # @param user_id [Integer]
358
+ # @param body_submit_cdar_xml_api_v1_cdar_submit_xml_post [BodySubmitCdarXmlApiV1CdarSubmitXmlPost]
359
+ # @param [Hash] opts the optional parameters
360
+ # @option opts [String] :jwt_token
361
+ # @option opts [String] :client_uid
362
+ # @return [Array<(SubmitCDARResponse, Integer, Hash)>] SubmitCDARResponse data, response status code and response headers
363
+ def submit_cdar_xml_api_v1_cdar_submit_xml_post_with_http_info(user_id, body_submit_cdar_xml_api_v1_cdar_submit_xml_post, opts = {})
364
+ if @api_client.config.debugging
365
+ @api_client.config.logger.debug 'Calling API: CDARCycleDeVieApi.submit_cdar_xml_api_v1_cdar_submit_xml_post ...'
366
+ end
367
+ # verify the required parameter 'user_id' is set
368
+ if @api_client.config.client_side_validation && user_id.nil?
369
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling CDARCycleDeVieApi.submit_cdar_xml_api_v1_cdar_submit_xml_post"
370
+ end
371
+ # verify the required parameter 'body_submit_cdar_xml_api_v1_cdar_submit_xml_post' is set
372
+ if @api_client.config.client_side_validation && body_submit_cdar_xml_api_v1_cdar_submit_xml_post.nil?
373
+ fail ArgumentError, "Missing the required parameter 'body_submit_cdar_xml_api_v1_cdar_submit_xml_post' when calling CDARCycleDeVieApi.submit_cdar_xml_api_v1_cdar_submit_xml_post"
374
+ end
375
+ # resource path
376
+ local_var_path = '/api/v1/cdar/submit-xml'
377
+
378
+ # query parameters
379
+ query_params = opts[:query_params] || {}
380
+ query_params[:'user_id'] = user_id
381
+ query_params[:'jwt_token'] = opts[:'jwt_token'] if !opts[:'jwt_token'].nil?
382
+ query_params[:'client_uid'] = opts[:'client_uid'] if !opts[:'client_uid'].nil?
383
+
384
+ # header parameters
385
+ header_params = opts[:header_params] || {}
386
+ # HTTP header 'Accept' (if needed)
387
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
388
+ # HTTP header 'Content-Type'
389
+ content_type = @api_client.select_header_content_type(['application/json'])
390
+ if !content_type.nil?
391
+ header_params['Content-Type'] = content_type
392
+ end
393
+
394
+ # form parameters
395
+ form_params = opts[:form_params] || {}
396
+
397
+ # http body (model)
398
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body_submit_cdar_xml_api_v1_cdar_submit_xml_post)
399
+
400
+ # return_type
401
+ return_type = opts[:debug_return_type] || 'SubmitCDARResponse'
402
+
403
+ # auth_names
404
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
405
+
406
+ new_options = opts.merge(
407
+ :operation => :"CDARCycleDeVieApi.submit_cdar_xml_api_v1_cdar_submit_xml_post",
408
+ :header_params => header_params,
409
+ :query_params => query_params,
410
+ :form_params => form_params,
411
+ :body => post_body,
412
+ :auth_names => auth_names,
413
+ :return_type => return_type
414
+ )
415
+
416
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
417
+ if @api_client.config.debugging
418
+ @api_client.config.logger.debug "API called: CDARCycleDeVieApi#submit_cdar_xml_api_v1_cdar_submit_xml_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
419
+ end
420
+ return data, status_code, headers
421
+ end
422
+
423
+ # Valider des données CDAR
424
+ # Valide les données CDAR sans générer le XML. Vérifie: - Les formats des champs (SIREN, dates, etc.) - Les codes enums (statut, motif, action) - Les règles métier BR-FR-CDV-*
425
+ # @param validate_cdar_request [ValidateCDARRequest]
426
+ # @param [Hash] opts the optional parameters
427
+ # @return [ValidateCDARResponse]
428
+ def validate_cdar_api_v1_cdar_validate_post(validate_cdar_request, opts = {})
429
+ data, _status_code, _headers = validate_cdar_api_v1_cdar_validate_post_with_http_info(validate_cdar_request, opts)
430
+ data
431
+ end
432
+
433
+ # Valider des données CDAR
434
+ # Valide les données CDAR sans générer le XML. Vérifie: - Les formats des champs (SIREN, dates, etc.) - Les codes enums (statut, motif, action) - Les règles métier BR-FR-CDV-*
435
+ # @param validate_cdar_request [ValidateCDARRequest]
436
+ # @param [Hash] opts the optional parameters
437
+ # @return [Array<(ValidateCDARResponse, Integer, Hash)>] ValidateCDARResponse data, response status code and response headers
438
+ def validate_cdar_api_v1_cdar_validate_post_with_http_info(validate_cdar_request, opts = {})
439
+ if @api_client.config.debugging
440
+ @api_client.config.logger.debug 'Calling API: CDARCycleDeVieApi.validate_cdar_api_v1_cdar_validate_post ...'
441
+ end
442
+ # verify the required parameter 'validate_cdar_request' is set
443
+ if @api_client.config.client_side_validation && validate_cdar_request.nil?
444
+ fail ArgumentError, "Missing the required parameter 'validate_cdar_request' when calling CDARCycleDeVieApi.validate_cdar_api_v1_cdar_validate_post"
445
+ end
446
+ # resource path
447
+ local_var_path = '/api/v1/cdar/validate'
448
+
449
+ # query parameters
450
+ query_params = opts[:query_params] || {}
451
+
452
+ # header parameters
453
+ header_params = opts[:header_params] || {}
454
+ # HTTP header 'Accept' (if needed)
455
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
456
+ # HTTP header 'Content-Type'
457
+ content_type = @api_client.select_header_content_type(['application/json'])
458
+ if !content_type.nil?
459
+ header_params['Content-Type'] = content_type
460
+ end
461
+
462
+ # form parameters
463
+ form_params = opts[:form_params] || {}
464
+
465
+ # http body (model)
466
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_cdar_request)
467
+
468
+ # return_type
469
+ return_type = opts[:debug_return_type] || 'ValidateCDARResponse'
470
+
471
+ # auth_names
472
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
473
+
474
+ new_options = opts.merge(
475
+ :operation => :"CDARCycleDeVieApi.validate_cdar_api_v1_cdar_validate_post",
476
+ :header_params => header_params,
477
+ :query_params => query_params,
478
+ :form_params => form_params,
479
+ :body => post_body,
480
+ :auth_names => auth_names,
481
+ :return_type => return_type
482
+ )
483
+
484
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
485
+ if @api_client.config.debugging
486
+ @api_client.config.logger.debug "API called: CDARCycleDeVieApi#validate_cdar_api_v1_cdar_validate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
487
+ end
488
+ return data, status_code, headers
489
+ end
490
+ end
491
+ end
@@ -297,6 +297,22 @@ module FactPulse
297
297
 
298
298
  if sync && data['taskId']
299
299
  result = poll_task(data['taskId'], timeout: timeout)
300
+
301
+ # Check for business error (task succeeded but business result is ERROR)
302
+ if result['status'] == 'ERROR'
303
+ error_msg = result['errorMessage'] || 'Business error'
304
+ errors = (result['details'] || []).map do |d|
305
+ ValidationErrorDetail.new(
306
+ d['level'] || 'ERROR',
307
+ d['item'] || '',
308
+ d['reason'] || '',
309
+ d['source'],
310
+ d['code']
311
+ )
312
+ end
313
+ raise FactPulseValidationError.new(error_msg, errors)
314
+ end
315
+
300
316
  if result['content_b64']
301
317
  return Base64.decode64(result['content_b64'])
302
318
  elsif result['content_xml']
@@ -712,7 +728,7 @@ module FactPulse
712
728
  if validate
713
729
  validation = validate_facturx_pdf(temp_file.path, profile: profile)
714
730
  result[:validation] = validation
715
- unless validation['is_compliant']
731
+ unless validation['isCompliant']
716
732
  if options[:output_path]
717
733
  File.binwrite(options[:output_path], pdf_bytes)
718
734
  result[:pdf_path] = options[:output_path]