factpulse 3.0.5 → 3.0.6

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 (207) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -3
  3. data/Gemfile.lock +1 -1
  4. data/docs/AdditionalDocument.md +26 -0
  5. data/docs/AllowanceCharge.md +32 -0
  6. data/docs/AllowanceTotalAmount.md +15 -0
  7. data/docs/{APIProfile.md → Amount.md} +2 -2
  8. data/docs/{DocumentType.md → BaseAmount.md} +2 -2
  9. data/docs/ChargeTotalAmount.md +15 -0
  10. data/docs/Contact.md +24 -0
  11. data/docs/ConvertErrorResponse.md +26 -0
  12. data/docs/ConvertPendingInputResponse.md +32 -0
  13. data/docs/ConvertResumeRequest.md +18 -0
  14. data/docs/ConvertSuccessResponse.md +36 -0
  15. data/docs/ConvertValidationFailedResponse.md +34 -0
  16. data/docs/DeliveryParty.md +24 -0
  17. data/docs/DocumentConversionApi.md +373 -0
  18. data/docs/DocumentTypeInfo.md +22 -0
  19. data/docs/ExtractionInfo.md +24 -0
  20. data/docs/FacturXInvoice.md +29 -1
  21. data/docs/FacturXProfile.md +15 -0
  22. data/docs/FileInfo.md +20 -0
  23. data/docs/FilesInfo.md +20 -0
  24. data/docs/GrossUnitPrice.md +15 -0
  25. data/docs/IncomingInvoice.md +1 -1
  26. data/docs/InvoiceLine.md +43 -9
  27. data/docs/InvoiceProcessingApi.md +8 -8
  28. data/docs/InvoiceReferences.md +26 -6
  29. data/docs/InvoiceTotals.md +10 -2
  30. data/docs/LineTotalAmount.md +15 -0
  31. data/docs/MissingField.md +28 -0
  32. data/docs/Payee.md +5 -1
  33. data/docs/PaymentCard.md +20 -0
  34. data/docs/Percentage.md +15 -0
  35. data/docs/PostalAddress.md +5 -1
  36. data/docs/PriceAllowanceAmount.md +15 -0
  37. data/docs/PriceBasisQuantity.md +15 -0
  38. data/docs/ProcessingOptions.md +3 -3
  39. data/docs/ProductCharacteristic.md +20 -0
  40. data/docs/ProductClassification.md +22 -0
  41. data/docs/Recipient.md +7 -1
  42. data/docs/RoundingAmount.md +15 -0
  43. data/docs/Supplier.md +17 -1
  44. data/docs/TaxRepresentative.md +22 -0
  45. data/docs/VATLine.md +2 -0
  46. data/docs/VATPointDateCode.md +15 -0
  47. data/docs/ValidationInfo.md +28 -0
  48. data/docs/VatRate.md +15 -0
  49. data/factpulse.gemspec +1 -1
  50. data/lib/factpulse/api/afnorpdppa_api.rb +1 -1
  51. data/lib/factpulse/api/afnorpdppa_directory_service_api.rb +1 -1
  52. data/lib/factpulse/api/afnorpdppa_flow_service_api.rb +1 -1
  53. data/lib/factpulse/api/chorus_pro_api.rb +1 -1
  54. data/lib/factpulse/api/document_conversion_api.rb +378 -0
  55. data/lib/factpulse/api/health_api.rb +1 -1
  56. data/lib/factpulse/api/invoice_processing_api.rb +9 -9
  57. data/lib/factpulse/api/pdfxml_verification_api.rb +1 -1
  58. data/lib/factpulse/api/user_api.rb +1 -1
  59. data/lib/factpulse/api_client.rb +1 -1
  60. data/lib/factpulse/api_error.rb +1 -1
  61. data/lib/factpulse/api_model_base.rb +1 -1
  62. data/lib/factpulse/configuration.rb +1 -1
  63. data/lib/factpulse/models/acknowledgment_status.rb +1 -1
  64. data/lib/factpulse/models/additional_document.rb +206 -0
  65. data/lib/factpulse/models/afnor_credentials.rb +1 -1
  66. data/lib/factpulse/models/afnor_destination.rb +1 -1
  67. data/lib/factpulse/models/afnor_health_check_response.rb +1 -1
  68. data/lib/factpulse/models/afnor_result.rb +1 -1
  69. data/lib/factpulse/models/allowance_charge.rb +252 -0
  70. data/lib/factpulse/models/allowance_reason_code.rb +1 -1
  71. data/lib/factpulse/models/allowance_total_amount.rb +104 -0
  72. data/lib/factpulse/models/amount.rb +104 -0
  73. data/lib/factpulse/models/amount_due.rb +2 -2
  74. data/lib/factpulse/models/api_error.rb +1 -1
  75. data/lib/factpulse/models/async_task_status.rb +1 -1
  76. data/lib/factpulse/models/base_amount.rb +104 -0
  77. data/lib/factpulse/models/bounding_box_schema.rb +1 -1
  78. data/lib/factpulse/models/celery_status.rb +1 -1
  79. data/lib/factpulse/models/certificate_info_response.rb +1 -1
  80. data/lib/factpulse/models/charge_total_amount.rb +104 -0
  81. data/lib/factpulse/models/chorus_pro_destination.rb +1 -1
  82. data/lib/factpulse/models/chorus_pro_result.rb +1 -1
  83. data/lib/factpulse/models/contact.rb +179 -0
  84. data/lib/factpulse/models/convert_error_response.rb +224 -0
  85. data/lib/factpulse/models/convert_pending_input_response.rb +322 -0
  86. data/lib/factpulse/models/convert_resume_request.rb +151 -0
  87. data/lib/factpulse/models/convert_success_response.rb +360 -0
  88. data/lib/factpulse/models/convert_validation_failed_response.rb +334 -0
  89. data/lib/factpulse/models/delivery_party.rb +179 -0
  90. data/lib/factpulse/models/destination.rb +1 -1
  91. data/lib/factpulse/models/document_type_info.rb +220 -0
  92. data/lib/factpulse/models/electronic_address.rb +1 -1
  93. data/lib/factpulse/models/enriched_invoice_info.rb +1 -1
  94. data/lib/factpulse/models/error_level.rb +1 -1
  95. data/lib/factpulse/models/error_source.rb +1 -1
  96. data/lib/factpulse/models/extraction_info.rb +217 -0
  97. data/lib/factpulse/models/factur_x_invoice.rb +150 -6
  98. data/lib/factpulse/models/{api_profile.rb → factur_x_profile.rb} +4 -4
  99. data/lib/factpulse/models/factur_xpdf_info.rb +1 -1
  100. data/lib/factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.rb +5 -5
  101. data/lib/factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb +1 -1
  102. data/lib/factpulse/models/field_status.rb +1 -1
  103. data/lib/factpulse/models/file_info.rb +161 -0
  104. data/lib/factpulse/models/files_info.rb +159 -0
  105. data/lib/factpulse/models/flow_direction.rb +1 -1
  106. data/lib/factpulse/models/flow_profile.rb +1 -1
  107. data/lib/factpulse/models/flow_summary.rb +1 -1
  108. data/lib/factpulse/models/flow_syntax.rb +1 -1
  109. data/lib/factpulse/models/flow_type.rb +1 -1
  110. data/lib/factpulse/models/generate_certificate_request.rb +6 -6
  111. data/lib/factpulse/models/generate_certificate_response.rb +1 -1
  112. data/lib/factpulse/models/get_chorus_pro_id_request.rb +2 -2
  113. data/lib/factpulse/models/get_chorus_pro_id_response.rb +1 -1
  114. data/lib/factpulse/models/get_invoice_request.rb +2 -2
  115. data/lib/factpulse/models/get_invoice_response.rb +1 -1
  116. data/lib/factpulse/models/get_structure_request.rb +3 -3
  117. data/lib/factpulse/models/get_structure_response.rb +1 -1
  118. data/lib/factpulse/models/global_allowance_amount.rb +2 -2
  119. data/lib/factpulse/models/gross_unit_price.rb +104 -0
  120. data/lib/factpulse/models/http_validation_error.rb +1 -1
  121. data/lib/factpulse/models/incoming_invoice.rb +2 -2
  122. data/lib/factpulse/models/incoming_supplier.rb +1 -1
  123. data/lib/factpulse/models/invoice_format.rb +1 -1
  124. data/lib/factpulse/models/invoice_line.rb +209 -25
  125. data/lib/factpulse/models/invoice_line_allowance_amount.rb +2 -2
  126. data/lib/factpulse/models/invoice_note.rb +1 -1
  127. data/lib/factpulse/models/invoice_references.rb +119 -16
  128. data/lib/factpulse/models/invoice_status.rb +1 -1
  129. data/lib/factpulse/models/invoice_totals.rb +52 -12
  130. data/lib/factpulse/models/invoice_totals_prepayment.rb +2 -2
  131. data/lib/factpulse/models/invoice_type_code.rb +1 -1
  132. data/lib/factpulse/models/invoicing_framework.rb +1 -1
  133. data/lib/factpulse/models/invoicing_framework_code.rb +1 -1
  134. data/lib/factpulse/models/line_net_amount.rb +2 -2
  135. data/lib/factpulse/models/line_total_amount.rb +104 -0
  136. data/lib/factpulse/models/mandatory_note_schema.rb +1 -1
  137. data/lib/factpulse/models/manual_rate.rb +2 -2
  138. data/lib/factpulse/models/manual_vat_rate.rb +2 -2
  139. data/lib/factpulse/models/missing_field.rb +269 -0
  140. data/lib/factpulse/models/operation_nature.rb +1 -1
  141. data/lib/factpulse/models/output_format.rb +1 -1
  142. data/lib/factpulse/models/page_dimensions_schema.rb +1 -1
  143. data/lib/factpulse/models/payee.rb +28 -6
  144. data/lib/factpulse/models/payment_card.rb +159 -0
  145. data/lib/factpulse/models/payment_means.rb +1 -1
  146. data/lib/factpulse/models/pdf_validation_result_api.rb +1 -1
  147. data/lib/factpulse/models/pdp_credentials.rb +6 -6
  148. data/lib/factpulse/models/percentage.rb +104 -0
  149. data/lib/factpulse/models/postal_address.rb +27 -7
  150. data/lib/factpulse/models/price_allowance_amount.rb +104 -0
  151. data/lib/factpulse/models/price_basis_quantity.rb +104 -0
  152. data/lib/factpulse/models/processing_options.rb +10 -10
  153. data/lib/factpulse/models/product_characteristic.rb +193 -0
  154. data/lib/factpulse/models/product_classification.rb +186 -0
  155. data/lib/factpulse/models/quantity.rb +2 -2
  156. data/lib/factpulse/models/recipient.rb +39 -7
  157. data/lib/factpulse/models/rounding_amount.rb +104 -0
  158. data/lib/factpulse/models/scheme_id.rb +12 -6
  159. data/lib/factpulse/models/search_flow_request.rb +8 -8
  160. data/lib/factpulse/models/search_flow_response.rb +1 -1
  161. data/lib/factpulse/models/search_services_response.rb +1 -1
  162. data/lib/factpulse/models/search_structure_request.rb +5 -5
  163. data/lib/factpulse/models/search_structure_response.rb +1 -1
  164. data/lib/factpulse/models/signature_info.rb +1 -1
  165. data/lib/factpulse/models/signature_info_api.rb +1 -1
  166. data/lib/factpulse/models/signature_parameters.rb +1 -1
  167. data/lib/factpulse/models/simplified_invoice_data.rb +1 -1
  168. data/lib/factpulse/models/structure_info.rb +1 -1
  169. data/lib/factpulse/models/structure_parameters.rb +1 -1
  170. data/lib/factpulse/models/structure_service.rb +1 -1
  171. data/lib/factpulse/models/submission_mode.rb +1 -1
  172. data/lib/factpulse/models/submit_complete_invoice_request.rb +1 -1
  173. data/lib/factpulse/models/submit_complete_invoice_response.rb +1 -1
  174. data/lib/factpulse/models/submit_flow_request.rb +7 -7
  175. data/lib/factpulse/models/submit_flow_response.rb +1 -1
  176. data/lib/factpulse/models/submit_gross_amount.rb +1 -1
  177. data/lib/factpulse/models/submit_invoice_request.rb +14 -14
  178. data/lib/factpulse/models/submit_invoice_response.rb +1 -1
  179. data/lib/factpulse/models/submit_net_amount.rb +1 -1
  180. data/lib/factpulse/models/submit_vat_amount.rb +1 -1
  181. data/lib/factpulse/models/supplementary_attachment.rb +1 -1
  182. data/lib/factpulse/models/supplier.rb +89 -7
  183. data/lib/factpulse/models/task_response.rb +1 -1
  184. data/lib/factpulse/models/tax_representative.rb +220 -0
  185. data/lib/factpulse/models/taxable_amount.rb +2 -2
  186. data/lib/factpulse/models/total_gross_amount.rb +2 -2
  187. data/lib/factpulse/models/total_net_amount.rb +2 -2
  188. data/lib/factpulse/models/total_vat_amount.rb +2 -2
  189. data/lib/factpulse/models/unit_net_price.rb +2 -2
  190. data/lib/factpulse/models/unit_of_measure.rb +1 -1
  191. data/lib/factpulse/models/validation_error.rb +1 -1
  192. data/lib/factpulse/models/validation_error_detail.rb +1 -1
  193. data/lib/factpulse/models/validation_error_loc_inner.rb +1 -1
  194. data/lib/factpulse/models/validation_error_response.rb +1 -1
  195. data/lib/factpulse/models/validation_info.rb +255 -0
  196. data/lib/factpulse/models/validation_success_response.rb +1 -1
  197. data/lib/factpulse/models/vat_accounting_code.rb +1 -1
  198. data/lib/factpulse/models/vat_amount.rb +2 -2
  199. data/lib/factpulse/models/vat_category.rb +1 -1
  200. data/lib/factpulse/models/vat_line.rb +13 -3
  201. data/lib/factpulse/models/{document_type.rb → vat_point_date_code.rb} +8 -10
  202. data/lib/factpulse/models/vat_rate.rb +104 -0
  203. data/lib/factpulse/models/verification_success_response.rb +1 -1
  204. data/lib/factpulse/models/verified_field_schema.rb +1 -1
  205. data/lib/factpulse/version.rb +2 -2
  206. data/lib/factpulse.rb +34 -3
  207. metadata +68 -6
@@ -0,0 +1,378 @@
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://www.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://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.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://www.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://www.factpulse.fr/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://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.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module FactPulse
16
+ class DocumentConversionApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Convertir un document en Factur-X
23
+ # Convertit un document (PDF, DOCX, XLSX, image) en Factur-X conforme. ## Workflow 1. **Upload** : Le document est envoyé en multipart/form-data 2. **Extraction OCR + Classification** : Mistral OCR extrait les données et classifie le document en un seul appel 3. **Enrichissement** : Les données sont enrichies via SIRENE (SIRET → raison sociale) 4. **Validation** : Les règles Schematron sont appliquées 5. **Génération** : Le Factur-X PDF/A-3 est généré ## Réponses possibles - **200** : Conversion réussie, fichiers disponibles - **202** : Données manquantes, complétion requise - **422** : Validation échouée, corrections nécessaires - **400** : Fichier invalide - **429** : Quota dépassé
24
+ # @param file [File] Document à convertir (PDF, DOCX, XLSX, JPG, PNG)
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :output Format de sortie: pdf, xml, both (default to 'pdf')
27
+ # @option opts [String] :callback_url
28
+ # @return [ConvertSuccessResponse]
29
+ def convert_document_api_v1_convert_post(file, opts = {})
30
+ data, _status_code, _headers = convert_document_api_v1_convert_post_with_http_info(file, opts)
31
+ data
32
+ end
33
+
34
+ # Convertir un document en Factur-X
35
+ # Convertit un document (PDF, DOCX, XLSX, image) en Factur-X conforme. ## Workflow 1. **Upload** : Le document est envoyé en multipart/form-data 2. **Extraction OCR + Classification** : Mistral OCR extrait les données et classifie le document en un seul appel 3. **Enrichissement** : Les données sont enrichies via SIRENE (SIRET → raison sociale) 4. **Validation** : Les règles Schematron sont appliquées 5. **Génération** : Le Factur-X PDF/A-3 est généré ## Réponses possibles - **200** : Conversion réussie, fichiers disponibles - **202** : Données manquantes, complétion requise - **422** : Validation échouée, corrections nécessaires - **400** : Fichier invalide - **429** : Quota dépassé
36
+ # @param file [File] Document à convertir (PDF, DOCX, XLSX, JPG, PNG)
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [String] :output Format de sortie: pdf, xml, both (default to 'pdf')
39
+ # @option opts [String] :callback_url
40
+ # @return [Array<(ConvertSuccessResponse, Integer, Hash)>] ConvertSuccessResponse data, response status code and response headers
41
+ def convert_document_api_v1_convert_post_with_http_info(file, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: DocumentConversionApi.convert_document_api_v1_convert_post ...'
44
+ end
45
+ # verify the required parameter 'file' is set
46
+ if @api_client.config.client_side_validation && file.nil?
47
+ fail ArgumentError, "Missing the required parameter 'file' when calling DocumentConversionApi.convert_document_api_v1_convert_post"
48
+ end
49
+ # resource path
50
+ local_var_path = '/api/v1/convert'
51
+
52
+ # query parameters
53
+ query_params = opts[:query_params] || {}
54
+
55
+ # header parameters
56
+ header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
59
+ # HTTP header 'Content-Type'
60
+ content_type = @api_client.select_header_content_type(['multipart/form-data'])
61
+ if !content_type.nil?
62
+ header_params['Content-Type'] = content_type
63
+ end
64
+
65
+ # form parameters
66
+ form_params = opts[:form_params] || {}
67
+ form_params['file'] = file
68
+ form_params['output'] = opts[:'output'] if !opts[:'output'].nil?
69
+ form_params['callback_url'] = opts[:'callback_url'] if !opts[:'callback_url'].nil?
70
+
71
+ # http body (model)
72
+ post_body = opts[:debug_body]
73
+
74
+ # return_type
75
+ return_type = opts[:debug_return_type] || 'ConvertSuccessResponse'
76
+
77
+ # auth_names
78
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
79
+
80
+ new_options = opts.merge(
81
+ :operation => :"DocumentConversionApi.convert_document_api_v1_convert_post",
82
+ :header_params => header_params,
83
+ :query_params => query_params,
84
+ :form_params => form_params,
85
+ :body => post_body,
86
+ :auth_names => auth_names,
87
+ :return_type => return_type
88
+ )
89
+
90
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug "API called: DocumentConversionApi#convert_document_api_v1_convert_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
+ end
94
+ return data, status_code, headers
95
+ end
96
+
97
+ # Convertir un document en Factur-X (mode asynchrone)
98
+ # Lance une conversion asynchrone via Celery. ## Workflow 1. **Upload** : Le document est envoyé en multipart/form-data 2. **Task Celery** : La tâche est mise en file d'attente 3. **Callback** : Notification par webhook à la fin ## Réponses possibles - **202** : Tâche acceptée, en cours de traitement - **400** : Fichier invalide
99
+ # @param file [File] Document à convertir (PDF, DOCX, XLSX, JPG, PNG)
100
+ # @param [Hash] opts the optional parameters
101
+ # @option opts [String] :output Format de sortie: pdf, xml, both (default to 'pdf')
102
+ # @option opts [String] :callback_url
103
+ # @return [Object]
104
+ def convert_document_async_api_v1_convert_async_post(file, opts = {})
105
+ data, _status_code, _headers = convert_document_async_api_v1_convert_async_post_with_http_info(file, opts)
106
+ data
107
+ end
108
+
109
+ # Convertir un document en Factur-X (mode asynchrone)
110
+ # Lance une conversion asynchrone via Celery. ## Workflow 1. **Upload** : Le document est envoyé en multipart/form-data 2. **Task Celery** : La tâche est mise en file d&#39;attente 3. **Callback** : Notification par webhook à la fin ## Réponses possibles - **202** : Tâche acceptée, en cours de traitement - **400** : Fichier invalide
111
+ # @param file [File] Document à convertir (PDF, DOCX, XLSX, JPG, PNG)
112
+ # @param [Hash] opts the optional parameters
113
+ # @option opts [String] :output Format de sortie: pdf, xml, both (default to 'pdf')
114
+ # @option opts [String] :callback_url
115
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
116
+ def convert_document_async_api_v1_convert_async_post_with_http_info(file, opts = {})
117
+ if @api_client.config.debugging
118
+ @api_client.config.logger.debug 'Calling API: DocumentConversionApi.convert_document_async_api_v1_convert_async_post ...'
119
+ end
120
+ # verify the required parameter 'file' is set
121
+ if @api_client.config.client_side_validation && file.nil?
122
+ fail ArgumentError, "Missing the required parameter 'file' when calling DocumentConversionApi.convert_document_async_api_v1_convert_async_post"
123
+ end
124
+ # resource path
125
+ local_var_path = '/api/v1/convert/async'
126
+
127
+ # query parameters
128
+ query_params = opts[:query_params] || {}
129
+
130
+ # header parameters
131
+ header_params = opts[:header_params] || {}
132
+ # HTTP header 'Accept' (if needed)
133
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
134
+ # HTTP header 'Content-Type'
135
+ content_type = @api_client.select_header_content_type(['multipart/form-data'])
136
+ if !content_type.nil?
137
+ header_params['Content-Type'] = content_type
138
+ end
139
+
140
+ # form parameters
141
+ form_params = opts[:form_params] || {}
142
+ form_params['file'] = file
143
+ form_params['output'] = opts[:'output'] if !opts[:'output'].nil?
144
+ form_params['callback_url'] = opts[:'callback_url'] if !opts[:'callback_url'].nil?
145
+
146
+ # http body (model)
147
+ post_body = opts[:debug_body]
148
+
149
+ # return_type
150
+ return_type = opts[:debug_return_type] || 'Object'
151
+
152
+ # auth_names
153
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
154
+
155
+ new_options = opts.merge(
156
+ :operation => :"DocumentConversionApi.convert_document_async_api_v1_convert_async_post",
157
+ :header_params => header_params,
158
+ :query_params => query_params,
159
+ :form_params => form_params,
160
+ :body => post_body,
161
+ :auth_names => auth_names,
162
+ :return_type => return_type
163
+ )
164
+
165
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug "API called: DocumentConversionApi#convert_document_async_api_v1_convert_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
168
+ end
169
+ return data, status_code, headers
170
+ end
171
+
172
+ # Télécharger un fichier généré
173
+ # Télécharge le fichier Factur-X PDF ou XML généré. ## Fichiers disponibles - `facturx.pdf` : PDF/A-3 avec XML embarqué - `facturx.xml` : XML CII seul (Cross Industry Invoice) Les fichiers sont disponibles pendant 24 heures après génération.
174
+ # @param conversion_id [String]
175
+ # @param filename [String]
176
+ # @param [Hash] opts the optional parameters
177
+ # @return [Object]
178
+ def download_file_api_v1_convert_conversion_id_download_filename_get(conversion_id, filename, opts = {})
179
+ data, _status_code, _headers = download_file_api_v1_convert_conversion_id_download_filename_get_with_http_info(conversion_id, filename, opts)
180
+ data
181
+ end
182
+
183
+ # Télécharger un fichier généré
184
+ # Télécharge le fichier Factur-X PDF ou XML généré. ## Fichiers disponibles - &#x60;facturx.pdf&#x60; : PDF/A-3 avec XML embarqué - &#x60;facturx.xml&#x60; : XML CII seul (Cross Industry Invoice) Les fichiers sont disponibles pendant 24 heures après génération.
185
+ # @param conversion_id [String]
186
+ # @param filename [String]
187
+ # @param [Hash] opts the optional parameters
188
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
189
+ def download_file_api_v1_convert_conversion_id_download_filename_get_with_http_info(conversion_id, filename, opts = {})
190
+ if @api_client.config.debugging
191
+ @api_client.config.logger.debug 'Calling API: DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get ...'
192
+ end
193
+ # verify the required parameter 'conversion_id' is set
194
+ if @api_client.config.client_side_validation && conversion_id.nil?
195
+ fail ArgumentError, "Missing the required parameter 'conversion_id' when calling DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get"
196
+ end
197
+ # verify the required parameter 'filename' is set
198
+ if @api_client.config.client_side_validation && filename.nil?
199
+ fail ArgumentError, "Missing the required parameter 'filename' when calling DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get"
200
+ end
201
+ # resource path
202
+ local_var_path = '/api/v1/convert/{conversion_id}/download/{filename}'.sub('{' + 'conversion_id' + '}', CGI.escape(conversion_id.to_s)).sub('{' + 'filename' + '}', CGI.escape(filename.to_s))
203
+
204
+ # query parameters
205
+ query_params = opts[:query_params] || {}
206
+
207
+ # header parameters
208
+ header_params = opts[:header_params] || {}
209
+ # HTTP header 'Accept' (if needed)
210
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
211
+
212
+ # form parameters
213
+ form_params = opts[:form_params] || {}
214
+
215
+ # http body (model)
216
+ post_body = opts[:debug_body]
217
+
218
+ # return_type
219
+ return_type = opts[:debug_return_type] || 'Object'
220
+
221
+ # auth_names
222
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
223
+
224
+ new_options = opts.merge(
225
+ :operation => :"DocumentConversionApi.download_file_api_v1_convert_conversion_id_download_filename_get",
226
+ :header_params => header_params,
227
+ :query_params => query_params,
228
+ :form_params => form_params,
229
+ :body => post_body,
230
+ :auth_names => auth_names,
231
+ :return_type => return_type
232
+ )
233
+
234
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
235
+ if @api_client.config.debugging
236
+ @api_client.config.logger.debug "API called: DocumentConversionApi#download_file_api_v1_convert_conversion_id_download_filename_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
237
+ end
238
+ return data, status_code, headers
239
+ end
240
+
241
+ # Vérifier le statut d'une conversion
242
+ # Retourne le statut actuel d'une conversion asynchrone.
243
+ # @param conversion_id [String]
244
+ # @param [Hash] opts the optional parameters
245
+ # @return [Hash<String, Object>]
246
+ def get_conversion_status_api_v1_convert_conversion_id_status_get(conversion_id, opts = {})
247
+ data, _status_code, _headers = get_conversion_status_api_v1_convert_conversion_id_status_get_with_http_info(conversion_id, opts)
248
+ data
249
+ end
250
+
251
+ # Vérifier le statut d&#39;une conversion
252
+ # Retourne le statut actuel d&#39;une conversion asynchrone.
253
+ # @param conversion_id [String]
254
+ # @param [Hash] opts the optional parameters
255
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
256
+ def get_conversion_status_api_v1_convert_conversion_id_status_get_with_http_info(conversion_id, opts = {})
257
+ if @api_client.config.debugging
258
+ @api_client.config.logger.debug 'Calling API: DocumentConversionApi.get_conversion_status_api_v1_convert_conversion_id_status_get ...'
259
+ end
260
+ # verify the required parameter 'conversion_id' is set
261
+ if @api_client.config.client_side_validation && conversion_id.nil?
262
+ fail ArgumentError, "Missing the required parameter 'conversion_id' when calling DocumentConversionApi.get_conversion_status_api_v1_convert_conversion_id_status_get"
263
+ end
264
+ # resource path
265
+ local_var_path = '/api/v1/convert/{conversion_id}/status'.sub('{' + 'conversion_id' + '}', CGI.escape(conversion_id.to_s))
266
+
267
+ # query parameters
268
+ query_params = opts[:query_params] || {}
269
+
270
+ # header parameters
271
+ header_params = opts[:header_params] || {}
272
+ # HTTP header 'Accept' (if needed)
273
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
274
+
275
+ # form parameters
276
+ form_params = opts[:form_params] || {}
277
+
278
+ # http body (model)
279
+ post_body = opts[:debug_body]
280
+
281
+ # return_type
282
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
283
+
284
+ # auth_names
285
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
286
+
287
+ new_options = opts.merge(
288
+ :operation => :"DocumentConversionApi.get_conversion_status_api_v1_convert_conversion_id_status_get",
289
+ :header_params => header_params,
290
+ :query_params => query_params,
291
+ :form_params => form_params,
292
+ :body => post_body,
293
+ :auth_names => auth_names,
294
+ :return_type => return_type
295
+ )
296
+
297
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
298
+ if @api_client.config.debugging
299
+ @api_client.config.logger.debug "API called: DocumentConversionApi#get_conversion_status_api_v1_convert_conversion_id_status_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
300
+ end
301
+ return data, status_code, headers
302
+ end
303
+
304
+ # Reprendre une conversion avec corrections
305
+ # Reprend une conversion après complétion des données manquantes ou correction des erreurs. L'extraction OCR est conservée, les données sont mises à jour avec les corrections, puis une nouvelle validation Schematron est effectuée.
306
+ # @param conversion_id [String]
307
+ # @param convert_resume_request [ConvertResumeRequest]
308
+ # @param [Hash] opts the optional parameters
309
+ # @return [ConvertSuccessResponse]
310
+ def resume_conversion_api_v1_convert_conversion_id_resume_post(conversion_id, convert_resume_request, opts = {})
311
+ data, _status_code, _headers = resume_conversion_api_v1_convert_conversion_id_resume_post_with_http_info(conversion_id, convert_resume_request, opts)
312
+ data
313
+ end
314
+
315
+ # Reprendre une conversion avec corrections
316
+ # Reprend une conversion après complétion des données manquantes ou correction des erreurs. L&#39;extraction OCR est conservée, les données sont mises à jour avec les corrections, puis une nouvelle validation Schematron est effectuée.
317
+ # @param conversion_id [String]
318
+ # @param convert_resume_request [ConvertResumeRequest]
319
+ # @param [Hash] opts the optional parameters
320
+ # @return [Array<(ConvertSuccessResponse, Integer, Hash)>] ConvertSuccessResponse data, response status code and response headers
321
+ def resume_conversion_api_v1_convert_conversion_id_resume_post_with_http_info(conversion_id, convert_resume_request, opts = {})
322
+ if @api_client.config.debugging
323
+ @api_client.config.logger.debug 'Calling API: DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post ...'
324
+ end
325
+ # verify the required parameter 'conversion_id' is set
326
+ if @api_client.config.client_side_validation && conversion_id.nil?
327
+ fail ArgumentError, "Missing the required parameter 'conversion_id' when calling DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post"
328
+ end
329
+ # verify the required parameter 'convert_resume_request' is set
330
+ if @api_client.config.client_side_validation && convert_resume_request.nil?
331
+ fail ArgumentError, "Missing the required parameter 'convert_resume_request' when calling DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post"
332
+ end
333
+ # resource path
334
+ local_var_path = '/api/v1/convert/{conversion_id}/resume'.sub('{' + 'conversion_id' + '}', CGI.escape(conversion_id.to_s))
335
+
336
+ # query parameters
337
+ query_params = opts[:query_params] || {}
338
+
339
+ # header parameters
340
+ header_params = opts[:header_params] || {}
341
+ # HTTP header 'Accept' (if needed)
342
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
343
+ # HTTP header 'Content-Type'
344
+ content_type = @api_client.select_header_content_type(['application/json'])
345
+ if !content_type.nil?
346
+ header_params['Content-Type'] = content_type
347
+ end
348
+
349
+ # form parameters
350
+ form_params = opts[:form_params] || {}
351
+
352
+ # http body (model)
353
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(convert_resume_request)
354
+
355
+ # return_type
356
+ return_type = opts[:debug_return_type] || 'ConvertSuccessResponse'
357
+
358
+ # auth_names
359
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
360
+
361
+ new_options = opts.merge(
362
+ :operation => :"DocumentConversionApi.resume_conversion_api_v1_convert_conversion_id_resume_post",
363
+ :header_params => header_params,
364
+ :query_params => query_params,
365
+ :form_params => form_params,
366
+ :body => post_body,
367
+ :auth_names => auth_names,
368
+ :return_type => return_type
369
+ )
370
+
371
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
372
+ if @api_client.config.debugging
373
+ @api_client.config.logger.debug "API called: DocumentConversionApi#resume_conversion_api_v1_convert_conversion_id_resume_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
374
+ end
375
+ return data, status_code, headers
376
+ end
377
+ end
378
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -23,7 +23,7 @@ module FactPulse
23
23
  # Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"sender\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"recipient\": {\"siret\": \"35600000000048\"}, \"lines\": [ {\"description\": \"Service\", \"quantity\": 10, \"unitPrice\": 100.00, \"vatRate\": 20.0} ] } ``` **⚠️ Required fields (simplified format)**: - `number`: Unique invoice number - `sender.siret`: Sender's SIRET (14 digits) - `sender.iban`: Bank account IBAN (no public API to retrieve it) - `recipient.siret`: Recipient's SIRET - `lines[]`: At least one invoice line **What happens automatically with `auto_enrich=True`**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT = Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format='pdf') - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a `task_id` (HTTP 202 Accepted) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires `source_pdf`) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status `completed`): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
24
24
  # @param invoice_data [String] Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
25
25
  # @param [Hash] opts the optional parameters
26
- # @option opts [APIProfile] :profile Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
26
+ # @option opts [FacturXProfile] :profile Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
27
27
  # @option opts [OutputFormat] :output_format Output format: &#39;xml&#39; (XML only) or &#39;pdf&#39; (Factur-X PDF with embedded XML).
28
28
  # @option opts [Boolean] :auto_enrich 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only) (default to true)
29
29
  # @option opts [File] :source_pdf
@@ -37,7 +37,7 @@ module FactPulse
37
37
  # Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: &#x60;&#x60;&#x60;json { \&quot;number\&quot;: \&quot;FACT-2025-001\&quot;, \&quot;sender\&quot;: { \&quot;siret\&quot;: \&quot;92019522900017\&quot;, \&quot;iban\&quot;: \&quot;FR7630001007941234567890185\&quot; }, \&quot;recipient\&quot;: {\&quot;siret\&quot;: \&quot;35600000000048\&quot;}, \&quot;lines\&quot;: [ {\&quot;description\&quot;: \&quot;Service\&quot;, \&quot;quantity\&quot;: 10, \&quot;unitPrice\&quot;: 100.00, \&quot;vatRate\&quot;: 20.0} ] } &#x60;&#x60;&#x60; **⚠️ Required fields (simplified format)**: - &#x60;number&#x60;: Unique invoice number - &#x60;sender.siret&#x60;: Sender&#39;s SIRET (14 digits) - &#x60;sender.iban&#x60;: Bank account IBAN (no public API to retrieve it) - &#x60;recipient.siret&#x60;: Recipient&#39;s SIRET - &#x60;lines[]&#x60;: At least one invoice line **What happens automatically with &#x60;auto_enrich&#x3D;True&#x60;**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT &#x3D; Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format&#x3D;&#39;pdf&#39;) - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a &#x60;task_id&#x60; (HTTP 202 Accepted) 3. **Tracking**: Use the &#x60;/tasks/{task_id}/status&#x60; endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires &#x60;source_pdf&#x60;) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status &#x60;completed&#x60;): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
38
38
  # @param invoice_data [String] Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
39
39
  # @param [Hash] opts the optional parameters
40
- # @option opts [APIProfile] :profile Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
40
+ # @option opts [FacturXProfile] :profile Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
41
41
  # @option opts [OutputFormat] :output_format Output format: &#39;xml&#39; (XML only) or &#39;pdf&#39; (Factur-X PDF with embedded XML).
42
42
  # @option opts [Boolean] :auto_enrich 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only) (default to true)
43
43
  # @option opts [File] :source_pdf
@@ -545,7 +545,7 @@ module FactPulse
545
545
  # Validates a complete Factur-X PDF according to European and French standards. ## Applied validation standards - **EN 16931**: European semantic standard (directive 2014/55/EU) - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Factur-X / ZUGFeRD**: Franco-German specification - **Schematron**: XML business rules validation - **eIDAS**: European regulation on electronic identification (signatures) ## Checks performed ### 1. Factur-X XML extraction and validation **Checks performed:** - Presence of embedded XML file (`factur-x.xml` or `zugferd-invoice.xml`) - Automatic profile detection (MINIMUM, BASIC, EN16931, EXTENDED) - XML parsing with UTF-8 validation - GuidelineSpecifiedDocumentContextParameter/ID extraction **Schematron validation:** - Business rules for detected profile (MINIMUM: 45 rules, EN16931: 178 rules) - Cardinality of required elements - Calculation consistency (net, VAT, gross amounts, discounts) - Identifier formats (SIRET, intra-EU VAT, IBAN) - Standardized codes (ISO country codes, UN/ECE units, VAT codes) **What is verified:** - ✅ XML structure conforming to Cross Industry Invoice XSD - ✅ Correct UN/CEFACT namespace - ✅ European business rules (BR-xx) - ✅ French-specific rules (FR-xx) ### 2. PDF/A-3 compliance **Basic validation (metadata):** - Presence of `/Type` field set to `Catalog` - Metadata `pdfaid:part` = 3 (PDF/A-3) - Metadata `pdfaid:conformance` = B or U - PDF version >= 1.4 **Strict VeraPDF validation (if use_verapdf=True):** - 146+ ISO 19005-3 rules (PDF/A-3B) - Absence of forbidden content (JavaScript, multimedia, dynamic forms) - Correctly embedded fonts and subsets - Compliant color spaces (sRGB, DeviceGray) - Valid file structure (cross-reference table) - XMP metadata conforming to ISO 16684-1 **What is verified:** - ✅ Long-term archivable file (20+ years) - ✅ Guaranteed readability (embedded fonts) - ✅ Legal compliance (France, Germany, EU) ### 3. XMP metadata (eXtensible Metadata Platform) **Checks performed:** - Presence of `<?xpacket>` block with XMP metadata - `fx:` namespace for Factur-X: `urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#` - Required Factur-X fields: - `fx:ConformanceLevel`: Profile (MINIMUM, BASIC, EN16931, EXTENDED) - `fx:DocumentFileName`: Embedded XML name - `fx:DocumentType`: \"INVOICE\" - `fx:Version`: Factur-X version (1.0.07) **What is verified:** - ✅ Metadata conforming to ISO 16684-1 - ✅ Correct declared Factur-X profile - ✅ Supported Factur-X version ### 4. Electronic signatures **Detection and analysis:** - Presence of `/Sig` dictionaries in PDF - Signature type: PAdES (PDF Advanced Electronic Signature) - Information extraction: - Signer name (`/Name`) - Signing date (`/M`) - Signature reason (`/Reason`) - Signature location (`/Location`) - Signature type (approval, certification) **What is verified:** - ✅ Presence of signatures or seals - ✅ Number of signatures (single or multi-signature) - ℹ️ No cryptographic verification (requires certificates) ## Parameters - **pdf_file** (required): The Factur-X PDF file to validate - **profile** (optional): Expected profile. If absent, auto-detected from XML - **use_verapdf** (optional, default=false): Enable strict PDF/A validation with VeraPDF - `false`: Fast metadata validation (2-3 seconds) - `true`: Complete ISO 19005-3 validation (15-30 seconds, **recommended for production**) ## Detailed response ```json { \"isCompliant\": true, \"xml\": { \"present\": true, \"compliant\": true, \"profile\": \"EN16931\", \"errors\": [] }, \"pdfa\": { \"compliant\": true, \"version\": \"PDF/A-3B\", \"method\": \"verapdf\", \"errors\": [] }, \"xmp\": { \"present\": true, \"compliant\": true, \"metadata\": {...} }, \"signatures\": { \"present\": true, \"count\": 1, \"details\": [...] } } ``` ## Use cases - **Before sending**: Validate generated invoice before transmission to client - **On reception**: Verify compliance of invoice received from supplier - **Audit**: Check quality of invoice batches - **Legal compliance**: Ensure B2B/B2G obligations are met in France - **Debugging**: Identify issues in generation process - **Archiving**: Guarantee long-term validity (PDF/A-3) ## Processing time - Basic validation: 2-3 seconds - VeraPDF validation: 15-30 seconds (depends on PDF size)
546
546
  # @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
547
547
  # @param [Hash] opts the optional parameters
548
- # @option opts [APIProfile] :profile
548
+ # @option opts [FacturXProfile] :profile
549
549
  # @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation. (default to false)
550
550
  # @return [PDFValidationResultAPI]
551
551
  def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post(pdf_file, opts = {})
@@ -557,7 +557,7 @@ module FactPulse
557
557
  # Validates a complete Factur-X PDF according to European and French standards. ## Applied validation standards - **EN 16931**: European semantic standard (directive 2014/55/EU) - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Factur-X / ZUGFeRD**: Franco-German specification - **Schematron**: XML business rules validation - **eIDAS**: European regulation on electronic identification (signatures) ## Checks performed ### 1. Factur-X XML extraction and validation **Checks performed:** - Presence of embedded XML file (&#x60;factur-x.xml&#x60; or &#x60;zugferd-invoice.xml&#x60;) - Automatic profile detection (MINIMUM, BASIC, EN16931, EXTENDED) - XML parsing with UTF-8 validation - GuidelineSpecifiedDocumentContextParameter/ID extraction **Schematron validation:** - Business rules for detected profile (MINIMUM: 45 rules, EN16931: 178 rules) - Cardinality of required elements - Calculation consistency (net, VAT, gross amounts, discounts) - Identifier formats (SIRET, intra-EU VAT, IBAN) - Standardized codes (ISO country codes, UN/ECE units, VAT codes) **What is verified:** - ✅ XML structure conforming to Cross Industry Invoice XSD - ✅ Correct UN/CEFACT namespace - ✅ European business rules (BR-xx) - ✅ French-specific rules (FR-xx) ### 2. PDF/A-3 compliance **Basic validation (metadata):** - Presence of &#x60;/Type&#x60; field set to &#x60;Catalog&#x60; - Metadata &#x60;pdfaid:part&#x60; &#x3D; 3 (PDF/A-3) - Metadata &#x60;pdfaid:conformance&#x60; &#x3D; B or U - PDF version &gt;&#x3D; 1.4 **Strict VeraPDF validation (if use_verapdf&#x3D;True):** - 146+ ISO 19005-3 rules (PDF/A-3B) - Absence of forbidden content (JavaScript, multimedia, dynamic forms) - Correctly embedded fonts and subsets - Compliant color spaces (sRGB, DeviceGray) - Valid file structure (cross-reference table) - XMP metadata conforming to ISO 16684-1 **What is verified:** - ✅ Long-term archivable file (20+ years) - ✅ Guaranteed readability (embedded fonts) - ✅ Legal compliance (France, Germany, EU) ### 3. XMP metadata (eXtensible Metadata Platform) **Checks performed:** - Presence of &#x60;&lt;?xpacket&gt;&#x60; block with XMP metadata - &#x60;fx:&#x60; namespace for Factur-X: &#x60;urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#&#x60; - Required Factur-X fields: - &#x60;fx:ConformanceLevel&#x60;: Profile (MINIMUM, BASIC, EN16931, EXTENDED) - &#x60;fx:DocumentFileName&#x60;: Embedded XML name - &#x60;fx:DocumentType&#x60;: \&quot;INVOICE\&quot; - &#x60;fx:Version&#x60;: Factur-X version (1.0.07) **What is verified:** - ✅ Metadata conforming to ISO 16684-1 - ✅ Correct declared Factur-X profile - ✅ Supported Factur-X version ### 4. Electronic signatures **Detection and analysis:** - Presence of &#x60;/Sig&#x60; dictionaries in PDF - Signature type: PAdES (PDF Advanced Electronic Signature) - Information extraction: - Signer name (&#x60;/Name&#x60;) - Signing date (&#x60;/M&#x60;) - Signature reason (&#x60;/Reason&#x60;) - Signature location (&#x60;/Location&#x60;) - Signature type (approval, certification) **What is verified:** - ✅ Presence of signatures or seals - ✅ Number of signatures (single or multi-signature) - ℹ️ No cryptographic verification (requires certificates) ## Parameters - **pdf_file** (required): The Factur-X PDF file to validate - **profile** (optional): Expected profile. If absent, auto-detected from XML - **use_verapdf** (optional, default&#x3D;false): Enable strict PDF/A validation with VeraPDF - &#x60;false&#x60;: Fast metadata validation (2-3 seconds) - &#x60;true&#x60;: Complete ISO 19005-3 validation (15-30 seconds, **recommended for production**) ## Detailed response &#x60;&#x60;&#x60;json { \&quot;isCompliant\&quot;: true, \&quot;xml\&quot;: { \&quot;present\&quot;: true, \&quot;compliant\&quot;: true, \&quot;profile\&quot;: \&quot;EN16931\&quot;, \&quot;errors\&quot;: [] }, \&quot;pdfa\&quot;: { \&quot;compliant\&quot;: true, \&quot;version\&quot;: \&quot;PDF/A-3B\&quot;, \&quot;method\&quot;: \&quot;verapdf\&quot;, \&quot;errors\&quot;: [] }, \&quot;xmp\&quot;: { \&quot;present\&quot;: true, \&quot;compliant\&quot;: true, \&quot;metadata\&quot;: {...} }, \&quot;signatures\&quot;: { \&quot;present\&quot;: true, \&quot;count\&quot;: 1, \&quot;details\&quot;: [...] } } &#x60;&#x60;&#x60; ## Use cases - **Before sending**: Validate generated invoice before transmission to client - **On reception**: Verify compliance of invoice received from supplier - **Audit**: Check quality of invoice batches - **Legal compliance**: Ensure B2B/B2G obligations are met in France - **Debugging**: Identify issues in generation process - **Archiving**: Guarantee long-term validity (PDF/A-3) ## Processing time - Basic validation: 2-3 seconds - VeraPDF validation: 15-30 seconds (depends on PDF size)
558
558
  # @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
559
559
  # @param [Hash] opts the optional parameters
560
- # @option opts [APIProfile] :profile
560
+ # @option opts [FacturXProfile] :profile
561
561
  # @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation. (default to false)
562
562
  # @return [Array<(PDFValidationResultAPI, Integer, Hash)>] PDFValidationResultAPI data, response status code and response headers
563
563
  def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(pdf_file, opts = {})
@@ -620,7 +620,7 @@ module FactPulse
620
620
  # Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a `task_id` (HTTP 202) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn't wait during validation ## When to use this mode? - **VeraPDF validation enabled** (`use_verapdf=True`): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs > 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile's Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use `GET /tasks/{task_id}/status` endpoint to retrieve the result. **Polling example**: ```python import requests import time # 1. Submit task response = requests.post(\"/validate-facturx-async\", files={\"pdf_file\": pdf_file}) task_id = response.json()[\"taskId\"] # 2. Poll every 2 seconds while True: status_response = requests.get(f\"/tasks/{task_id}/status\") status = status_response.json() if status[\"status\"] == \"SUCCESS\": result = status[\"result\"][\"validation_result\"] print(f\"Compliant: {result['is_compliant']}\") break elif status[\"status\"] == \"FAILURE\": print(f\"Error: {status['result']['errorMessage']}\") break time.sleep(2) # Wait 2 seconds before next check ``` ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
621
621
  # @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
622
622
  # @param [Hash] opts the optional parameters
623
- # @option opts [APIProfile] :profile
623
+ # @option opts [FacturXProfile] :profile
624
624
  # @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds. (default to false)
625
625
  # @return [TaskResponse]
626
626
  def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post(pdf_file, opts = {})
@@ -632,7 +632,7 @@ module FactPulse
632
632
  # Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a &#x60;task_id&#x60; (HTTP 202) 3. **Tracking**: Use the &#x60;/tasks/{task_id}/status&#x60; endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn&#39;t wait during validation ## When to use this mode? - **VeraPDF validation enabled** (&#x60;use_verapdf&#x3D;True&#x60;): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs &gt; 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile&#39;s Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use &#x60;GET /tasks/{task_id}/status&#x60; endpoint to retrieve the result. **Polling example**: &#x60;&#x60;&#x60;python import requests import time # 1. Submit task response &#x3D; requests.post(\&quot;/validate-facturx-async\&quot;, files&#x3D;{\&quot;pdf_file\&quot;: pdf_file}) task_id &#x3D; response.json()[\&quot;taskId\&quot;] # 2. Poll every 2 seconds while True: status_response &#x3D; requests.get(f\&quot;/tasks/{task_id}/status\&quot;) status &#x3D; status_response.json() if status[\&quot;status\&quot;] &#x3D;&#x3D; \&quot;SUCCESS\&quot;: result &#x3D; status[\&quot;result\&quot;][\&quot;validation_result\&quot;] print(f\&quot;Compliant: {result[&#39;is_compliant&#39;]}\&quot;) break elif status[\&quot;status\&quot;] &#x3D;&#x3D; \&quot;FAILURE\&quot;: print(f\&quot;Error: {status[&#39;result&#39;][&#39;errorMessage&#39;]}\&quot;) break time.sleep(2) # Wait 2 seconds before next check &#x60;&#x60;&#x60; ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
633
633
  # @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
634
634
  # @param [Hash] opts the optional parameters
635
- # @option opts [APIProfile] :profile
635
+ # @option opts [FacturXProfile] :profile
636
636
  # @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds. (default to false)
637
637
  # @return [Array<(TaskResponse, Integer, Hash)>] TaskResponse data, response status code and response headers
638
638
  def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(pdf_file, opts = {})
@@ -764,7 +764,7 @@ module FactPulse
764
764
  # Validates a Factur-X XML file against Schematron business rules according to EN 16931 standard. ## Applied Standard **Schematron ISO/IEC 19757-3**: Business rules validation language for XML - Semantic validation (beyond XSD syntax) - European EN 16931 business rules - French-specific Factur-X rules - Arithmetic calculations and data consistency ## Profiles and validated rules ### MINIMUM (45 rules) - Unique invoice identifier - Dates (issue, due date) - Party identifiers (SIRET/SIREN) - Total gross amount ### BASIC (102 rules) - All MINIMUM rules - Detailed invoice lines - Basic VAT calculations - Payment methods - References (order, contract) ### EN16931 (178 rules) - All BASIC rules - **European rules (BR-xx)**: 81 business rules - **French rules (FR-xx)**: 12 France-specific rules - **Advanced calculations (CR-xx)**: 32 calculation rules - **Standardized codes (CL-xx)**: 52 code lists ### EXTENDED (210+ rules) - All EN16931 rules - Logistics information - Advanced accounting data - Multiple external references ## Checks performed ### 1. Syntax validation - Correct XML parsing (UTF-8, well-formed) - UN/CEFACT namespaces present - Hierarchical structure respected ### 2. Business rules (BR-xx) Examples: - `BR-1`: Invoice total must equal sum of line totals + document-level amounts - `BR-CO-10`: Sum of VAT base amounts must equal invoice net total - `BR-16`: Invoice currency code must be in ISO 4217 list ### 3. French rules (FR-xx) Examples: - `FR-1`: Supplier SIRET must have 14 digits - `FR-2`: Customer SIRET must have 14 digits (if present) - `FR-5`: Intra-EU VAT number must be in format FRxx999999999 ### 4. Calculation rules (CR-xx) - Net + VAT = Gross amounts - Sum of lines = Document total - Discounts and surcharges correctly applied - Compliant rounding (2 decimals for amounts) ### 5. Standardized codes (CL-xx) - ISO 3166-1 alpha-2 country codes - ISO 4217 currency codes - UN/ECE Rec 20 measurement units - VAT codes (types, categories, exemptions) - SchemeID for identifiers (0002=SIREN, 0009=SIRET, etc.) ## Validation process 1. **XSLT loading**: Schematron file converted to XSLT (Saxon-HE) 2. **Transformation**: Rules applied to XML 3. **Results analysis**: Extraction of errors (`failed-assert`) and warnings (`successful-report`) 4. **Report**: Structured list of non-conformities ## Responses **200 OK**: Compliant XML ```json { \"message\": \"XML is compliant with EN16931 profile\" } ``` **400 Bad Request**: Non-compliant XML ```json { \"detail\": [ \"[BR-1] Invoice total (120.00) does not match calculated sum (100.00 + 20.00)\", \"[FR-1] Supplier SIRET must contain exactly 14 digits\" ] } ``` ## Use cases - **Pre-validation**: Verify XML before PDF/A integration - **Debugging**: Precisely identify generation errors - **Testing**: Validate test or example XMLs - **Compliance**: Ensure European and French rules are met - **Development**: Quick testing without PDF generation ## Processing time - MINIMUM profile: ~0.5 second - EN16931 profile: ~1-2 seconds - EXTENDED profile: ~2-3 seconds
765
765
  # @param xml_file [File] Factur-X XML file to validate (.xml format).
766
766
  # @param [Hash] opts the optional parameters
767
- # @option opts [APIProfile] :profile Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
767
+ # @option opts [FacturXProfile] :profile Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
768
768
  # @return [ValidationSuccessResponse]
769
769
  def validate_xml_api_v1_processing_validate_xml_post(xml_file, opts = {})
770
770
  data, _status_code, _headers = validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts)
@@ -775,7 +775,7 @@ module FactPulse
775
775
  # Validates a Factur-X XML file against Schematron business rules according to EN 16931 standard. ## Applied Standard **Schematron ISO/IEC 19757-3**: Business rules validation language for XML - Semantic validation (beyond XSD syntax) - European EN 16931 business rules - French-specific Factur-X rules - Arithmetic calculations and data consistency ## Profiles and validated rules ### MINIMUM (45 rules) - Unique invoice identifier - Dates (issue, due date) - Party identifiers (SIRET/SIREN) - Total gross amount ### BASIC (102 rules) - All MINIMUM rules - Detailed invoice lines - Basic VAT calculations - Payment methods - References (order, contract) ### EN16931 (178 rules) - All BASIC rules - **European rules (BR-xx)**: 81 business rules - **French rules (FR-xx)**: 12 France-specific rules - **Advanced calculations (CR-xx)**: 32 calculation rules - **Standardized codes (CL-xx)**: 52 code lists ### EXTENDED (210+ rules) - All EN16931 rules - Logistics information - Advanced accounting data - Multiple external references ## Checks performed ### 1. Syntax validation - Correct XML parsing (UTF-8, well-formed) - UN/CEFACT namespaces present - Hierarchical structure respected ### 2. Business rules (BR-xx) Examples: - &#x60;BR-1&#x60;: Invoice total must equal sum of line totals + document-level amounts - &#x60;BR-CO-10&#x60;: Sum of VAT base amounts must equal invoice net total - &#x60;BR-16&#x60;: Invoice currency code must be in ISO 4217 list ### 3. French rules (FR-xx) Examples: - &#x60;FR-1&#x60;: Supplier SIRET must have 14 digits - &#x60;FR-2&#x60;: Customer SIRET must have 14 digits (if present) - &#x60;FR-5&#x60;: Intra-EU VAT number must be in format FRxx999999999 ### 4. Calculation rules (CR-xx) - Net + VAT &#x3D; Gross amounts - Sum of lines &#x3D; Document total - Discounts and surcharges correctly applied - Compliant rounding (2 decimals for amounts) ### 5. Standardized codes (CL-xx) - ISO 3166-1 alpha-2 country codes - ISO 4217 currency codes - UN/ECE Rec 20 measurement units - VAT codes (types, categories, exemptions) - SchemeID for identifiers (0002&#x3D;SIREN, 0009&#x3D;SIRET, etc.) ## Validation process 1. **XSLT loading**: Schematron file converted to XSLT (Saxon-HE) 2. **Transformation**: Rules applied to XML 3. **Results analysis**: Extraction of errors (&#x60;failed-assert&#x60;) and warnings (&#x60;successful-report&#x60;) 4. **Report**: Structured list of non-conformities ## Responses **200 OK**: Compliant XML &#x60;&#x60;&#x60;json { \&quot;message\&quot;: \&quot;XML is compliant with EN16931 profile\&quot; } &#x60;&#x60;&#x60; **400 Bad Request**: Non-compliant XML &#x60;&#x60;&#x60;json { \&quot;detail\&quot;: [ \&quot;[BR-1] Invoice total (120.00) does not match calculated sum (100.00 + 20.00)\&quot;, \&quot;[FR-1] Supplier SIRET must contain exactly 14 digits\&quot; ] } &#x60;&#x60;&#x60; ## Use cases - **Pre-validation**: Verify XML before PDF/A integration - **Debugging**: Precisely identify generation errors - **Testing**: Validate test or example XMLs - **Compliance**: Ensure European and French rules are met - **Development**: Quick testing without PDF generation ## Processing time - MINIMUM profile: ~0.5 second - EN16931 profile: ~1-2 seconds - EXTENDED profile: ~2-3 seconds
776
776
  # @param xml_file [File] Factur-X XML file to validate (.xml format).
777
777
  # @param [Hash] opts the optional parameters
778
- # @option opts [APIProfile] :profile Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
778
+ # @option opts [FacturXProfile] :profile Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
779
779
  # @return [Array<(ValidationSuccessResponse, Integer, Hash)>] ValidationSuccessResponse data, response status code and response headers
780
780
  def validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts = {})
781
781
  if @api_client.config.debugging
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.18.0-SNAPSHOT
9
+ Generator version: 7.19.0-SNAPSHOT
10
10
 
11
11
  =end
12
12