factpulse 2.0.37__py3-none-any.whl → 3.0.7__py3-none-any.whl

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.

Potentially problematic release.


This version of factpulse might be problematic. Click here for more details.

Files changed (262) hide show
  1. factpulse/__init__.py +265 -197
  2. factpulse/api/__init__.py +5 -4
  3. factpulse/api/afnorpdppa_api.py +34 -34
  4. factpulse/api/afnorpdppa_directory_service_api.py +59 -59
  5. factpulse/api/afnorpdppa_flow_service_api.py +23 -23
  6. factpulse/api/chorus_pro_api.py +211 -211
  7. factpulse/api/document_conversion_api.py +1506 -0
  8. factpulse/api/{sant_api.py → health_api.py} +22 -22
  9. factpulse/api/invoice_processing_api.py +3437 -0
  10. factpulse/api/{vrification_pdfxml_api.py → pdfxml_verification_api.py} +240 -240
  11. factpulse/api/{utilisateur_api.py → user_api.py} +17 -17
  12. factpulse/api_client.py +3 -3
  13. factpulse/configuration.py +3 -3
  14. factpulse/exceptions.py +2 -2
  15. factpulse/models/__init__.py +128 -95
  16. factpulse/models/acknowledgment_status.py +38 -0
  17. factpulse/models/additional_document.py +115 -0
  18. factpulse/models/afnor_credentials.py +106 -0
  19. factpulse/models/afnor_destination.py +127 -0
  20. factpulse/models/afnor_health_check_response.py +91 -0
  21. factpulse/models/afnor_result.py +105 -0
  22. factpulse/models/allowance_charge.py +147 -0
  23. factpulse/models/allowance_reason_code.py +42 -0
  24. factpulse/models/allowance_total_amount.py +145 -0
  25. factpulse/models/amount.py +139 -0
  26. factpulse/models/amount_due.py +139 -0
  27. factpulse/models/api_error.py +5 -5
  28. factpulse/models/async_task_status.py +97 -0
  29. factpulse/models/base_amount.py +145 -0
  30. factpulse/models/bounding_box_schema.py +10 -10
  31. factpulse/models/celery_status.py +40 -0
  32. factpulse/models/certificate_info_response.py +24 -24
  33. factpulse/models/charge_total_amount.py +145 -0
  34. factpulse/models/chorus_pro_destination.py +108 -0
  35. factpulse/models/chorus_pro_result.py +101 -0
  36. factpulse/models/contact.py +113 -0
  37. factpulse/models/convert_error_response.py +105 -0
  38. factpulse/models/convert_pending_input_response.py +114 -0
  39. factpulse/models/convert_resume_request.py +87 -0
  40. factpulse/models/convert_success_response.py +126 -0
  41. factpulse/models/convert_validation_failed_response.py +120 -0
  42. factpulse/models/delivery_party.py +121 -0
  43. factpulse/models/destination.py +27 -27
  44. factpulse/models/document_type_info.py +91 -0
  45. factpulse/models/electronic_address.py +90 -0
  46. factpulse/models/enriched_invoice_info.py +133 -0
  47. factpulse/models/error_level.py +2 -2
  48. factpulse/models/error_source.py +2 -2
  49. factpulse/models/extraction_info.py +93 -0
  50. factpulse/models/factur_x_invoice.py +320 -0
  51. factpulse/models/factur_x_profile.py +39 -0
  52. factpulse/models/factur_xpdf_info.py +91 -0
  53. factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.py +95 -0
  54. factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.py +115 -0
  55. factpulse/models/field_status.py +40 -0
  56. factpulse/models/file_info.py +94 -0
  57. factpulse/models/files_info.py +106 -0
  58. factpulse/models/flow_direction.py +37 -0
  59. factpulse/models/flow_profile.py +38 -0
  60. factpulse/models/flow_summary.py +131 -0
  61. factpulse/models/flow_syntax.py +40 -0
  62. factpulse/models/flow_type.py +40 -0
  63. factpulse/models/generate_certificate_request.py +26 -26
  64. factpulse/models/generate_certificate_response.py +15 -15
  65. factpulse/models/get_chorus_pro_id_request.py +100 -0
  66. factpulse/models/get_chorus_pro_id_response.py +98 -0
  67. factpulse/models/get_invoice_request.py +98 -0
  68. factpulse/models/get_invoice_response.py +142 -0
  69. factpulse/models/get_structure_request.py +100 -0
  70. factpulse/models/get_structure_response.py +142 -0
  71. factpulse/models/global_allowance_amount.py +139 -0
  72. factpulse/models/gross_unit_price.py +145 -0
  73. factpulse/models/http_validation_error.py +2 -2
  74. factpulse/models/incoming_invoice.py +196 -0
  75. factpulse/models/incoming_supplier.py +144 -0
  76. factpulse/models/invoice_format.py +38 -0
  77. factpulse/models/invoice_line.py +354 -0
  78. factpulse/models/invoice_line_allowance_amount.py +145 -0
  79. factpulse/models/invoice_note.py +94 -0
  80. factpulse/models/invoice_references.py +194 -0
  81. factpulse/models/invoice_status.py +96 -0
  82. factpulse/models/invoice_totals.py +177 -0
  83. factpulse/models/invoice_totals_prepayment.py +145 -0
  84. factpulse/models/invoice_type_code.py +51 -0
  85. factpulse/models/invoicing_framework.py +110 -0
  86. factpulse/models/invoicing_framework_code.py +39 -0
  87. factpulse/models/line_net_amount.py +145 -0
  88. factpulse/models/line_total_amount.py +145 -0
  89. factpulse/models/mandatory_note_schema.py +124 -0
  90. factpulse/models/manual_rate.py +139 -0
  91. factpulse/models/manual_vat_rate.py +139 -0
  92. factpulse/models/missing_field.py +107 -0
  93. factpulse/models/operation_nature.py +49 -0
  94. factpulse/models/output_format.py +37 -0
  95. factpulse/models/page_dimensions_schema.py +89 -0
  96. factpulse/models/payee.py +168 -0
  97. factpulse/models/payment_card.py +99 -0
  98. factpulse/models/payment_means.py +41 -0
  99. factpulse/models/pdf_validation_result_api.py +169 -0
  100. factpulse/models/pdp_credentials.py +15 -15
  101. factpulse/models/percentage.py +145 -0
  102. factpulse/models/postal_address.py +134 -0
  103. factpulse/models/price_allowance_amount.py +145 -0
  104. factpulse/models/price_basis_quantity.py +145 -0
  105. factpulse/models/processing_options.py +94 -0
  106. factpulse/models/product_characteristic.py +89 -0
  107. factpulse/models/product_classification.py +101 -0
  108. factpulse/models/quantity.py +139 -0
  109. factpulse/models/recipient.py +167 -0
  110. factpulse/models/rounding_amount.py +145 -0
  111. factpulse/models/scheme_id.py +10 -4
  112. factpulse/models/search_flow_request.py +143 -0
  113. factpulse/models/search_flow_response.py +101 -0
  114. factpulse/models/search_services_response.py +101 -0
  115. factpulse/models/search_structure_request.py +119 -0
  116. factpulse/models/search_structure_response.py +101 -0
  117. factpulse/models/signature_info.py +6 -6
  118. factpulse/models/signature_info_api.py +122 -0
  119. factpulse/models/signature_parameters.py +133 -0
  120. factpulse/models/simplified_invoice_data.py +124 -0
  121. factpulse/models/structure_info.py +14 -14
  122. factpulse/models/structure_parameters.py +91 -0
  123. factpulse/models/structure_service.py +93 -0
  124. factpulse/models/submission_mode.py +38 -0
  125. factpulse/models/submit_complete_invoice_request.py +116 -0
  126. factpulse/models/submit_complete_invoice_response.py +145 -0
  127. factpulse/models/submit_flow_request.py +123 -0
  128. factpulse/models/submit_flow_response.py +109 -0
  129. factpulse/models/submit_gross_amount.py +139 -0
  130. factpulse/models/submit_invoice_request.py +176 -0
  131. factpulse/models/submit_invoice_response.py +103 -0
  132. factpulse/models/submit_net_amount.py +139 -0
  133. factpulse/models/submit_vat_amount.py +139 -0
  134. factpulse/models/supplementary_attachment.py +95 -0
  135. factpulse/models/supplier.py +225 -0
  136. factpulse/models/task_response.py +87 -0
  137. factpulse/models/tax_representative.py +95 -0
  138. factpulse/models/taxable_amount.py +139 -0
  139. factpulse/models/total_gross_amount.py +139 -0
  140. factpulse/models/total_net_amount.py +139 -0
  141. factpulse/models/total_vat_amount.py +139 -0
  142. factpulse/models/unit_net_price.py +139 -0
  143. factpulse/models/unit_of_measure.py +41 -0
  144. factpulse/models/validation_error.py +2 -2
  145. factpulse/models/validation_error_detail.py +6 -6
  146. factpulse/models/validation_error_loc_inner.py +2 -2
  147. factpulse/models/validation_error_response.py +87 -0
  148. factpulse/models/validation_info.py +105 -0
  149. factpulse/models/validation_success_response.py +87 -0
  150. factpulse/models/vat_accounting_code.py +39 -0
  151. factpulse/models/vat_amount.py +139 -0
  152. factpulse/models/vat_category.py +44 -0
  153. factpulse/models/vat_line.py +140 -0
  154. factpulse/models/vat_point_date_code.py +38 -0
  155. factpulse/models/vat_rate.py +145 -0
  156. factpulse/models/verification_success_response.py +135 -0
  157. factpulse/models/verified_field_schema.py +129 -0
  158. factpulse/rest.py +2 -2
  159. factpulse-3.0.7.dist-info/METADATA +292 -0
  160. factpulse-3.0.7.dist-info/RECORD +168 -0
  161. factpulse_helpers/__init__.py +34 -34
  162. factpulse_helpers/client.py +1019 -795
  163. factpulse_helpers/exceptions.py +68 -68
  164. factpulse/api/traitement_facture_api.py +0 -3437
  165. factpulse/models/adresse_electronique.py +0 -90
  166. factpulse/models/adresse_postale.py +0 -120
  167. factpulse/models/cadre_de_facturation.py +0 -110
  168. factpulse/models/categorie_tva.py +0 -44
  169. factpulse/models/champ_verifie_schema.py +0 -129
  170. factpulse/models/chorus_pro_credentials.py +0 -95
  171. factpulse/models/code_cadre_facturation.py +0 -39
  172. factpulse/models/code_raison_reduction.py +0 -42
  173. factpulse/models/consulter_facture_request.py +0 -98
  174. factpulse/models/consulter_facture_response.py +0 -142
  175. factpulse/models/consulter_structure_request.py +0 -100
  176. factpulse/models/consulter_structure_response.py +0 -142
  177. factpulse/models/credentials_afnor.py +0 -106
  178. factpulse/models/credentials_chorus_pro.py +0 -115
  179. factpulse/models/destinataire.py +0 -130
  180. factpulse/models/destination_afnor.py +0 -127
  181. factpulse/models/destination_chorus_pro.py +0 -108
  182. factpulse/models/dimension_page_schema.py +0 -89
  183. factpulse/models/direction_flux.py +0 -37
  184. factpulse/models/donnees_facture_simplifiees.py +0 -124
  185. factpulse/models/facture_enrichie_info.py +0 -133
  186. factpulse/models/facture_entrante.py +0 -196
  187. factpulse/models/facture_factur_x.py +0 -183
  188. factpulse/models/flux_resume.py +0 -131
  189. factpulse/models/format_facture.py +0 -38
  190. factpulse/models/format_sortie.py +0 -37
  191. factpulse/models/fournisseur.py +0 -153
  192. factpulse/models/fournisseur_entrant.py +0 -144
  193. factpulse/models/information_signature_api.py +0 -122
  194. factpulse/models/ligne_de_poste.py +0 -183
  195. factpulse/models/ligne_de_poste_montant_remise_ht.py +0 -145
  196. factpulse/models/ligne_de_poste_taux_tva_manuel.py +0 -145
  197. factpulse/models/ligne_de_tva.py +0 -132
  198. factpulse/models/mode_depot.py +0 -38
  199. factpulse/models/mode_paiement.py +0 -41
  200. factpulse/models/montant_a_payer.py +0 -139
  201. factpulse/models/montant_base_ht.py +0 -139
  202. factpulse/models/montant_ht_total.py +0 -139
  203. factpulse/models/montant_remise_globale_ttc.py +0 -139
  204. factpulse/models/montant_total.py +0 -133
  205. factpulse/models/montant_total_acompte.py +0 -145
  206. factpulse/models/montant_total_ligne_ht.py +0 -139
  207. factpulse/models/montant_ttc_total.py +0 -139
  208. factpulse/models/montant_tva.py +0 -139
  209. factpulse/models/montant_tva_ligne.py +0 -139
  210. factpulse/models/montant_tva_total.py +0 -139
  211. factpulse/models/montant_unitaire_ht.py +0 -139
  212. factpulse/models/nature_operation.py +0 -49
  213. factpulse/models/note.py +0 -94
  214. factpulse/models/note_obligatoire_schema.py +0 -124
  215. factpulse/models/obtenir_id_chorus_pro_request.py +0 -100
  216. factpulse/models/obtenir_id_chorus_pro_response.py +0 -98
  217. factpulse/models/options_processing.py +0 -94
  218. factpulse/models/parametres_signature.py +0 -133
  219. factpulse/models/parametres_structure.py +0 -91
  220. factpulse/models/pdf_factur_x_info.py +0 -91
  221. factpulse/models/piece_jointe_complementaire.py +0 -95
  222. factpulse/models/profil_api.py +0 -39
  223. factpulse/models/profil_flux.py +0 -38
  224. factpulse/models/quantite.py +0 -139
  225. factpulse/models/rechercher_services_response.py +0 -101
  226. factpulse/models/rechercher_structure_request.py +0 -119
  227. factpulse/models/rechercher_structure_response.py +0 -101
  228. factpulse/models/references.py +0 -124
  229. factpulse/models/reponse_healthcheck_afnor.py +0 -91
  230. factpulse/models/reponse_recherche_flux.py +0 -101
  231. factpulse/models/reponse_soumission_flux.py +0 -109
  232. factpulse/models/reponse_tache.py +0 -87
  233. factpulse/models/reponse_validation_erreur.py +0 -87
  234. factpulse/models/reponse_validation_succes.py +0 -87
  235. factpulse/models/reponse_verification_succes.py +0 -135
  236. factpulse/models/requete_recherche_flux.py +0 -143
  237. factpulse/models/requete_soumission_flux.py +0 -123
  238. factpulse/models/resultat_afnor.py +0 -105
  239. factpulse/models/resultat_chorus_pro.py +0 -101
  240. factpulse/models/resultat_validation_pdfapi.py +0 -169
  241. factpulse/models/service_structure.py +0 -93
  242. factpulse/models/soumettre_facture_complete_request.py +0 -116
  243. factpulse/models/soumettre_facture_complete_response.py +0 -145
  244. factpulse/models/soumettre_facture_request.py +0 -176
  245. factpulse/models/soumettre_facture_response.py +0 -103
  246. factpulse/models/statut_acquittement.py +0 -38
  247. factpulse/models/statut_celery.py +0 -40
  248. factpulse/models/statut_champ_api.py +0 -40
  249. factpulse/models/statut_facture.py +0 -96
  250. factpulse/models/statut_tache.py +0 -97
  251. factpulse/models/syntaxe_flux.py +0 -40
  252. factpulse/models/tauxmanuel.py +0 -139
  253. factpulse/models/type_document.py +0 -40
  254. factpulse/models/type_facture.py +0 -37
  255. factpulse/models/type_flux.py +0 -40
  256. factpulse/models/type_tva.py +0 -39
  257. factpulse/models/unite.py +0 -41
  258. factpulse-2.0.37.dist-info/METADATA +0 -292
  259. factpulse-2.0.37.dist-info/RECORD +0 -134
  260. {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/WHEEL +0 -0
  261. {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/licenses/LICENSE +0 -0
  262. {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,3437 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FactPulse REST API
5
+
6
+ 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/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import Field, StrictBool, StrictBytes, StrictStr
20
+ from typing import Any, Optional, Tuple, Union
21
+ from typing_extensions import Annotated
22
+ from factpulse.models.async_task_status import AsyncTaskStatus
23
+ from factpulse.models.generate_certificate_request import GenerateCertificateRequest
24
+ from factpulse.models.generate_certificate_response import GenerateCertificateResponse
25
+ from factpulse.models.pdf_validation_result_api import PDFValidationResultAPI
26
+ from factpulse.models.submit_complete_invoice_request import SubmitCompleteInvoiceRequest
27
+ from factpulse.models.submit_complete_invoice_response import SubmitCompleteInvoiceResponse
28
+ from factpulse.models.task_response import TaskResponse
29
+ from factpulse.models.validation_success_response import ValidationSuccessResponse
30
+
31
+ from factpulse.api_client import ApiClient, RequestSerialized
32
+ from factpulse.api_response import ApiResponse
33
+ from factpulse.rest import RESTResponseType
34
+
35
+
36
+ class InvoiceProcessingApi:
37
+ """NOTE: This class is auto generated by OpenAPI Generator
38
+ Ref: https://openapi-generator.tech
39
+
40
+ Do not edit the class manually.
41
+ """
42
+
43
+ def __init__(self, api_client=None) -> None:
44
+ if api_client is None:
45
+ api_client = ApiClient.get_default()
46
+ self.api_client = api_client
47
+
48
+
49
+ @validate_call
50
+ def generate_invoice_api_v1_processing_generate_invoice_post(
51
+ self,
52
+ invoice_data: Annotated[StrictStr, Field(description="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! ")],
53
+ profile: Annotated[Optional[Any], Field(description="Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.")] = None,
54
+ output_format: Annotated[Optional[Any], Field(description="Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).")] = None,
55
+ auto_enrich: Annotated[Optional[StrictBool], Field(description="🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)")] = None,
56
+ source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
57
+ _request_timeout: Union[
58
+ None,
59
+ Annotated[StrictFloat, Field(gt=0)],
60
+ Tuple[
61
+ Annotated[StrictFloat, Field(gt=0)],
62
+ Annotated[StrictFloat, Field(gt=0)]
63
+ ]
64
+ ] = None,
65
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
66
+ _content_type: Optional[StrictStr] = None,
67
+ _headers: Optional[Dict[StrictStr, Any]] = None,
68
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
69
+ ) -> TaskResponse:
70
+ """Generate a Factur-X invoice
71
+
72
+ 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.
73
+
74
+ :param invoice_data: 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! (required)
75
+ :type invoice_data: str
76
+ :param profile: Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
77
+ :type profile: FacturXProfile
78
+ :param output_format: Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
79
+ :type output_format: OutputFormat
80
+ :param auto_enrich: 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
81
+ :type auto_enrich: bool
82
+ :param source_pdf:
83
+ :type source_pdf: bytearray
84
+ :param _request_timeout: timeout setting for this request. If one
85
+ number provided, it will be total request
86
+ timeout. It can also be a pair (tuple) of
87
+ (connection, read) timeouts.
88
+ :type _request_timeout: int, tuple(int, int), optional
89
+ :param _request_auth: set to override the auth_settings for an a single
90
+ request; this effectively ignores the
91
+ authentication in the spec for a single request.
92
+ :type _request_auth: dict, optional
93
+ :param _content_type: force content-type for the request.
94
+ :type _content_type: str, Optional
95
+ :param _headers: set to override the headers for a single
96
+ request; this effectively ignores the headers
97
+ in the spec for a single request.
98
+ :type _headers: dict, optional
99
+ :param _host_index: set to override the host_index for a single
100
+ request; this effectively ignores the host_index
101
+ in the spec for a single request.
102
+ :type _host_index: int, optional
103
+ :return: Returns the result object.
104
+ """ # noqa: E501
105
+
106
+ _param = self._generate_invoice_api_v1_processing_generate_invoice_post_serialize(
107
+ invoice_data=invoice_data,
108
+ profile=profile,
109
+ output_format=output_format,
110
+ auto_enrich=auto_enrich,
111
+ source_pdf=source_pdf,
112
+ _request_auth=_request_auth,
113
+ _content_type=_content_type,
114
+ _headers=_headers,
115
+ _host_index=_host_index
116
+ )
117
+
118
+ _response_types_map: Dict[str, Optional[str]] = {
119
+ '202': "TaskResponse",
120
+ '400': None,
121
+ '422': None,
122
+ }
123
+ response_data = self.api_client.call_api(
124
+ *_param,
125
+ _request_timeout=_request_timeout
126
+ )
127
+ response_data.read()
128
+ return self.api_client.response_deserialize(
129
+ response_data=response_data,
130
+ response_types_map=_response_types_map,
131
+ ).data
132
+
133
+
134
+ @validate_call
135
+ def generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(
136
+ self,
137
+ invoice_data: Annotated[StrictStr, Field(description="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! ")],
138
+ profile: Annotated[Optional[Any], Field(description="Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.")] = None,
139
+ output_format: Annotated[Optional[Any], Field(description="Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).")] = None,
140
+ auto_enrich: Annotated[Optional[StrictBool], Field(description="🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)")] = None,
141
+ source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
142
+ _request_timeout: Union[
143
+ None,
144
+ Annotated[StrictFloat, Field(gt=0)],
145
+ Tuple[
146
+ Annotated[StrictFloat, Field(gt=0)],
147
+ Annotated[StrictFloat, Field(gt=0)]
148
+ ]
149
+ ] = None,
150
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
151
+ _content_type: Optional[StrictStr] = None,
152
+ _headers: Optional[Dict[StrictStr, Any]] = None,
153
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
154
+ ) -> ApiResponse[TaskResponse]:
155
+ """Generate a Factur-X invoice
156
+
157
+ 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.
158
+
159
+ :param invoice_data: 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! (required)
160
+ :type invoice_data: str
161
+ :param profile: Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
162
+ :type profile: FacturXProfile
163
+ :param output_format: Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
164
+ :type output_format: OutputFormat
165
+ :param auto_enrich: 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
166
+ :type auto_enrich: bool
167
+ :param source_pdf:
168
+ :type source_pdf: bytearray
169
+ :param _request_timeout: timeout setting for this request. If one
170
+ number provided, it will be total request
171
+ timeout. It can also be a pair (tuple) of
172
+ (connection, read) timeouts.
173
+ :type _request_timeout: int, tuple(int, int), optional
174
+ :param _request_auth: set to override the auth_settings for an a single
175
+ request; this effectively ignores the
176
+ authentication in the spec for a single request.
177
+ :type _request_auth: dict, optional
178
+ :param _content_type: force content-type for the request.
179
+ :type _content_type: str, Optional
180
+ :param _headers: set to override the headers for a single
181
+ request; this effectively ignores the headers
182
+ in the spec for a single request.
183
+ :type _headers: dict, optional
184
+ :param _host_index: set to override the host_index for a single
185
+ request; this effectively ignores the host_index
186
+ in the spec for a single request.
187
+ :type _host_index: int, optional
188
+ :return: Returns the result object.
189
+ """ # noqa: E501
190
+
191
+ _param = self._generate_invoice_api_v1_processing_generate_invoice_post_serialize(
192
+ invoice_data=invoice_data,
193
+ profile=profile,
194
+ output_format=output_format,
195
+ auto_enrich=auto_enrich,
196
+ source_pdf=source_pdf,
197
+ _request_auth=_request_auth,
198
+ _content_type=_content_type,
199
+ _headers=_headers,
200
+ _host_index=_host_index
201
+ )
202
+
203
+ _response_types_map: Dict[str, Optional[str]] = {
204
+ '202': "TaskResponse",
205
+ '400': None,
206
+ '422': None,
207
+ }
208
+ response_data = self.api_client.call_api(
209
+ *_param,
210
+ _request_timeout=_request_timeout
211
+ )
212
+ response_data.read()
213
+ return self.api_client.response_deserialize(
214
+ response_data=response_data,
215
+ response_types_map=_response_types_map,
216
+ )
217
+
218
+
219
+ @validate_call
220
+ def generate_invoice_api_v1_processing_generate_invoice_post_without_preload_content(
221
+ self,
222
+ invoice_data: Annotated[StrictStr, Field(description="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! ")],
223
+ profile: Annotated[Optional[Any], Field(description="Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.")] = None,
224
+ output_format: Annotated[Optional[Any], Field(description="Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).")] = None,
225
+ auto_enrich: Annotated[Optional[StrictBool], Field(description="🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)")] = None,
226
+ source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
227
+ _request_timeout: Union[
228
+ None,
229
+ Annotated[StrictFloat, Field(gt=0)],
230
+ Tuple[
231
+ Annotated[StrictFloat, Field(gt=0)],
232
+ Annotated[StrictFloat, Field(gt=0)]
233
+ ]
234
+ ] = None,
235
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
236
+ _content_type: Optional[StrictStr] = None,
237
+ _headers: Optional[Dict[StrictStr, Any]] = None,
238
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
239
+ ) -> RESTResponseType:
240
+ """Generate a Factur-X invoice
241
+
242
+ 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.
243
+
244
+ :param invoice_data: 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! (required)
245
+ :type invoice_data: str
246
+ :param profile: Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
247
+ :type profile: FacturXProfile
248
+ :param output_format: Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
249
+ :type output_format: OutputFormat
250
+ :param auto_enrich: 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
251
+ :type auto_enrich: bool
252
+ :param source_pdf:
253
+ :type source_pdf: bytearray
254
+ :param _request_timeout: timeout setting for this request. If one
255
+ number provided, it will be total request
256
+ timeout. It can also be a pair (tuple) of
257
+ (connection, read) timeouts.
258
+ :type _request_timeout: int, tuple(int, int), optional
259
+ :param _request_auth: set to override the auth_settings for an a single
260
+ request; this effectively ignores the
261
+ authentication in the spec for a single request.
262
+ :type _request_auth: dict, optional
263
+ :param _content_type: force content-type for the request.
264
+ :type _content_type: str, Optional
265
+ :param _headers: set to override the headers for a single
266
+ request; this effectively ignores the headers
267
+ in the spec for a single request.
268
+ :type _headers: dict, optional
269
+ :param _host_index: set to override the host_index for a single
270
+ request; this effectively ignores the host_index
271
+ in the spec for a single request.
272
+ :type _host_index: int, optional
273
+ :return: Returns the result object.
274
+ """ # noqa: E501
275
+
276
+ _param = self._generate_invoice_api_v1_processing_generate_invoice_post_serialize(
277
+ invoice_data=invoice_data,
278
+ profile=profile,
279
+ output_format=output_format,
280
+ auto_enrich=auto_enrich,
281
+ source_pdf=source_pdf,
282
+ _request_auth=_request_auth,
283
+ _content_type=_content_type,
284
+ _headers=_headers,
285
+ _host_index=_host_index
286
+ )
287
+
288
+ _response_types_map: Dict[str, Optional[str]] = {
289
+ '202': "TaskResponse",
290
+ '400': None,
291
+ '422': None,
292
+ }
293
+ response_data = self.api_client.call_api(
294
+ *_param,
295
+ _request_timeout=_request_timeout
296
+ )
297
+ return response_data.response
298
+
299
+
300
+ def _generate_invoice_api_v1_processing_generate_invoice_post_serialize(
301
+ self,
302
+ invoice_data,
303
+ profile,
304
+ output_format,
305
+ auto_enrich,
306
+ source_pdf,
307
+ _request_auth,
308
+ _content_type,
309
+ _headers,
310
+ _host_index,
311
+ ) -> RequestSerialized:
312
+
313
+ _host = None
314
+
315
+ _collection_formats: Dict[str, str] = {
316
+ }
317
+
318
+ _path_params: Dict[str, str] = {}
319
+ _query_params: List[Tuple[str, str]] = []
320
+ _header_params: Dict[str, Optional[str]] = _headers or {}
321
+ _form_params: List[Tuple[str, str]] = []
322
+ _files: Dict[
323
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
324
+ ] = {}
325
+ _body_params: Optional[bytes] = None
326
+
327
+ # process the path parameters
328
+ # process the query parameters
329
+ # process the header parameters
330
+ # process the form parameters
331
+ if invoice_data is not None:
332
+ _form_params.append(('invoice_data', invoice_data))
333
+ if profile is not None:
334
+ _form_params.append(('profile', profile))
335
+ if output_format is not None:
336
+ _form_params.append(('output_format', output_format))
337
+ if auto_enrich is not None:
338
+ _form_params.append(('auto_enrich', auto_enrich))
339
+ if source_pdf is not None:
340
+ _files['source_pdf'] = source_pdf
341
+ # process the body parameter
342
+
343
+
344
+ # set the HTTP header `Accept`
345
+ if 'Accept' not in _header_params:
346
+ _header_params['Accept'] = self.api_client.select_header_accept(
347
+ [
348
+ 'application/json'
349
+ ]
350
+ )
351
+
352
+ # set the HTTP header `Content-Type`
353
+ if _content_type:
354
+ _header_params['Content-Type'] = _content_type
355
+ else:
356
+ _default_content_type = (
357
+ self.api_client.select_header_content_type(
358
+ [
359
+ 'multipart/form-data'
360
+ ]
361
+ )
362
+ )
363
+ if _default_content_type is not None:
364
+ _header_params['Content-Type'] = _default_content_type
365
+
366
+ # authentication setting
367
+ _auth_settings: List[str] = [
368
+ 'HTTPBearer'
369
+ ]
370
+
371
+ return self.api_client.param_serialize(
372
+ method='POST',
373
+ resource_path='/api/v1/processing/generate-invoice',
374
+ path_params=_path_params,
375
+ query_params=_query_params,
376
+ header_params=_header_params,
377
+ body=_body_params,
378
+ post_params=_form_params,
379
+ files=_files,
380
+ auth_settings=_auth_settings,
381
+ collection_formats=_collection_formats,
382
+ _host=_host,
383
+ _request_auth=_request_auth
384
+ )
385
+
386
+
387
+
388
+
389
+ @validate_call
390
+ def generate_test_certificate_api_v1_processing_generate_test_certificate_post(
391
+ self,
392
+ generate_certificate_request: GenerateCertificateRequest,
393
+ _request_timeout: Union[
394
+ None,
395
+ Annotated[StrictFloat, Field(gt=0)],
396
+ Tuple[
397
+ Annotated[StrictFloat, Field(gt=0)],
398
+ Annotated[StrictFloat, Field(gt=0)]
399
+ ]
400
+ ] = None,
401
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
402
+ _content_type: Optional[StrictStr] = None,
403
+ _headers: Optional[Dict[StrictStr, Any]] = None,
404
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
405
+ ) -> GenerateCertificateResponse:
406
+ """Generate a self-signed X.509 test certificate
407
+
408
+ Generates a self-signed X.509 certificate for PDF electronic signature testing. **⚠️ WARNING: TEST certificate only!** This certificate is: - ✅ Suitable for testing and development - ✅ Compatible with PDF signing (PAdES) - ✅ Compliant with eIDAS **SES** level (Simple Electronic Signature) - ❌ **NEVER usable in production** - ❌ **Not recognized** by browsers and PDF readers - ❌ **No legal value** ## eIDAS levels - **SES** (Simple): Self-signed certificate ← Generated by this endpoint - **AdES** (Advanced): Commercial CA certificate (Let's Encrypt, etc.) - **QES** (Qualified): Qualified certificate from QTSP (CertEurope, Universign, etc.) ## Usage Once generated, the certificate can be: 1. **Saved in Django** (recommended): - Django Admin > Signing Certificates - Upload `certificate_pem` and `private_key_pem` 2. **Used directly**: - Sign a PDF with `/sign-pdf` - The certificate will be automatically used ## Example call ```bash curl -X POST \"https://www.factpulse.fr/api/v1/processing/generate-test-certificate\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organization\": \"Client XYZ Ltd\", \"email\": \"contact@xyz.com\", \"validity_days\": 365 }' ``` ## Use cases - PDF signature testing in development - Electronic signature POC - Training and demos - Automated integration tests ## Technical compliance Certificate generated with: - RSA key 2048 or 4096 bits - SHA-256 algorithm - Key Usage extensions: `digitalSignature`, `contentCommitment` (non-repudiation) - Extended Key Usage extensions: `codeSigning`, `emailProtection` - Validity: 1 day to 10 years (configurable) - Format: PEM (certificate and key) - Optional: PKCS#12 (.p12)
409
+
410
+ :param generate_certificate_request: (required)
411
+ :type generate_certificate_request: GenerateCertificateRequest
412
+ :param _request_timeout: timeout setting for this request. If one
413
+ number provided, it will be total request
414
+ timeout. It can also be a pair (tuple) of
415
+ (connection, read) timeouts.
416
+ :type _request_timeout: int, tuple(int, int), optional
417
+ :param _request_auth: set to override the auth_settings for an a single
418
+ request; this effectively ignores the
419
+ authentication in the spec for a single request.
420
+ :type _request_auth: dict, optional
421
+ :param _content_type: force content-type for the request.
422
+ :type _content_type: str, Optional
423
+ :param _headers: set to override the headers for a single
424
+ request; this effectively ignores the headers
425
+ in the spec for a single request.
426
+ :type _headers: dict, optional
427
+ :param _host_index: set to override the host_index for a single
428
+ request; this effectively ignores the host_index
429
+ in the spec for a single request.
430
+ :type _host_index: int, optional
431
+ :return: Returns the result object.
432
+ """ # noqa: E501
433
+
434
+ _param = self._generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
435
+ generate_certificate_request=generate_certificate_request,
436
+ _request_auth=_request_auth,
437
+ _content_type=_content_type,
438
+ _headers=_headers,
439
+ _host_index=_host_index
440
+ )
441
+
442
+ _response_types_map: Dict[str, Optional[str]] = {
443
+ '200': "GenerateCertificateResponse",
444
+ '400': None,
445
+ '500': None,
446
+ '422': "HTTPValidationError",
447
+ }
448
+ response_data = self.api_client.call_api(
449
+ *_param,
450
+ _request_timeout=_request_timeout
451
+ )
452
+ response_data.read()
453
+ return self.api_client.response_deserialize(
454
+ response_data=response_data,
455
+ response_types_map=_response_types_map,
456
+ ).data
457
+
458
+
459
+ @validate_call
460
+ def generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(
461
+ self,
462
+ generate_certificate_request: GenerateCertificateRequest,
463
+ _request_timeout: Union[
464
+ None,
465
+ Annotated[StrictFloat, Field(gt=0)],
466
+ Tuple[
467
+ Annotated[StrictFloat, Field(gt=0)],
468
+ Annotated[StrictFloat, Field(gt=0)]
469
+ ]
470
+ ] = None,
471
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
472
+ _content_type: Optional[StrictStr] = None,
473
+ _headers: Optional[Dict[StrictStr, Any]] = None,
474
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
475
+ ) -> ApiResponse[GenerateCertificateResponse]:
476
+ """Generate a self-signed X.509 test certificate
477
+
478
+ Generates a self-signed X.509 certificate for PDF electronic signature testing. **⚠️ WARNING: TEST certificate only!** This certificate is: - ✅ Suitable for testing and development - ✅ Compatible with PDF signing (PAdES) - ✅ Compliant with eIDAS **SES** level (Simple Electronic Signature) - ❌ **NEVER usable in production** - ❌ **Not recognized** by browsers and PDF readers - ❌ **No legal value** ## eIDAS levels - **SES** (Simple): Self-signed certificate ← Generated by this endpoint - **AdES** (Advanced): Commercial CA certificate (Let's Encrypt, etc.) - **QES** (Qualified): Qualified certificate from QTSP (CertEurope, Universign, etc.) ## Usage Once generated, the certificate can be: 1. **Saved in Django** (recommended): - Django Admin > Signing Certificates - Upload `certificate_pem` and `private_key_pem` 2. **Used directly**: - Sign a PDF with `/sign-pdf` - The certificate will be automatically used ## Example call ```bash curl -X POST \"https://www.factpulse.fr/api/v1/processing/generate-test-certificate\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organization\": \"Client XYZ Ltd\", \"email\": \"contact@xyz.com\", \"validity_days\": 365 }' ``` ## Use cases - PDF signature testing in development - Electronic signature POC - Training and demos - Automated integration tests ## Technical compliance Certificate generated with: - RSA key 2048 or 4096 bits - SHA-256 algorithm - Key Usage extensions: `digitalSignature`, `contentCommitment` (non-repudiation) - Extended Key Usage extensions: `codeSigning`, `emailProtection` - Validity: 1 day to 10 years (configurable) - Format: PEM (certificate and key) - Optional: PKCS#12 (.p12)
479
+
480
+ :param generate_certificate_request: (required)
481
+ :type generate_certificate_request: GenerateCertificateRequest
482
+ :param _request_timeout: timeout setting for this request. If one
483
+ number provided, it will be total request
484
+ timeout. It can also be a pair (tuple) of
485
+ (connection, read) timeouts.
486
+ :type _request_timeout: int, tuple(int, int), optional
487
+ :param _request_auth: set to override the auth_settings for an a single
488
+ request; this effectively ignores the
489
+ authentication in the spec for a single request.
490
+ :type _request_auth: dict, optional
491
+ :param _content_type: force content-type for the request.
492
+ :type _content_type: str, Optional
493
+ :param _headers: set to override the headers for a single
494
+ request; this effectively ignores the headers
495
+ in the spec for a single request.
496
+ :type _headers: dict, optional
497
+ :param _host_index: set to override the host_index for a single
498
+ request; this effectively ignores the host_index
499
+ in the spec for a single request.
500
+ :type _host_index: int, optional
501
+ :return: Returns the result object.
502
+ """ # noqa: E501
503
+
504
+ _param = self._generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
505
+ generate_certificate_request=generate_certificate_request,
506
+ _request_auth=_request_auth,
507
+ _content_type=_content_type,
508
+ _headers=_headers,
509
+ _host_index=_host_index
510
+ )
511
+
512
+ _response_types_map: Dict[str, Optional[str]] = {
513
+ '200': "GenerateCertificateResponse",
514
+ '400': None,
515
+ '500': None,
516
+ '422': "HTTPValidationError",
517
+ }
518
+ response_data = self.api_client.call_api(
519
+ *_param,
520
+ _request_timeout=_request_timeout
521
+ )
522
+ response_data.read()
523
+ return self.api_client.response_deserialize(
524
+ response_data=response_data,
525
+ response_types_map=_response_types_map,
526
+ )
527
+
528
+
529
+ @validate_call
530
+ def generate_test_certificate_api_v1_processing_generate_test_certificate_post_without_preload_content(
531
+ self,
532
+ generate_certificate_request: GenerateCertificateRequest,
533
+ _request_timeout: Union[
534
+ None,
535
+ Annotated[StrictFloat, Field(gt=0)],
536
+ Tuple[
537
+ Annotated[StrictFloat, Field(gt=0)],
538
+ Annotated[StrictFloat, Field(gt=0)]
539
+ ]
540
+ ] = None,
541
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
542
+ _content_type: Optional[StrictStr] = None,
543
+ _headers: Optional[Dict[StrictStr, Any]] = None,
544
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
545
+ ) -> RESTResponseType:
546
+ """Generate a self-signed X.509 test certificate
547
+
548
+ Generates a self-signed X.509 certificate for PDF electronic signature testing. **⚠️ WARNING: TEST certificate only!** This certificate is: - ✅ Suitable for testing and development - ✅ Compatible with PDF signing (PAdES) - ✅ Compliant with eIDAS **SES** level (Simple Electronic Signature) - ❌ **NEVER usable in production** - ❌ **Not recognized** by browsers and PDF readers - ❌ **No legal value** ## eIDAS levels - **SES** (Simple): Self-signed certificate ← Generated by this endpoint - **AdES** (Advanced): Commercial CA certificate (Let's Encrypt, etc.) - **QES** (Qualified): Qualified certificate from QTSP (CertEurope, Universign, etc.) ## Usage Once generated, the certificate can be: 1. **Saved in Django** (recommended): - Django Admin > Signing Certificates - Upload `certificate_pem` and `private_key_pem` 2. **Used directly**: - Sign a PDF with `/sign-pdf` - The certificate will be automatically used ## Example call ```bash curl -X POST \"https://www.factpulse.fr/api/v1/processing/generate-test-certificate\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organization\": \"Client XYZ Ltd\", \"email\": \"contact@xyz.com\", \"validity_days\": 365 }' ``` ## Use cases - PDF signature testing in development - Electronic signature POC - Training and demos - Automated integration tests ## Technical compliance Certificate generated with: - RSA key 2048 or 4096 bits - SHA-256 algorithm - Key Usage extensions: `digitalSignature`, `contentCommitment` (non-repudiation) - Extended Key Usage extensions: `codeSigning`, `emailProtection` - Validity: 1 day to 10 years (configurable) - Format: PEM (certificate and key) - Optional: PKCS#12 (.p12)
549
+
550
+ :param generate_certificate_request: (required)
551
+ :type generate_certificate_request: GenerateCertificateRequest
552
+ :param _request_timeout: timeout setting for this request. If one
553
+ number provided, it will be total request
554
+ timeout. It can also be a pair (tuple) of
555
+ (connection, read) timeouts.
556
+ :type _request_timeout: int, tuple(int, int), optional
557
+ :param _request_auth: set to override the auth_settings for an a single
558
+ request; this effectively ignores the
559
+ authentication in the spec for a single request.
560
+ :type _request_auth: dict, optional
561
+ :param _content_type: force content-type for the request.
562
+ :type _content_type: str, Optional
563
+ :param _headers: set to override the headers for a single
564
+ request; this effectively ignores the headers
565
+ in the spec for a single request.
566
+ :type _headers: dict, optional
567
+ :param _host_index: set to override the host_index for a single
568
+ request; this effectively ignores the host_index
569
+ in the spec for a single request.
570
+ :type _host_index: int, optional
571
+ :return: Returns the result object.
572
+ """ # noqa: E501
573
+
574
+ _param = self._generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
575
+ generate_certificate_request=generate_certificate_request,
576
+ _request_auth=_request_auth,
577
+ _content_type=_content_type,
578
+ _headers=_headers,
579
+ _host_index=_host_index
580
+ )
581
+
582
+ _response_types_map: Dict[str, Optional[str]] = {
583
+ '200': "GenerateCertificateResponse",
584
+ '400': None,
585
+ '500': None,
586
+ '422': "HTTPValidationError",
587
+ }
588
+ response_data = self.api_client.call_api(
589
+ *_param,
590
+ _request_timeout=_request_timeout
591
+ )
592
+ return response_data.response
593
+
594
+
595
+ def _generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
596
+ self,
597
+ generate_certificate_request,
598
+ _request_auth,
599
+ _content_type,
600
+ _headers,
601
+ _host_index,
602
+ ) -> RequestSerialized:
603
+
604
+ _host = None
605
+
606
+ _collection_formats: Dict[str, str] = {
607
+ }
608
+
609
+ _path_params: Dict[str, str] = {}
610
+ _query_params: List[Tuple[str, str]] = []
611
+ _header_params: Dict[str, Optional[str]] = _headers or {}
612
+ _form_params: List[Tuple[str, str]] = []
613
+ _files: Dict[
614
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
615
+ ] = {}
616
+ _body_params: Optional[bytes] = None
617
+
618
+ # process the path parameters
619
+ # process the query parameters
620
+ # process the header parameters
621
+ # process the form parameters
622
+ # process the body parameter
623
+ if generate_certificate_request is not None:
624
+ _body_params = generate_certificate_request
625
+
626
+
627
+ # set the HTTP header `Accept`
628
+ if 'Accept' not in _header_params:
629
+ _header_params['Accept'] = self.api_client.select_header_accept(
630
+ [
631
+ 'application/json'
632
+ ]
633
+ )
634
+
635
+ # set the HTTP header `Content-Type`
636
+ if _content_type:
637
+ _header_params['Content-Type'] = _content_type
638
+ else:
639
+ _default_content_type = (
640
+ self.api_client.select_header_content_type(
641
+ [
642
+ 'application/json'
643
+ ]
644
+ )
645
+ )
646
+ if _default_content_type is not None:
647
+ _header_params['Content-Type'] = _default_content_type
648
+
649
+ # authentication setting
650
+ _auth_settings: List[str] = [
651
+ 'HTTPBearer'
652
+ ]
653
+
654
+ return self.api_client.param_serialize(
655
+ method='POST',
656
+ resource_path='/api/v1/processing/generate-test-certificate',
657
+ path_params=_path_params,
658
+ query_params=_query_params,
659
+ header_params=_header_params,
660
+ body=_body_params,
661
+ post_params=_form_params,
662
+ files=_files,
663
+ auth_settings=_auth_settings,
664
+ collection_formats=_collection_formats,
665
+ _host=_host,
666
+ _request_auth=_request_auth
667
+ )
668
+
669
+
670
+
671
+
672
+ @validate_call
673
+ def get_task_status_api_v1_processing_tasks_task_id_status_get(
674
+ self,
675
+ task_id: StrictStr,
676
+ _request_timeout: Union[
677
+ None,
678
+ Annotated[StrictFloat, Field(gt=0)],
679
+ Tuple[
680
+ Annotated[StrictFloat, Field(gt=0)],
681
+ Annotated[StrictFloat, Field(gt=0)]
682
+ ]
683
+ ] = None,
684
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
685
+ _content_type: Optional[StrictStr] = None,
686
+ _headers: Optional[Dict[StrictStr, Any]] = None,
687
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
688
+ ) -> AsyncTaskStatus:
689
+ """Get task generation status
690
+
691
+ Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status=\"SUCCESS\"`, the `result` field contains: - `status`: \"SUCCESS\" or \"ERROR\" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
692
+
693
+ :param task_id: (required)
694
+ :type task_id: str
695
+ :param _request_timeout: timeout setting for this request. If one
696
+ number provided, it will be total request
697
+ timeout. It can also be a pair (tuple) of
698
+ (connection, read) timeouts.
699
+ :type _request_timeout: int, tuple(int, int), optional
700
+ :param _request_auth: set to override the auth_settings for an a single
701
+ request; this effectively ignores the
702
+ authentication in the spec for a single request.
703
+ :type _request_auth: dict, optional
704
+ :param _content_type: force content-type for the request.
705
+ :type _content_type: str, Optional
706
+ :param _headers: set to override the headers for a single
707
+ request; this effectively ignores the headers
708
+ in the spec for a single request.
709
+ :type _headers: dict, optional
710
+ :param _host_index: set to override the host_index for a single
711
+ request; this effectively ignores the host_index
712
+ in the spec for a single request.
713
+ :type _host_index: int, optional
714
+ :return: Returns the result object.
715
+ """ # noqa: E501
716
+
717
+ _param = self._get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
718
+ task_id=task_id,
719
+ _request_auth=_request_auth,
720
+ _content_type=_content_type,
721
+ _headers=_headers,
722
+ _host_index=_host_index
723
+ )
724
+
725
+ _response_types_map: Dict[str, Optional[str]] = {
726
+ '200': "AsyncTaskStatus",
727
+ '422': "HTTPValidationError",
728
+ }
729
+ response_data = self.api_client.call_api(
730
+ *_param,
731
+ _request_timeout=_request_timeout
732
+ )
733
+ response_data.read()
734
+ return self.api_client.response_deserialize(
735
+ response_data=response_data,
736
+ response_types_map=_response_types_map,
737
+ ).data
738
+
739
+
740
+ @validate_call
741
+ def get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(
742
+ self,
743
+ task_id: StrictStr,
744
+ _request_timeout: Union[
745
+ None,
746
+ Annotated[StrictFloat, Field(gt=0)],
747
+ Tuple[
748
+ Annotated[StrictFloat, Field(gt=0)],
749
+ Annotated[StrictFloat, Field(gt=0)]
750
+ ]
751
+ ] = None,
752
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
753
+ _content_type: Optional[StrictStr] = None,
754
+ _headers: Optional[Dict[StrictStr, Any]] = None,
755
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
756
+ ) -> ApiResponse[AsyncTaskStatus]:
757
+ """Get task generation status
758
+
759
+ Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status=\"SUCCESS\"`, the `result` field contains: - `status`: \"SUCCESS\" or \"ERROR\" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
760
+
761
+ :param task_id: (required)
762
+ :type task_id: str
763
+ :param _request_timeout: timeout setting for this request. If one
764
+ number provided, it will be total request
765
+ timeout. It can also be a pair (tuple) of
766
+ (connection, read) timeouts.
767
+ :type _request_timeout: int, tuple(int, int), optional
768
+ :param _request_auth: set to override the auth_settings for an a single
769
+ request; this effectively ignores the
770
+ authentication in the spec for a single request.
771
+ :type _request_auth: dict, optional
772
+ :param _content_type: force content-type for the request.
773
+ :type _content_type: str, Optional
774
+ :param _headers: set to override the headers for a single
775
+ request; this effectively ignores the headers
776
+ in the spec for a single request.
777
+ :type _headers: dict, optional
778
+ :param _host_index: set to override the host_index for a single
779
+ request; this effectively ignores the host_index
780
+ in the spec for a single request.
781
+ :type _host_index: int, optional
782
+ :return: Returns the result object.
783
+ """ # noqa: E501
784
+
785
+ _param = self._get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
786
+ task_id=task_id,
787
+ _request_auth=_request_auth,
788
+ _content_type=_content_type,
789
+ _headers=_headers,
790
+ _host_index=_host_index
791
+ )
792
+
793
+ _response_types_map: Dict[str, Optional[str]] = {
794
+ '200': "AsyncTaskStatus",
795
+ '422': "HTTPValidationError",
796
+ }
797
+ response_data = self.api_client.call_api(
798
+ *_param,
799
+ _request_timeout=_request_timeout
800
+ )
801
+ response_data.read()
802
+ return self.api_client.response_deserialize(
803
+ response_data=response_data,
804
+ response_types_map=_response_types_map,
805
+ )
806
+
807
+
808
+ @validate_call
809
+ def get_task_status_api_v1_processing_tasks_task_id_status_get_without_preload_content(
810
+ self,
811
+ task_id: StrictStr,
812
+ _request_timeout: Union[
813
+ None,
814
+ Annotated[StrictFloat, Field(gt=0)],
815
+ Tuple[
816
+ Annotated[StrictFloat, Field(gt=0)],
817
+ Annotated[StrictFloat, Field(gt=0)]
818
+ ]
819
+ ] = None,
820
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
821
+ _content_type: Optional[StrictStr] = None,
822
+ _headers: Optional[Dict[StrictStr, Any]] = None,
823
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
824
+ ) -> RESTResponseType:
825
+ """Get task generation status
826
+
827
+ Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status=\"SUCCESS\"`, the `result` field contains: - `status`: \"SUCCESS\" or \"ERROR\" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
828
+
829
+ :param task_id: (required)
830
+ :type task_id: str
831
+ :param _request_timeout: timeout setting for this request. If one
832
+ number provided, it will be total request
833
+ timeout. It can also be a pair (tuple) of
834
+ (connection, read) timeouts.
835
+ :type _request_timeout: int, tuple(int, int), optional
836
+ :param _request_auth: set to override the auth_settings for an a single
837
+ request; this effectively ignores the
838
+ authentication in the spec for a single request.
839
+ :type _request_auth: dict, optional
840
+ :param _content_type: force content-type for the request.
841
+ :type _content_type: str, Optional
842
+ :param _headers: set to override the headers for a single
843
+ request; this effectively ignores the headers
844
+ in the spec for a single request.
845
+ :type _headers: dict, optional
846
+ :param _host_index: set to override the host_index for a single
847
+ request; this effectively ignores the host_index
848
+ in the spec for a single request.
849
+ :type _host_index: int, optional
850
+ :return: Returns the result object.
851
+ """ # noqa: E501
852
+
853
+ _param = self._get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
854
+ task_id=task_id,
855
+ _request_auth=_request_auth,
856
+ _content_type=_content_type,
857
+ _headers=_headers,
858
+ _host_index=_host_index
859
+ )
860
+
861
+ _response_types_map: Dict[str, Optional[str]] = {
862
+ '200': "AsyncTaskStatus",
863
+ '422': "HTTPValidationError",
864
+ }
865
+ response_data = self.api_client.call_api(
866
+ *_param,
867
+ _request_timeout=_request_timeout
868
+ )
869
+ return response_data.response
870
+
871
+
872
+ def _get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
873
+ self,
874
+ task_id,
875
+ _request_auth,
876
+ _content_type,
877
+ _headers,
878
+ _host_index,
879
+ ) -> RequestSerialized:
880
+
881
+ _host = None
882
+
883
+ _collection_formats: Dict[str, str] = {
884
+ }
885
+
886
+ _path_params: Dict[str, str] = {}
887
+ _query_params: List[Tuple[str, str]] = []
888
+ _header_params: Dict[str, Optional[str]] = _headers or {}
889
+ _form_params: List[Tuple[str, str]] = []
890
+ _files: Dict[
891
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
892
+ ] = {}
893
+ _body_params: Optional[bytes] = None
894
+
895
+ # process the path parameters
896
+ if task_id is not None:
897
+ _path_params['task_id'] = task_id
898
+ # process the query parameters
899
+ # process the header parameters
900
+ # process the form parameters
901
+ # process the body parameter
902
+
903
+
904
+ # set the HTTP header `Accept`
905
+ if 'Accept' not in _header_params:
906
+ _header_params['Accept'] = self.api_client.select_header_accept(
907
+ [
908
+ 'application/json'
909
+ ]
910
+ )
911
+
912
+
913
+ # authentication setting
914
+ _auth_settings: List[str] = [
915
+ 'HTTPBearer'
916
+ ]
917
+
918
+ return self.api_client.param_serialize(
919
+ method='GET',
920
+ resource_path='/api/v1/processing/tasks/{task_id}/status',
921
+ path_params=_path_params,
922
+ query_params=_query_params,
923
+ header_params=_header_params,
924
+ body=_body_params,
925
+ post_params=_form_params,
926
+ files=_files,
927
+ auth_settings=_auth_settings,
928
+ collection_formats=_collection_formats,
929
+ _host=_host,
930
+ _request_auth=_request_auth
931
+ )
932
+
933
+
934
+
935
+
936
+ @validate_call
937
+ def sign_pdf_api_v1_processing_sign_pdf_post(
938
+ self,
939
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (will be processed and returned signed in base64)")],
940
+ reason: Optional[StrictStr] = None,
941
+ location: Optional[StrictStr] = None,
942
+ contact: Optional[StrictStr] = None,
943
+ field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
944
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
945
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
946
+ _request_timeout: Union[
947
+ None,
948
+ Annotated[StrictFloat, Field(gt=0)],
949
+ Tuple[
950
+ Annotated[StrictFloat, Field(gt=0)],
951
+ Annotated[StrictFloat, Field(gt=0)]
952
+ ]
953
+ ] = None,
954
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
955
+ _content_type: Optional[StrictStr] = None,
956
+ _headers: Optional[Dict[StrictStr, Any]] = None,
957
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
958
+ ) -> object:
959
+ """Sign a PDF with client's certificate (PAdES-B-LT)
960
+
961
+ Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT). **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **eIDAS levels**: SES (self-signed), AdES (commercial CA), QES (PSCO - out of scope). **Security**: Double authentication X-Internal-Secret + JWT Bearer to retrieve the certificate. **⚠️ Legal disclaimer**: Generated signatures are electronic seals as defined by the eIDAS regulation. The level of legal validity depends on the certificate used (SES/AdES/QES). FactPulse does not provide QES qualified certificates - you must obtain a certificate from a PSCO (qualified Trust Service Provider) for maximum legal validity.
962
+
963
+ :param pdf_file: PDF file to sign (will be processed and returned signed in base64) (required)
964
+ :type pdf_file: bytearray
965
+ :param reason:
966
+ :type reason: str
967
+ :param location:
968
+ :type location: str
969
+ :param contact:
970
+ :type contact: str
971
+ :param field_name: PDF signature field name
972
+ :type field_name: str
973
+ :param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
974
+ :type use_pades_lt: bool
975
+ :param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
976
+ :type use_timestamp: bool
977
+ :param _request_timeout: timeout setting for this request. If one
978
+ number provided, it will be total request
979
+ timeout. It can also be a pair (tuple) of
980
+ (connection, read) timeouts.
981
+ :type _request_timeout: int, tuple(int, int), optional
982
+ :param _request_auth: set to override the auth_settings for an a single
983
+ request; this effectively ignores the
984
+ authentication in the spec for a single request.
985
+ :type _request_auth: dict, optional
986
+ :param _content_type: force content-type for the request.
987
+ :type _content_type: str, Optional
988
+ :param _headers: set to override the headers for a single
989
+ request; this effectively ignores the headers
990
+ in the spec for a single request.
991
+ :type _headers: dict, optional
992
+ :param _host_index: set to override the host_index for a single
993
+ request; this effectively ignores the host_index
994
+ in the spec for a single request.
995
+ :type _host_index: int, optional
996
+ :return: Returns the result object.
997
+ """ # noqa: E501
998
+
999
+ _param = self._sign_pdf_api_v1_processing_sign_pdf_post_serialize(
1000
+ pdf_file=pdf_file,
1001
+ reason=reason,
1002
+ location=location,
1003
+ contact=contact,
1004
+ field_name=field_name,
1005
+ use_pades_lt=use_pades_lt,
1006
+ use_timestamp=use_timestamp,
1007
+ _request_auth=_request_auth,
1008
+ _content_type=_content_type,
1009
+ _headers=_headers,
1010
+ _host_index=_host_index
1011
+ )
1012
+
1013
+ _response_types_map: Dict[str, Optional[str]] = {
1014
+ '200': "object",
1015
+ '400': None,
1016
+ '404': None,
1017
+ '401': None,
1018
+ '503': None,
1019
+ '422': "HTTPValidationError",
1020
+ }
1021
+ response_data = self.api_client.call_api(
1022
+ *_param,
1023
+ _request_timeout=_request_timeout
1024
+ )
1025
+ response_data.read()
1026
+ return self.api_client.response_deserialize(
1027
+ response_data=response_data,
1028
+ response_types_map=_response_types_map,
1029
+ ).data
1030
+
1031
+
1032
+ @validate_call
1033
+ def sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(
1034
+ self,
1035
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (will be processed and returned signed in base64)")],
1036
+ reason: Optional[StrictStr] = None,
1037
+ location: Optional[StrictStr] = None,
1038
+ contact: Optional[StrictStr] = None,
1039
+ field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
1040
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
1041
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
1042
+ _request_timeout: Union[
1043
+ None,
1044
+ Annotated[StrictFloat, Field(gt=0)],
1045
+ Tuple[
1046
+ Annotated[StrictFloat, Field(gt=0)],
1047
+ Annotated[StrictFloat, Field(gt=0)]
1048
+ ]
1049
+ ] = None,
1050
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1051
+ _content_type: Optional[StrictStr] = None,
1052
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1053
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1054
+ ) -> ApiResponse[object]:
1055
+ """Sign a PDF with client's certificate (PAdES-B-LT)
1056
+
1057
+ Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT). **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **eIDAS levels**: SES (self-signed), AdES (commercial CA), QES (PSCO - out of scope). **Security**: Double authentication X-Internal-Secret + JWT Bearer to retrieve the certificate. **⚠️ Legal disclaimer**: Generated signatures are electronic seals as defined by the eIDAS regulation. The level of legal validity depends on the certificate used (SES/AdES/QES). FactPulse does not provide QES qualified certificates - you must obtain a certificate from a PSCO (qualified Trust Service Provider) for maximum legal validity.
1058
+
1059
+ :param pdf_file: PDF file to sign (will be processed and returned signed in base64) (required)
1060
+ :type pdf_file: bytearray
1061
+ :param reason:
1062
+ :type reason: str
1063
+ :param location:
1064
+ :type location: str
1065
+ :param contact:
1066
+ :type contact: str
1067
+ :param field_name: PDF signature field name
1068
+ :type field_name: str
1069
+ :param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
1070
+ :type use_pades_lt: bool
1071
+ :param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
1072
+ :type use_timestamp: bool
1073
+ :param _request_timeout: timeout setting for this request. If one
1074
+ number provided, it will be total request
1075
+ timeout. It can also be a pair (tuple) of
1076
+ (connection, read) timeouts.
1077
+ :type _request_timeout: int, tuple(int, int), optional
1078
+ :param _request_auth: set to override the auth_settings for an a single
1079
+ request; this effectively ignores the
1080
+ authentication in the spec for a single request.
1081
+ :type _request_auth: dict, optional
1082
+ :param _content_type: force content-type for the request.
1083
+ :type _content_type: str, Optional
1084
+ :param _headers: set to override the headers for a single
1085
+ request; this effectively ignores the headers
1086
+ in the spec for a single request.
1087
+ :type _headers: dict, optional
1088
+ :param _host_index: set to override the host_index for a single
1089
+ request; this effectively ignores the host_index
1090
+ in the spec for a single request.
1091
+ :type _host_index: int, optional
1092
+ :return: Returns the result object.
1093
+ """ # noqa: E501
1094
+
1095
+ _param = self._sign_pdf_api_v1_processing_sign_pdf_post_serialize(
1096
+ pdf_file=pdf_file,
1097
+ reason=reason,
1098
+ location=location,
1099
+ contact=contact,
1100
+ field_name=field_name,
1101
+ use_pades_lt=use_pades_lt,
1102
+ use_timestamp=use_timestamp,
1103
+ _request_auth=_request_auth,
1104
+ _content_type=_content_type,
1105
+ _headers=_headers,
1106
+ _host_index=_host_index
1107
+ )
1108
+
1109
+ _response_types_map: Dict[str, Optional[str]] = {
1110
+ '200': "object",
1111
+ '400': None,
1112
+ '404': None,
1113
+ '401': None,
1114
+ '503': None,
1115
+ '422': "HTTPValidationError",
1116
+ }
1117
+ response_data = self.api_client.call_api(
1118
+ *_param,
1119
+ _request_timeout=_request_timeout
1120
+ )
1121
+ response_data.read()
1122
+ return self.api_client.response_deserialize(
1123
+ response_data=response_data,
1124
+ response_types_map=_response_types_map,
1125
+ )
1126
+
1127
+
1128
+ @validate_call
1129
+ def sign_pdf_api_v1_processing_sign_pdf_post_without_preload_content(
1130
+ self,
1131
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (will be processed and returned signed in base64)")],
1132
+ reason: Optional[StrictStr] = None,
1133
+ location: Optional[StrictStr] = None,
1134
+ contact: Optional[StrictStr] = None,
1135
+ field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
1136
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
1137
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
1138
+ _request_timeout: Union[
1139
+ None,
1140
+ Annotated[StrictFloat, Field(gt=0)],
1141
+ Tuple[
1142
+ Annotated[StrictFloat, Field(gt=0)],
1143
+ Annotated[StrictFloat, Field(gt=0)]
1144
+ ]
1145
+ ] = None,
1146
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1147
+ _content_type: Optional[StrictStr] = None,
1148
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1149
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1150
+ ) -> RESTResponseType:
1151
+ """Sign a PDF with client's certificate (PAdES-B-LT)
1152
+
1153
+ Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT). **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **eIDAS levels**: SES (self-signed), AdES (commercial CA), QES (PSCO - out of scope). **Security**: Double authentication X-Internal-Secret + JWT Bearer to retrieve the certificate. **⚠️ Legal disclaimer**: Generated signatures are electronic seals as defined by the eIDAS regulation. The level of legal validity depends on the certificate used (SES/AdES/QES). FactPulse does not provide QES qualified certificates - you must obtain a certificate from a PSCO (qualified Trust Service Provider) for maximum legal validity.
1154
+
1155
+ :param pdf_file: PDF file to sign (will be processed and returned signed in base64) (required)
1156
+ :type pdf_file: bytearray
1157
+ :param reason:
1158
+ :type reason: str
1159
+ :param location:
1160
+ :type location: str
1161
+ :param contact:
1162
+ :type contact: str
1163
+ :param field_name: PDF signature field name
1164
+ :type field_name: str
1165
+ :param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
1166
+ :type use_pades_lt: bool
1167
+ :param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
1168
+ :type use_timestamp: bool
1169
+ :param _request_timeout: timeout setting for this request. If one
1170
+ number provided, it will be total request
1171
+ timeout. It can also be a pair (tuple) of
1172
+ (connection, read) timeouts.
1173
+ :type _request_timeout: int, tuple(int, int), optional
1174
+ :param _request_auth: set to override the auth_settings for an a single
1175
+ request; this effectively ignores the
1176
+ authentication in the spec for a single request.
1177
+ :type _request_auth: dict, optional
1178
+ :param _content_type: force content-type for the request.
1179
+ :type _content_type: str, Optional
1180
+ :param _headers: set to override the headers for a single
1181
+ request; this effectively ignores the headers
1182
+ in the spec for a single request.
1183
+ :type _headers: dict, optional
1184
+ :param _host_index: set to override the host_index for a single
1185
+ request; this effectively ignores the host_index
1186
+ in the spec for a single request.
1187
+ :type _host_index: int, optional
1188
+ :return: Returns the result object.
1189
+ """ # noqa: E501
1190
+
1191
+ _param = self._sign_pdf_api_v1_processing_sign_pdf_post_serialize(
1192
+ pdf_file=pdf_file,
1193
+ reason=reason,
1194
+ location=location,
1195
+ contact=contact,
1196
+ field_name=field_name,
1197
+ use_pades_lt=use_pades_lt,
1198
+ use_timestamp=use_timestamp,
1199
+ _request_auth=_request_auth,
1200
+ _content_type=_content_type,
1201
+ _headers=_headers,
1202
+ _host_index=_host_index
1203
+ )
1204
+
1205
+ _response_types_map: Dict[str, Optional[str]] = {
1206
+ '200': "object",
1207
+ '400': None,
1208
+ '404': None,
1209
+ '401': None,
1210
+ '503': None,
1211
+ '422': "HTTPValidationError",
1212
+ }
1213
+ response_data = self.api_client.call_api(
1214
+ *_param,
1215
+ _request_timeout=_request_timeout
1216
+ )
1217
+ return response_data.response
1218
+
1219
+
1220
+ def _sign_pdf_api_v1_processing_sign_pdf_post_serialize(
1221
+ self,
1222
+ pdf_file,
1223
+ reason,
1224
+ location,
1225
+ contact,
1226
+ field_name,
1227
+ use_pades_lt,
1228
+ use_timestamp,
1229
+ _request_auth,
1230
+ _content_type,
1231
+ _headers,
1232
+ _host_index,
1233
+ ) -> RequestSerialized:
1234
+
1235
+ _host = None
1236
+
1237
+ _collection_formats: Dict[str, str] = {
1238
+ }
1239
+
1240
+ _path_params: Dict[str, str] = {}
1241
+ _query_params: List[Tuple[str, str]] = []
1242
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1243
+ _form_params: List[Tuple[str, str]] = []
1244
+ _files: Dict[
1245
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1246
+ ] = {}
1247
+ _body_params: Optional[bytes] = None
1248
+
1249
+ # process the path parameters
1250
+ # process the query parameters
1251
+ # process the header parameters
1252
+ # process the form parameters
1253
+ if pdf_file is not None:
1254
+ _files['pdf_file'] = pdf_file
1255
+ if reason is not None:
1256
+ _form_params.append(('reason', reason))
1257
+ if location is not None:
1258
+ _form_params.append(('location', location))
1259
+ if contact is not None:
1260
+ _form_params.append(('contact', contact))
1261
+ if field_name is not None:
1262
+ _form_params.append(('field_name', field_name))
1263
+ if use_pades_lt is not None:
1264
+ _form_params.append(('use_pades_lt', use_pades_lt))
1265
+ if use_timestamp is not None:
1266
+ _form_params.append(('use_timestamp', use_timestamp))
1267
+ # process the body parameter
1268
+
1269
+
1270
+ # set the HTTP header `Accept`
1271
+ if 'Accept' not in _header_params:
1272
+ _header_params['Accept'] = self.api_client.select_header_accept(
1273
+ [
1274
+ 'application/json'
1275
+ ]
1276
+ )
1277
+
1278
+ # set the HTTP header `Content-Type`
1279
+ if _content_type:
1280
+ _header_params['Content-Type'] = _content_type
1281
+ else:
1282
+ _default_content_type = (
1283
+ self.api_client.select_header_content_type(
1284
+ [
1285
+ 'multipart/form-data'
1286
+ ]
1287
+ )
1288
+ )
1289
+ if _default_content_type is not None:
1290
+ _header_params['Content-Type'] = _default_content_type
1291
+
1292
+ # authentication setting
1293
+ _auth_settings: List[str] = [
1294
+ 'HTTPBearer'
1295
+ ]
1296
+
1297
+ return self.api_client.param_serialize(
1298
+ method='POST',
1299
+ resource_path='/api/v1/processing/sign-pdf',
1300
+ path_params=_path_params,
1301
+ query_params=_query_params,
1302
+ header_params=_header_params,
1303
+ body=_body_params,
1304
+ post_params=_form_params,
1305
+ files=_files,
1306
+ auth_settings=_auth_settings,
1307
+ collection_formats=_collection_formats,
1308
+ _host=_host,
1309
+ _request_auth=_request_auth
1310
+ )
1311
+
1312
+
1313
+
1314
+
1315
+ @validate_call
1316
+ def sign_pdf_async_api_v1_processing_sign_pdf_async_post(
1317
+ self,
1318
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (processed asynchronously)")],
1319
+ reason: Optional[StrictStr] = None,
1320
+ location: Optional[StrictStr] = None,
1321
+ contact: Optional[StrictStr] = None,
1322
+ field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
1323
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
1324
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
1325
+ _request_timeout: Union[
1326
+ None,
1327
+ Annotated[StrictFloat, Field(gt=0)],
1328
+ Tuple[
1329
+ Annotated[StrictFloat, Field(gt=0)],
1330
+ Annotated[StrictFloat, Field(gt=0)]
1331
+ ]
1332
+ ] = None,
1333
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1334
+ _content_type: Optional[StrictStr] = None,
1335
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1336
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1337
+ ) -> object:
1338
+ """Sign a PDF asynchronously (Celery)
1339
+
1340
+ Signs an uploaded PDF asynchronously via a Celery task. **Difference with /sign-pdf**: - `/sign-pdf`: Synchronous signature (blocking until completion) - `/sign-pdf-async`: Asynchronous signature (returns immediately with task_id) **Async advantages**: - No timeout for large files - No blocking of FastAPI worker - Progress tracking via task_id - Ideal for batch processing **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **⚠️ Legal disclaimer**: Same as /sign-pdf (see that endpoint's documentation).
1341
+
1342
+ :param pdf_file: PDF file to sign (processed asynchronously) (required)
1343
+ :type pdf_file: bytearray
1344
+ :param reason:
1345
+ :type reason: str
1346
+ :param location:
1347
+ :type location: str
1348
+ :param contact:
1349
+ :type contact: str
1350
+ :param field_name: PDF signature field name
1351
+ :type field_name: str
1352
+ :param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
1353
+ :type use_pades_lt: bool
1354
+ :param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
1355
+ :type use_timestamp: bool
1356
+ :param _request_timeout: timeout setting for this request. If one
1357
+ number provided, it will be total request
1358
+ timeout. It can also be a pair (tuple) of
1359
+ (connection, read) timeouts.
1360
+ :type _request_timeout: int, tuple(int, int), optional
1361
+ :param _request_auth: set to override the auth_settings for an a single
1362
+ request; this effectively ignores the
1363
+ authentication in the spec for a single request.
1364
+ :type _request_auth: dict, optional
1365
+ :param _content_type: force content-type for the request.
1366
+ :type _content_type: str, Optional
1367
+ :param _headers: set to override the headers for a single
1368
+ request; this effectively ignores the headers
1369
+ in the spec for a single request.
1370
+ :type _headers: dict, optional
1371
+ :param _host_index: set to override the host_index for a single
1372
+ request; this effectively ignores the host_index
1373
+ in the spec for a single request.
1374
+ :type _host_index: int, optional
1375
+ :return: Returns the result object.
1376
+ """ # noqa: E501
1377
+
1378
+ _param = self._sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
1379
+ pdf_file=pdf_file,
1380
+ reason=reason,
1381
+ location=location,
1382
+ contact=contact,
1383
+ field_name=field_name,
1384
+ use_pades_lt=use_pades_lt,
1385
+ use_timestamp=use_timestamp,
1386
+ _request_auth=_request_auth,
1387
+ _content_type=_content_type,
1388
+ _headers=_headers,
1389
+ _host_index=_host_index
1390
+ )
1391
+
1392
+ _response_types_map: Dict[str, Optional[str]] = {
1393
+ '200': "object",
1394
+ '202': None,
1395
+ '400': None,
1396
+ '401': None,
1397
+ '422': "HTTPValidationError",
1398
+ }
1399
+ response_data = self.api_client.call_api(
1400
+ *_param,
1401
+ _request_timeout=_request_timeout
1402
+ )
1403
+ response_data.read()
1404
+ return self.api_client.response_deserialize(
1405
+ response_data=response_data,
1406
+ response_types_map=_response_types_map,
1407
+ ).data
1408
+
1409
+
1410
+ @validate_call
1411
+ def sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(
1412
+ self,
1413
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (processed asynchronously)")],
1414
+ reason: Optional[StrictStr] = None,
1415
+ location: Optional[StrictStr] = None,
1416
+ contact: Optional[StrictStr] = None,
1417
+ field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
1418
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
1419
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
1420
+ _request_timeout: Union[
1421
+ None,
1422
+ Annotated[StrictFloat, Field(gt=0)],
1423
+ Tuple[
1424
+ Annotated[StrictFloat, Field(gt=0)],
1425
+ Annotated[StrictFloat, Field(gt=0)]
1426
+ ]
1427
+ ] = None,
1428
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1429
+ _content_type: Optional[StrictStr] = None,
1430
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1431
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1432
+ ) -> ApiResponse[object]:
1433
+ """Sign a PDF asynchronously (Celery)
1434
+
1435
+ Signs an uploaded PDF asynchronously via a Celery task. **Difference with /sign-pdf**: - `/sign-pdf`: Synchronous signature (blocking until completion) - `/sign-pdf-async`: Asynchronous signature (returns immediately with task_id) **Async advantages**: - No timeout for large files - No blocking of FastAPI worker - Progress tracking via task_id - Ideal for batch processing **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **⚠️ Legal disclaimer**: Same as /sign-pdf (see that endpoint's documentation).
1436
+
1437
+ :param pdf_file: PDF file to sign (processed asynchronously) (required)
1438
+ :type pdf_file: bytearray
1439
+ :param reason:
1440
+ :type reason: str
1441
+ :param location:
1442
+ :type location: str
1443
+ :param contact:
1444
+ :type contact: str
1445
+ :param field_name: PDF signature field name
1446
+ :type field_name: str
1447
+ :param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
1448
+ :type use_pades_lt: bool
1449
+ :param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
1450
+ :type use_timestamp: bool
1451
+ :param _request_timeout: timeout setting for this request. If one
1452
+ number provided, it will be total request
1453
+ timeout. It can also be a pair (tuple) of
1454
+ (connection, read) timeouts.
1455
+ :type _request_timeout: int, tuple(int, int), optional
1456
+ :param _request_auth: set to override the auth_settings for an a single
1457
+ request; this effectively ignores the
1458
+ authentication in the spec for a single request.
1459
+ :type _request_auth: dict, optional
1460
+ :param _content_type: force content-type for the request.
1461
+ :type _content_type: str, Optional
1462
+ :param _headers: set to override the headers for a single
1463
+ request; this effectively ignores the headers
1464
+ in the spec for a single request.
1465
+ :type _headers: dict, optional
1466
+ :param _host_index: set to override the host_index for a single
1467
+ request; this effectively ignores the host_index
1468
+ in the spec for a single request.
1469
+ :type _host_index: int, optional
1470
+ :return: Returns the result object.
1471
+ """ # noqa: E501
1472
+
1473
+ _param = self._sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
1474
+ pdf_file=pdf_file,
1475
+ reason=reason,
1476
+ location=location,
1477
+ contact=contact,
1478
+ field_name=field_name,
1479
+ use_pades_lt=use_pades_lt,
1480
+ use_timestamp=use_timestamp,
1481
+ _request_auth=_request_auth,
1482
+ _content_type=_content_type,
1483
+ _headers=_headers,
1484
+ _host_index=_host_index
1485
+ )
1486
+
1487
+ _response_types_map: Dict[str, Optional[str]] = {
1488
+ '200': "object",
1489
+ '202': None,
1490
+ '400': None,
1491
+ '401': None,
1492
+ '422': "HTTPValidationError",
1493
+ }
1494
+ response_data = self.api_client.call_api(
1495
+ *_param,
1496
+ _request_timeout=_request_timeout
1497
+ )
1498
+ response_data.read()
1499
+ return self.api_client.response_deserialize(
1500
+ response_data=response_data,
1501
+ response_types_map=_response_types_map,
1502
+ )
1503
+
1504
+
1505
+ @validate_call
1506
+ def sign_pdf_async_api_v1_processing_sign_pdf_async_post_without_preload_content(
1507
+ self,
1508
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (processed asynchronously)")],
1509
+ reason: Optional[StrictStr] = None,
1510
+ location: Optional[StrictStr] = None,
1511
+ contact: Optional[StrictStr] = None,
1512
+ field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
1513
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
1514
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
1515
+ _request_timeout: Union[
1516
+ None,
1517
+ Annotated[StrictFloat, Field(gt=0)],
1518
+ Tuple[
1519
+ Annotated[StrictFloat, Field(gt=0)],
1520
+ Annotated[StrictFloat, Field(gt=0)]
1521
+ ]
1522
+ ] = None,
1523
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1524
+ _content_type: Optional[StrictStr] = None,
1525
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1526
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1527
+ ) -> RESTResponseType:
1528
+ """Sign a PDF asynchronously (Celery)
1529
+
1530
+ Signs an uploaded PDF asynchronously via a Celery task. **Difference with /sign-pdf**: - `/sign-pdf`: Synchronous signature (blocking until completion) - `/sign-pdf-async`: Asynchronous signature (returns immediately with task_id) **Async advantages**: - No timeout for large files - No blocking of FastAPI worker - Progress tracking via task_id - Ideal for batch processing **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **⚠️ Legal disclaimer**: Same as /sign-pdf (see that endpoint's documentation).
1531
+
1532
+ :param pdf_file: PDF file to sign (processed asynchronously) (required)
1533
+ :type pdf_file: bytearray
1534
+ :param reason:
1535
+ :type reason: str
1536
+ :param location:
1537
+ :type location: str
1538
+ :param contact:
1539
+ :type contact: str
1540
+ :param field_name: PDF signature field name
1541
+ :type field_name: str
1542
+ :param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
1543
+ :type use_pades_lt: bool
1544
+ :param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
1545
+ :type use_timestamp: bool
1546
+ :param _request_timeout: timeout setting for this request. If one
1547
+ number provided, it will be total request
1548
+ timeout. It can also be a pair (tuple) of
1549
+ (connection, read) timeouts.
1550
+ :type _request_timeout: int, tuple(int, int), optional
1551
+ :param _request_auth: set to override the auth_settings for an a single
1552
+ request; this effectively ignores the
1553
+ authentication in the spec for a single request.
1554
+ :type _request_auth: dict, optional
1555
+ :param _content_type: force content-type for the request.
1556
+ :type _content_type: str, Optional
1557
+ :param _headers: set to override the headers for a single
1558
+ request; this effectively ignores the headers
1559
+ in the spec for a single request.
1560
+ :type _headers: dict, optional
1561
+ :param _host_index: set to override the host_index for a single
1562
+ request; this effectively ignores the host_index
1563
+ in the spec for a single request.
1564
+ :type _host_index: int, optional
1565
+ :return: Returns the result object.
1566
+ """ # noqa: E501
1567
+
1568
+ _param = self._sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
1569
+ pdf_file=pdf_file,
1570
+ reason=reason,
1571
+ location=location,
1572
+ contact=contact,
1573
+ field_name=field_name,
1574
+ use_pades_lt=use_pades_lt,
1575
+ use_timestamp=use_timestamp,
1576
+ _request_auth=_request_auth,
1577
+ _content_type=_content_type,
1578
+ _headers=_headers,
1579
+ _host_index=_host_index
1580
+ )
1581
+
1582
+ _response_types_map: Dict[str, Optional[str]] = {
1583
+ '200': "object",
1584
+ '202': None,
1585
+ '400': None,
1586
+ '401': None,
1587
+ '422': "HTTPValidationError",
1588
+ }
1589
+ response_data = self.api_client.call_api(
1590
+ *_param,
1591
+ _request_timeout=_request_timeout
1592
+ )
1593
+ return response_data.response
1594
+
1595
+
1596
+ def _sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
1597
+ self,
1598
+ pdf_file,
1599
+ reason,
1600
+ location,
1601
+ contact,
1602
+ field_name,
1603
+ use_pades_lt,
1604
+ use_timestamp,
1605
+ _request_auth,
1606
+ _content_type,
1607
+ _headers,
1608
+ _host_index,
1609
+ ) -> RequestSerialized:
1610
+
1611
+ _host = None
1612
+
1613
+ _collection_formats: Dict[str, str] = {
1614
+ }
1615
+
1616
+ _path_params: Dict[str, str] = {}
1617
+ _query_params: List[Tuple[str, str]] = []
1618
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1619
+ _form_params: List[Tuple[str, str]] = []
1620
+ _files: Dict[
1621
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1622
+ ] = {}
1623
+ _body_params: Optional[bytes] = None
1624
+
1625
+ # process the path parameters
1626
+ # process the query parameters
1627
+ # process the header parameters
1628
+ # process the form parameters
1629
+ if pdf_file is not None:
1630
+ _files['pdf_file'] = pdf_file
1631
+ if reason is not None:
1632
+ _form_params.append(('reason', reason))
1633
+ if location is not None:
1634
+ _form_params.append(('location', location))
1635
+ if contact is not None:
1636
+ _form_params.append(('contact', contact))
1637
+ if field_name is not None:
1638
+ _form_params.append(('field_name', field_name))
1639
+ if use_pades_lt is not None:
1640
+ _form_params.append(('use_pades_lt', use_pades_lt))
1641
+ if use_timestamp is not None:
1642
+ _form_params.append(('use_timestamp', use_timestamp))
1643
+ # process the body parameter
1644
+
1645
+
1646
+ # set the HTTP header `Accept`
1647
+ if 'Accept' not in _header_params:
1648
+ _header_params['Accept'] = self.api_client.select_header_accept(
1649
+ [
1650
+ 'application/json'
1651
+ ]
1652
+ )
1653
+
1654
+ # set the HTTP header `Content-Type`
1655
+ if _content_type:
1656
+ _header_params['Content-Type'] = _content_type
1657
+ else:
1658
+ _default_content_type = (
1659
+ self.api_client.select_header_content_type(
1660
+ [
1661
+ 'multipart/form-data'
1662
+ ]
1663
+ )
1664
+ )
1665
+ if _default_content_type is not None:
1666
+ _header_params['Content-Type'] = _default_content_type
1667
+
1668
+ # authentication setting
1669
+ _auth_settings: List[str] = [
1670
+ 'HTTPBearer'
1671
+ ]
1672
+
1673
+ return self.api_client.param_serialize(
1674
+ method='POST',
1675
+ resource_path='/api/v1/processing/sign-pdf-async',
1676
+ path_params=_path_params,
1677
+ query_params=_query_params,
1678
+ header_params=_header_params,
1679
+ body=_body_params,
1680
+ post_params=_form_params,
1681
+ files=_files,
1682
+ auth_settings=_auth_settings,
1683
+ collection_formats=_collection_formats,
1684
+ _host=_host,
1685
+ _request_auth=_request_auth
1686
+ )
1687
+
1688
+
1689
+
1690
+
1691
+ @validate_call
1692
+ def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post(
1693
+ self,
1694
+ submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
1695
+ _request_timeout: Union[
1696
+ None,
1697
+ Annotated[StrictFloat, Field(gt=0)],
1698
+ Tuple[
1699
+ Annotated[StrictFloat, Field(gt=0)],
1700
+ Annotated[StrictFloat, Field(gt=0)]
1701
+ ]
1702
+ ] = None,
1703
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1704
+ _content_type: Optional[StrictStr] = None,
1705
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1706
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1707
+ ) -> SubmitCompleteInvoiceResponse:
1708
+ """Submit a complete invoice (generation + signature + submission)
1709
+
1710
+ Unified endpoint to submit a complete invoice to different destinations. **Automated workflow:** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Destination credentials - 2 modes available:** **Mode 1 - Retrieval via JWT (recommended):** - Credentials are retrieved automatically via the JWT `client_uid` - Do not provide the `credentials` field in `destination` - Zero-trust architecture: no secrets in the payload - Example: `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials in the payload:** - Provide credentials directly in the payload - Useful for tests or third-party integrations - Example: `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Electronic signature (optional) - 2 modes available:** **Mode 1 - Stored certificate (recommended):** - Certificate is retrieved automatically via the JWT `client_uid` - No key to provide in the payload - PAdES-B-LT signature with timestamp (eIDAS compliant) - Example: `\"signature\": {\"reason\": \"Factur-X compliance\"}` **Mode 2 - Keys in the payload (for tests):** - Provide `key_pem` and `cert_pem` directly - PEM format accepted: raw or base64 - Useful for tests or special cases without stored certificate - Example: `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` If `key_pem` and `cert_pem` are provided → Mode 2 Otherwise → Mode 1 (certificate retrieved via `client_uid`)
1711
+
1712
+ :param submit_complete_invoice_request: (required)
1713
+ :type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
1714
+ :param _request_timeout: timeout setting for this request. If one
1715
+ number provided, it will be total request
1716
+ timeout. It can also be a pair (tuple) of
1717
+ (connection, read) timeouts.
1718
+ :type _request_timeout: int, tuple(int, int), optional
1719
+ :param _request_auth: set to override the auth_settings for an a single
1720
+ request; this effectively ignores the
1721
+ authentication in the spec for a single request.
1722
+ :type _request_auth: dict, optional
1723
+ :param _content_type: force content-type for the request.
1724
+ :type _content_type: str, Optional
1725
+ :param _headers: set to override the headers for a single
1726
+ request; this effectively ignores the headers
1727
+ in the spec for a single request.
1728
+ :type _headers: dict, optional
1729
+ :param _host_index: set to override the host_index for a single
1730
+ request; this effectively ignores the host_index
1731
+ in the spec for a single request.
1732
+ :type _host_index: int, optional
1733
+ :return: Returns the result object.
1734
+ """ # noqa: E501
1735
+
1736
+ _param = self._submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
1737
+ submit_complete_invoice_request=submit_complete_invoice_request,
1738
+ _request_auth=_request_auth,
1739
+ _content_type=_content_type,
1740
+ _headers=_headers,
1741
+ _host_index=_host_index
1742
+ )
1743
+
1744
+ _response_types_map: Dict[str, Optional[str]] = {
1745
+ '200': "SubmitCompleteInvoiceResponse",
1746
+ '422': "HTTPValidationError",
1747
+ }
1748
+ response_data = self.api_client.call_api(
1749
+ *_param,
1750
+ _request_timeout=_request_timeout
1751
+ )
1752
+ response_data.read()
1753
+ return self.api_client.response_deserialize(
1754
+ response_data=response_data,
1755
+ response_types_map=_response_types_map,
1756
+ ).data
1757
+
1758
+
1759
+ @validate_call
1760
+ def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(
1761
+ self,
1762
+ submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
1763
+ _request_timeout: Union[
1764
+ None,
1765
+ Annotated[StrictFloat, Field(gt=0)],
1766
+ Tuple[
1767
+ Annotated[StrictFloat, Field(gt=0)],
1768
+ Annotated[StrictFloat, Field(gt=0)]
1769
+ ]
1770
+ ] = None,
1771
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1772
+ _content_type: Optional[StrictStr] = None,
1773
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1774
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1775
+ ) -> ApiResponse[SubmitCompleteInvoiceResponse]:
1776
+ """Submit a complete invoice (generation + signature + submission)
1777
+
1778
+ Unified endpoint to submit a complete invoice to different destinations. **Automated workflow:** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Destination credentials - 2 modes available:** **Mode 1 - Retrieval via JWT (recommended):** - Credentials are retrieved automatically via the JWT `client_uid` - Do not provide the `credentials` field in `destination` - Zero-trust architecture: no secrets in the payload - Example: `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials in the payload:** - Provide credentials directly in the payload - Useful for tests or third-party integrations - Example: `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Electronic signature (optional) - 2 modes available:** **Mode 1 - Stored certificate (recommended):** - Certificate is retrieved automatically via the JWT `client_uid` - No key to provide in the payload - PAdES-B-LT signature with timestamp (eIDAS compliant) - Example: `\"signature\": {\"reason\": \"Factur-X compliance\"}` **Mode 2 - Keys in the payload (for tests):** - Provide `key_pem` and `cert_pem` directly - PEM format accepted: raw or base64 - Useful for tests or special cases without stored certificate - Example: `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` If `key_pem` and `cert_pem` are provided → Mode 2 Otherwise → Mode 1 (certificate retrieved via `client_uid`)
1779
+
1780
+ :param submit_complete_invoice_request: (required)
1781
+ :type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
1782
+ :param _request_timeout: timeout setting for this request. If one
1783
+ number provided, it will be total request
1784
+ timeout. It can also be a pair (tuple) of
1785
+ (connection, read) timeouts.
1786
+ :type _request_timeout: int, tuple(int, int), optional
1787
+ :param _request_auth: set to override the auth_settings for an a single
1788
+ request; this effectively ignores the
1789
+ authentication in the spec for a single request.
1790
+ :type _request_auth: dict, optional
1791
+ :param _content_type: force content-type for the request.
1792
+ :type _content_type: str, Optional
1793
+ :param _headers: set to override the headers for a single
1794
+ request; this effectively ignores the headers
1795
+ in the spec for a single request.
1796
+ :type _headers: dict, optional
1797
+ :param _host_index: set to override the host_index for a single
1798
+ request; this effectively ignores the host_index
1799
+ in the spec for a single request.
1800
+ :type _host_index: int, optional
1801
+ :return: Returns the result object.
1802
+ """ # noqa: E501
1803
+
1804
+ _param = self._submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
1805
+ submit_complete_invoice_request=submit_complete_invoice_request,
1806
+ _request_auth=_request_auth,
1807
+ _content_type=_content_type,
1808
+ _headers=_headers,
1809
+ _host_index=_host_index
1810
+ )
1811
+
1812
+ _response_types_map: Dict[str, Optional[str]] = {
1813
+ '200': "SubmitCompleteInvoiceResponse",
1814
+ '422': "HTTPValidationError",
1815
+ }
1816
+ response_data = self.api_client.call_api(
1817
+ *_param,
1818
+ _request_timeout=_request_timeout
1819
+ )
1820
+ response_data.read()
1821
+ return self.api_client.response_deserialize(
1822
+ response_data=response_data,
1823
+ response_types_map=_response_types_map,
1824
+ )
1825
+
1826
+
1827
+ @validate_call
1828
+ def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_without_preload_content(
1829
+ self,
1830
+ submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
1831
+ _request_timeout: Union[
1832
+ None,
1833
+ Annotated[StrictFloat, Field(gt=0)],
1834
+ Tuple[
1835
+ Annotated[StrictFloat, Field(gt=0)],
1836
+ Annotated[StrictFloat, Field(gt=0)]
1837
+ ]
1838
+ ] = None,
1839
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1840
+ _content_type: Optional[StrictStr] = None,
1841
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1842
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1843
+ ) -> RESTResponseType:
1844
+ """Submit a complete invoice (generation + signature + submission)
1845
+
1846
+ Unified endpoint to submit a complete invoice to different destinations. **Automated workflow:** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Destination credentials - 2 modes available:** **Mode 1 - Retrieval via JWT (recommended):** - Credentials are retrieved automatically via the JWT `client_uid` - Do not provide the `credentials` field in `destination` - Zero-trust architecture: no secrets in the payload - Example: `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials in the payload:** - Provide credentials directly in the payload - Useful for tests or third-party integrations - Example: `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Electronic signature (optional) - 2 modes available:** **Mode 1 - Stored certificate (recommended):** - Certificate is retrieved automatically via the JWT `client_uid` - No key to provide in the payload - PAdES-B-LT signature with timestamp (eIDAS compliant) - Example: `\"signature\": {\"reason\": \"Factur-X compliance\"}` **Mode 2 - Keys in the payload (for tests):** - Provide `key_pem` and `cert_pem` directly - PEM format accepted: raw or base64 - Useful for tests or special cases without stored certificate - Example: `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` If `key_pem` and `cert_pem` are provided → Mode 2 Otherwise → Mode 1 (certificate retrieved via `client_uid`)
1847
+
1848
+ :param submit_complete_invoice_request: (required)
1849
+ :type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
1850
+ :param _request_timeout: timeout setting for this request. If one
1851
+ number provided, it will be total request
1852
+ timeout. It can also be a pair (tuple) of
1853
+ (connection, read) timeouts.
1854
+ :type _request_timeout: int, tuple(int, int), optional
1855
+ :param _request_auth: set to override the auth_settings for an a single
1856
+ request; this effectively ignores the
1857
+ authentication in the spec for a single request.
1858
+ :type _request_auth: dict, optional
1859
+ :param _content_type: force content-type for the request.
1860
+ :type _content_type: str, Optional
1861
+ :param _headers: set to override the headers for a single
1862
+ request; this effectively ignores the headers
1863
+ in the spec for a single request.
1864
+ :type _headers: dict, optional
1865
+ :param _host_index: set to override the host_index for a single
1866
+ request; this effectively ignores the host_index
1867
+ in the spec for a single request.
1868
+ :type _host_index: int, optional
1869
+ :return: Returns the result object.
1870
+ """ # noqa: E501
1871
+
1872
+ _param = self._submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
1873
+ submit_complete_invoice_request=submit_complete_invoice_request,
1874
+ _request_auth=_request_auth,
1875
+ _content_type=_content_type,
1876
+ _headers=_headers,
1877
+ _host_index=_host_index
1878
+ )
1879
+
1880
+ _response_types_map: Dict[str, Optional[str]] = {
1881
+ '200': "SubmitCompleteInvoiceResponse",
1882
+ '422': "HTTPValidationError",
1883
+ }
1884
+ response_data = self.api_client.call_api(
1885
+ *_param,
1886
+ _request_timeout=_request_timeout
1887
+ )
1888
+ return response_data.response
1889
+
1890
+
1891
+ def _submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
1892
+ self,
1893
+ submit_complete_invoice_request,
1894
+ _request_auth,
1895
+ _content_type,
1896
+ _headers,
1897
+ _host_index,
1898
+ ) -> RequestSerialized:
1899
+
1900
+ _host = None
1901
+
1902
+ _collection_formats: Dict[str, str] = {
1903
+ }
1904
+
1905
+ _path_params: Dict[str, str] = {}
1906
+ _query_params: List[Tuple[str, str]] = []
1907
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1908
+ _form_params: List[Tuple[str, str]] = []
1909
+ _files: Dict[
1910
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1911
+ ] = {}
1912
+ _body_params: Optional[bytes] = None
1913
+
1914
+ # process the path parameters
1915
+ # process the query parameters
1916
+ # process the header parameters
1917
+ # process the form parameters
1918
+ # process the body parameter
1919
+ if submit_complete_invoice_request is not None:
1920
+ _body_params = submit_complete_invoice_request
1921
+
1922
+
1923
+ # set the HTTP header `Accept`
1924
+ if 'Accept' not in _header_params:
1925
+ _header_params['Accept'] = self.api_client.select_header_accept(
1926
+ [
1927
+ 'application/json'
1928
+ ]
1929
+ )
1930
+
1931
+ # set the HTTP header `Content-Type`
1932
+ if _content_type:
1933
+ _header_params['Content-Type'] = _content_type
1934
+ else:
1935
+ _default_content_type = (
1936
+ self.api_client.select_header_content_type(
1937
+ [
1938
+ 'application/json'
1939
+ ]
1940
+ )
1941
+ )
1942
+ if _default_content_type is not None:
1943
+ _header_params['Content-Type'] = _default_content_type
1944
+
1945
+ # authentication setting
1946
+ _auth_settings: List[str] = [
1947
+ 'HTTPBearer'
1948
+ ]
1949
+
1950
+ return self.api_client.param_serialize(
1951
+ method='POST',
1952
+ resource_path='/api/v1/processing/invoices/submit-complete',
1953
+ path_params=_path_params,
1954
+ query_params=_query_params,
1955
+ header_params=_header_params,
1956
+ body=_body_params,
1957
+ post_params=_form_params,
1958
+ files=_files,
1959
+ auth_settings=_auth_settings,
1960
+ collection_formats=_collection_formats,
1961
+ _host=_host,
1962
+ _request_auth=_request_auth
1963
+ )
1964
+
1965
+
1966
+
1967
+
1968
+ @validate_call
1969
+ def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post(
1970
+ self,
1971
+ submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
1972
+ _request_timeout: Union[
1973
+ None,
1974
+ Annotated[StrictFloat, Field(gt=0)],
1975
+ Tuple[
1976
+ Annotated[StrictFloat, Field(gt=0)],
1977
+ Annotated[StrictFloat, Field(gt=0)]
1978
+ ]
1979
+ ] = None,
1980
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1981
+ _content_type: Optional[StrictStr] = None,
1982
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1983
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1984
+ ) -> TaskResponse:
1985
+ """Submit a complete invoice (asynchronous with Celery)
1986
+
1987
+ Asynchronous version of the `/invoices/submit-complete` endpoint using Celery for background processing. **Automated workflow (same as synchronous version):** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Differences with synchronous version:** - ✅ **Non-blocking**: Returns immediately with a `task_id` (HTTP 202 Accepted) - ✅ **Background processing**: Invoice is processed by a Celery worker - ✅ **Progress tracking**: Use `/tasks/{task_id}/status` to track status - ✅ **Ideal for high volumes**: Allows processing many invoices in parallel **How to use:** 1. **Submission**: Call this endpoint with your invoice data 2. **Immediate return**: You receive a `task_id` (e.g., \"abc123-def456\") 3. **Tracking**: Call `/tasks/{task_id}/status` to check progress 4. **Result**: When `status = \"SUCCESS\"`, the `result` field contains the complete response **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
1988
+
1989
+ :param submit_complete_invoice_request: (required)
1990
+ :type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
1991
+ :param _request_timeout: timeout setting for this request. If one
1992
+ number provided, it will be total request
1993
+ timeout. It can also be a pair (tuple) of
1994
+ (connection, read) timeouts.
1995
+ :type _request_timeout: int, tuple(int, int), optional
1996
+ :param _request_auth: set to override the auth_settings for an a single
1997
+ request; this effectively ignores the
1998
+ authentication in the spec for a single request.
1999
+ :type _request_auth: dict, optional
2000
+ :param _content_type: force content-type for the request.
2001
+ :type _content_type: str, Optional
2002
+ :param _headers: set to override the headers for a single
2003
+ request; this effectively ignores the headers
2004
+ in the spec for a single request.
2005
+ :type _headers: dict, optional
2006
+ :param _host_index: set to override the host_index for a single
2007
+ request; this effectively ignores the host_index
2008
+ in the spec for a single request.
2009
+ :type _host_index: int, optional
2010
+ :return: Returns the result object.
2011
+ """ # noqa: E501
2012
+
2013
+ _param = self._submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
2014
+ submit_complete_invoice_request=submit_complete_invoice_request,
2015
+ _request_auth=_request_auth,
2016
+ _content_type=_content_type,
2017
+ _headers=_headers,
2018
+ _host_index=_host_index
2019
+ )
2020
+
2021
+ _response_types_map: Dict[str, Optional[str]] = {
2022
+ '202': "TaskResponse",
2023
+ '422': "HTTPValidationError",
2024
+ }
2025
+ response_data = self.api_client.call_api(
2026
+ *_param,
2027
+ _request_timeout=_request_timeout
2028
+ )
2029
+ response_data.read()
2030
+ return self.api_client.response_deserialize(
2031
+ response_data=response_data,
2032
+ response_types_map=_response_types_map,
2033
+ ).data
2034
+
2035
+
2036
+ @validate_call
2037
+ def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(
2038
+ self,
2039
+ submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
2040
+ _request_timeout: Union[
2041
+ None,
2042
+ Annotated[StrictFloat, Field(gt=0)],
2043
+ Tuple[
2044
+ Annotated[StrictFloat, Field(gt=0)],
2045
+ Annotated[StrictFloat, Field(gt=0)]
2046
+ ]
2047
+ ] = None,
2048
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2049
+ _content_type: Optional[StrictStr] = None,
2050
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2051
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2052
+ ) -> ApiResponse[TaskResponse]:
2053
+ """Submit a complete invoice (asynchronous with Celery)
2054
+
2055
+ Asynchronous version of the `/invoices/submit-complete` endpoint using Celery for background processing. **Automated workflow (same as synchronous version):** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Differences with synchronous version:** - ✅ **Non-blocking**: Returns immediately with a `task_id` (HTTP 202 Accepted) - ✅ **Background processing**: Invoice is processed by a Celery worker - ✅ **Progress tracking**: Use `/tasks/{task_id}/status` to track status - ✅ **Ideal for high volumes**: Allows processing many invoices in parallel **How to use:** 1. **Submission**: Call this endpoint with your invoice data 2. **Immediate return**: You receive a `task_id` (e.g., \"abc123-def456\") 3. **Tracking**: Call `/tasks/{task_id}/status` to check progress 4. **Result**: When `status = \"SUCCESS\"`, the `result` field contains the complete response **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
2056
+
2057
+ :param submit_complete_invoice_request: (required)
2058
+ :type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
2059
+ :param _request_timeout: timeout setting for this request. If one
2060
+ number provided, it will be total request
2061
+ timeout. It can also be a pair (tuple) of
2062
+ (connection, read) timeouts.
2063
+ :type _request_timeout: int, tuple(int, int), optional
2064
+ :param _request_auth: set to override the auth_settings for an a single
2065
+ request; this effectively ignores the
2066
+ authentication in the spec for a single request.
2067
+ :type _request_auth: dict, optional
2068
+ :param _content_type: force content-type for the request.
2069
+ :type _content_type: str, Optional
2070
+ :param _headers: set to override the headers for a single
2071
+ request; this effectively ignores the headers
2072
+ in the spec for a single request.
2073
+ :type _headers: dict, optional
2074
+ :param _host_index: set to override the host_index for a single
2075
+ request; this effectively ignores the host_index
2076
+ in the spec for a single request.
2077
+ :type _host_index: int, optional
2078
+ :return: Returns the result object.
2079
+ """ # noqa: E501
2080
+
2081
+ _param = self._submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
2082
+ submit_complete_invoice_request=submit_complete_invoice_request,
2083
+ _request_auth=_request_auth,
2084
+ _content_type=_content_type,
2085
+ _headers=_headers,
2086
+ _host_index=_host_index
2087
+ )
2088
+
2089
+ _response_types_map: Dict[str, Optional[str]] = {
2090
+ '202': "TaskResponse",
2091
+ '422': "HTTPValidationError",
2092
+ }
2093
+ response_data = self.api_client.call_api(
2094
+ *_param,
2095
+ _request_timeout=_request_timeout
2096
+ )
2097
+ response_data.read()
2098
+ return self.api_client.response_deserialize(
2099
+ response_data=response_data,
2100
+ response_types_map=_response_types_map,
2101
+ )
2102
+
2103
+
2104
+ @validate_call
2105
+ def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_without_preload_content(
2106
+ self,
2107
+ submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
2108
+ _request_timeout: Union[
2109
+ None,
2110
+ Annotated[StrictFloat, Field(gt=0)],
2111
+ Tuple[
2112
+ Annotated[StrictFloat, Field(gt=0)],
2113
+ Annotated[StrictFloat, Field(gt=0)]
2114
+ ]
2115
+ ] = None,
2116
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2117
+ _content_type: Optional[StrictStr] = None,
2118
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2119
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2120
+ ) -> RESTResponseType:
2121
+ """Submit a complete invoice (asynchronous with Celery)
2122
+
2123
+ Asynchronous version of the `/invoices/submit-complete` endpoint using Celery for background processing. **Automated workflow (same as synchronous version):** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Differences with synchronous version:** - ✅ **Non-blocking**: Returns immediately with a `task_id` (HTTP 202 Accepted) - ✅ **Background processing**: Invoice is processed by a Celery worker - ✅ **Progress tracking**: Use `/tasks/{task_id}/status` to track status - ✅ **Ideal for high volumes**: Allows processing many invoices in parallel **How to use:** 1. **Submission**: Call this endpoint with your invoice data 2. **Immediate return**: You receive a `task_id` (e.g., \"abc123-def456\") 3. **Tracking**: Call `/tasks/{task_id}/status` to check progress 4. **Result**: When `status = \"SUCCESS\"`, the `result` field contains the complete response **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
2124
+
2125
+ :param submit_complete_invoice_request: (required)
2126
+ :type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
2127
+ :param _request_timeout: timeout setting for this request. If one
2128
+ number provided, it will be total request
2129
+ timeout. It can also be a pair (tuple) of
2130
+ (connection, read) timeouts.
2131
+ :type _request_timeout: int, tuple(int, int), optional
2132
+ :param _request_auth: set to override the auth_settings for an a single
2133
+ request; this effectively ignores the
2134
+ authentication in the spec for a single request.
2135
+ :type _request_auth: dict, optional
2136
+ :param _content_type: force content-type for the request.
2137
+ :type _content_type: str, Optional
2138
+ :param _headers: set to override the headers for a single
2139
+ request; this effectively ignores the headers
2140
+ in the spec for a single request.
2141
+ :type _headers: dict, optional
2142
+ :param _host_index: set to override the host_index for a single
2143
+ request; this effectively ignores the host_index
2144
+ in the spec for a single request.
2145
+ :type _host_index: int, optional
2146
+ :return: Returns the result object.
2147
+ """ # noqa: E501
2148
+
2149
+ _param = self._submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
2150
+ submit_complete_invoice_request=submit_complete_invoice_request,
2151
+ _request_auth=_request_auth,
2152
+ _content_type=_content_type,
2153
+ _headers=_headers,
2154
+ _host_index=_host_index
2155
+ )
2156
+
2157
+ _response_types_map: Dict[str, Optional[str]] = {
2158
+ '202': "TaskResponse",
2159
+ '422': "HTTPValidationError",
2160
+ }
2161
+ response_data = self.api_client.call_api(
2162
+ *_param,
2163
+ _request_timeout=_request_timeout
2164
+ )
2165
+ return response_data.response
2166
+
2167
+
2168
+ def _submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
2169
+ self,
2170
+ submit_complete_invoice_request,
2171
+ _request_auth,
2172
+ _content_type,
2173
+ _headers,
2174
+ _host_index,
2175
+ ) -> RequestSerialized:
2176
+
2177
+ _host = None
2178
+
2179
+ _collection_formats: Dict[str, str] = {
2180
+ }
2181
+
2182
+ _path_params: Dict[str, str] = {}
2183
+ _query_params: List[Tuple[str, str]] = []
2184
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2185
+ _form_params: List[Tuple[str, str]] = []
2186
+ _files: Dict[
2187
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2188
+ ] = {}
2189
+ _body_params: Optional[bytes] = None
2190
+
2191
+ # process the path parameters
2192
+ # process the query parameters
2193
+ # process the header parameters
2194
+ # process the form parameters
2195
+ # process the body parameter
2196
+ if submit_complete_invoice_request is not None:
2197
+ _body_params = submit_complete_invoice_request
2198
+
2199
+
2200
+ # set the HTTP header `Accept`
2201
+ if 'Accept' not in _header_params:
2202
+ _header_params['Accept'] = self.api_client.select_header_accept(
2203
+ [
2204
+ 'application/json'
2205
+ ]
2206
+ )
2207
+
2208
+ # set the HTTP header `Content-Type`
2209
+ if _content_type:
2210
+ _header_params['Content-Type'] = _content_type
2211
+ else:
2212
+ _default_content_type = (
2213
+ self.api_client.select_header_content_type(
2214
+ [
2215
+ 'application/json'
2216
+ ]
2217
+ )
2218
+ )
2219
+ if _default_content_type is not None:
2220
+ _header_params['Content-Type'] = _default_content_type
2221
+
2222
+ # authentication setting
2223
+ _auth_settings: List[str] = [
2224
+ 'HTTPBearer'
2225
+ ]
2226
+
2227
+ return self.api_client.param_serialize(
2228
+ method='POST',
2229
+ resource_path='/api/v1/processing/invoices/submit-complete-async',
2230
+ path_params=_path_params,
2231
+ query_params=_query_params,
2232
+ header_params=_header_params,
2233
+ body=_body_params,
2234
+ post_params=_form_params,
2235
+ files=_files,
2236
+ auth_settings=_auth_settings,
2237
+ collection_formats=_collection_formats,
2238
+ _host=_host,
2239
+ _request_auth=_request_auth
2240
+ )
2241
+
2242
+
2243
+
2244
+
2245
+ @validate_call
2246
+ def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post(
2247
+ self,
2248
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
2249
+ profile: Optional[Any] = None,
2250
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.")] = None,
2251
+ _request_timeout: Union[
2252
+ None,
2253
+ Annotated[StrictFloat, Field(gt=0)],
2254
+ Tuple[
2255
+ Annotated[StrictFloat, Field(gt=0)],
2256
+ Annotated[StrictFloat, Field(gt=0)]
2257
+ ]
2258
+ ] = None,
2259
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2260
+ _content_type: Optional[StrictStr] = None,
2261
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2262
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2263
+ ) -> PDFValidationResultAPI:
2264
+ """Validate a complete Factur-X PDF
2265
+
2266
+ 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)
2267
+
2268
+ :param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
2269
+ :type pdf_file: bytearray
2270
+ :param profile:
2271
+ :type profile: FacturXProfile
2272
+ :param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
2273
+ :type use_verapdf: bool
2274
+ :param _request_timeout: timeout setting for this request. If one
2275
+ number provided, it will be total request
2276
+ timeout. It can also be a pair (tuple) of
2277
+ (connection, read) timeouts.
2278
+ :type _request_timeout: int, tuple(int, int), optional
2279
+ :param _request_auth: set to override the auth_settings for an a single
2280
+ request; this effectively ignores the
2281
+ authentication in the spec for a single request.
2282
+ :type _request_auth: dict, optional
2283
+ :param _content_type: force content-type for the request.
2284
+ :type _content_type: str, Optional
2285
+ :param _headers: set to override the headers for a single
2286
+ request; this effectively ignores the headers
2287
+ in the spec for a single request.
2288
+ :type _headers: dict, optional
2289
+ :param _host_index: set to override the host_index for a single
2290
+ request; this effectively ignores the host_index
2291
+ in the spec for a single request.
2292
+ :type _host_index: int, optional
2293
+ :return: Returns the result object.
2294
+ """ # noqa: E501
2295
+
2296
+ _param = self._validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
2297
+ pdf_file=pdf_file,
2298
+ profile=profile,
2299
+ use_verapdf=use_verapdf,
2300
+ _request_auth=_request_auth,
2301
+ _content_type=_content_type,
2302
+ _headers=_headers,
2303
+ _host_index=_host_index
2304
+ )
2305
+
2306
+ _response_types_map: Dict[str, Optional[str]] = {
2307
+ '200': "PDFValidationResultAPI",
2308
+ '400': None,
2309
+ '422': "HTTPValidationError",
2310
+ }
2311
+ response_data = self.api_client.call_api(
2312
+ *_param,
2313
+ _request_timeout=_request_timeout
2314
+ )
2315
+ response_data.read()
2316
+ return self.api_client.response_deserialize(
2317
+ response_data=response_data,
2318
+ response_types_map=_response_types_map,
2319
+ ).data
2320
+
2321
+
2322
+ @validate_call
2323
+ def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(
2324
+ self,
2325
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
2326
+ profile: Optional[Any] = None,
2327
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.")] = None,
2328
+ _request_timeout: Union[
2329
+ None,
2330
+ Annotated[StrictFloat, Field(gt=0)],
2331
+ Tuple[
2332
+ Annotated[StrictFloat, Field(gt=0)],
2333
+ Annotated[StrictFloat, Field(gt=0)]
2334
+ ]
2335
+ ] = None,
2336
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2337
+ _content_type: Optional[StrictStr] = None,
2338
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2339
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2340
+ ) -> ApiResponse[PDFValidationResultAPI]:
2341
+ """Validate a complete Factur-X PDF
2342
+
2343
+ 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)
2344
+
2345
+ :param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
2346
+ :type pdf_file: bytearray
2347
+ :param profile:
2348
+ :type profile: FacturXProfile
2349
+ :param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
2350
+ :type use_verapdf: bool
2351
+ :param _request_timeout: timeout setting for this request. If one
2352
+ number provided, it will be total request
2353
+ timeout. It can also be a pair (tuple) of
2354
+ (connection, read) timeouts.
2355
+ :type _request_timeout: int, tuple(int, int), optional
2356
+ :param _request_auth: set to override the auth_settings for an a single
2357
+ request; this effectively ignores the
2358
+ authentication in the spec for a single request.
2359
+ :type _request_auth: dict, optional
2360
+ :param _content_type: force content-type for the request.
2361
+ :type _content_type: str, Optional
2362
+ :param _headers: set to override the headers for a single
2363
+ request; this effectively ignores the headers
2364
+ in the spec for a single request.
2365
+ :type _headers: dict, optional
2366
+ :param _host_index: set to override the host_index for a single
2367
+ request; this effectively ignores the host_index
2368
+ in the spec for a single request.
2369
+ :type _host_index: int, optional
2370
+ :return: Returns the result object.
2371
+ """ # noqa: E501
2372
+
2373
+ _param = self._validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
2374
+ pdf_file=pdf_file,
2375
+ profile=profile,
2376
+ use_verapdf=use_verapdf,
2377
+ _request_auth=_request_auth,
2378
+ _content_type=_content_type,
2379
+ _headers=_headers,
2380
+ _host_index=_host_index
2381
+ )
2382
+
2383
+ _response_types_map: Dict[str, Optional[str]] = {
2384
+ '200': "PDFValidationResultAPI",
2385
+ '400': None,
2386
+ '422': "HTTPValidationError",
2387
+ }
2388
+ response_data = self.api_client.call_api(
2389
+ *_param,
2390
+ _request_timeout=_request_timeout
2391
+ )
2392
+ response_data.read()
2393
+ return self.api_client.response_deserialize(
2394
+ response_data=response_data,
2395
+ response_types_map=_response_types_map,
2396
+ )
2397
+
2398
+
2399
+ @validate_call
2400
+ def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_without_preload_content(
2401
+ self,
2402
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
2403
+ profile: Optional[Any] = None,
2404
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.")] = None,
2405
+ _request_timeout: Union[
2406
+ None,
2407
+ Annotated[StrictFloat, Field(gt=0)],
2408
+ Tuple[
2409
+ Annotated[StrictFloat, Field(gt=0)],
2410
+ Annotated[StrictFloat, Field(gt=0)]
2411
+ ]
2412
+ ] = None,
2413
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2414
+ _content_type: Optional[StrictStr] = None,
2415
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2416
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2417
+ ) -> RESTResponseType:
2418
+ """Validate a complete Factur-X PDF
2419
+
2420
+ 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)
2421
+
2422
+ :param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
2423
+ :type pdf_file: bytearray
2424
+ :param profile:
2425
+ :type profile: FacturXProfile
2426
+ :param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
2427
+ :type use_verapdf: bool
2428
+ :param _request_timeout: timeout setting for this request. If one
2429
+ number provided, it will be total request
2430
+ timeout. It can also be a pair (tuple) of
2431
+ (connection, read) timeouts.
2432
+ :type _request_timeout: int, tuple(int, int), optional
2433
+ :param _request_auth: set to override the auth_settings for an a single
2434
+ request; this effectively ignores the
2435
+ authentication in the spec for a single request.
2436
+ :type _request_auth: dict, optional
2437
+ :param _content_type: force content-type for the request.
2438
+ :type _content_type: str, Optional
2439
+ :param _headers: set to override the headers for a single
2440
+ request; this effectively ignores the headers
2441
+ in the spec for a single request.
2442
+ :type _headers: dict, optional
2443
+ :param _host_index: set to override the host_index for a single
2444
+ request; this effectively ignores the host_index
2445
+ in the spec for a single request.
2446
+ :type _host_index: int, optional
2447
+ :return: Returns the result object.
2448
+ """ # noqa: E501
2449
+
2450
+ _param = self._validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
2451
+ pdf_file=pdf_file,
2452
+ profile=profile,
2453
+ use_verapdf=use_verapdf,
2454
+ _request_auth=_request_auth,
2455
+ _content_type=_content_type,
2456
+ _headers=_headers,
2457
+ _host_index=_host_index
2458
+ )
2459
+
2460
+ _response_types_map: Dict[str, Optional[str]] = {
2461
+ '200': "PDFValidationResultAPI",
2462
+ '400': None,
2463
+ '422': "HTTPValidationError",
2464
+ }
2465
+ response_data = self.api_client.call_api(
2466
+ *_param,
2467
+ _request_timeout=_request_timeout
2468
+ )
2469
+ return response_data.response
2470
+
2471
+
2472
+ def _validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
2473
+ self,
2474
+ pdf_file,
2475
+ profile,
2476
+ use_verapdf,
2477
+ _request_auth,
2478
+ _content_type,
2479
+ _headers,
2480
+ _host_index,
2481
+ ) -> RequestSerialized:
2482
+
2483
+ _host = None
2484
+
2485
+ _collection_formats: Dict[str, str] = {
2486
+ }
2487
+
2488
+ _path_params: Dict[str, str] = {}
2489
+ _query_params: List[Tuple[str, str]] = []
2490
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2491
+ _form_params: List[Tuple[str, str]] = []
2492
+ _files: Dict[
2493
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2494
+ ] = {}
2495
+ _body_params: Optional[bytes] = None
2496
+
2497
+ # process the path parameters
2498
+ # process the query parameters
2499
+ # process the header parameters
2500
+ # process the form parameters
2501
+ if pdf_file is not None:
2502
+ _files['pdf_file'] = pdf_file
2503
+ if profile is not None:
2504
+ _form_params.append(('profile', profile))
2505
+ if use_verapdf is not None:
2506
+ _form_params.append(('use_verapdf', use_verapdf))
2507
+ # process the body parameter
2508
+
2509
+
2510
+ # set the HTTP header `Accept`
2511
+ if 'Accept' not in _header_params:
2512
+ _header_params['Accept'] = self.api_client.select_header_accept(
2513
+ [
2514
+ 'application/json'
2515
+ ]
2516
+ )
2517
+
2518
+ # set the HTTP header `Content-Type`
2519
+ if _content_type:
2520
+ _header_params['Content-Type'] = _content_type
2521
+ else:
2522
+ _default_content_type = (
2523
+ self.api_client.select_header_content_type(
2524
+ [
2525
+ 'multipart/form-data'
2526
+ ]
2527
+ )
2528
+ )
2529
+ if _default_content_type is not None:
2530
+ _header_params['Content-Type'] = _default_content_type
2531
+
2532
+ # authentication setting
2533
+ _auth_settings: List[str] = [
2534
+ 'HTTPBearer'
2535
+ ]
2536
+
2537
+ return self.api_client.param_serialize(
2538
+ method='POST',
2539
+ resource_path='/api/v1/processing/validate-facturx-pdf',
2540
+ path_params=_path_params,
2541
+ query_params=_query_params,
2542
+ header_params=_header_params,
2543
+ body=_body_params,
2544
+ post_params=_form_params,
2545
+ files=_files,
2546
+ auth_settings=_auth_settings,
2547
+ collection_formats=_collection_formats,
2548
+ _host=_host,
2549
+ _request_auth=_request_auth
2550
+ )
2551
+
2552
+
2553
+
2554
+
2555
+ @validate_call
2556
+ def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post(
2557
+ self,
2558
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
2559
+ profile: Optional[Any] = None,
2560
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.")] = None,
2561
+ _request_timeout: Union[
2562
+ None,
2563
+ Annotated[StrictFloat, Field(gt=0)],
2564
+ Tuple[
2565
+ Annotated[StrictFloat, Field(gt=0)],
2566
+ Annotated[StrictFloat, Field(gt=0)]
2567
+ ]
2568
+ ] = None,
2569
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2570
+ _content_type: Optional[StrictStr] = None,
2571
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2572
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2573
+ ) -> TaskResponse:
2574
+ """Validate a Factur-X PDF (asynchronous with polling)
2575
+
2576
+ 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
2577
+
2578
+ :param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
2579
+ :type pdf_file: bytearray
2580
+ :param profile:
2581
+ :type profile: FacturXProfile
2582
+ :param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
2583
+ :type use_verapdf: bool
2584
+ :param _request_timeout: timeout setting for this request. If one
2585
+ number provided, it will be total request
2586
+ timeout. It can also be a pair (tuple) of
2587
+ (connection, read) timeouts.
2588
+ :type _request_timeout: int, tuple(int, int), optional
2589
+ :param _request_auth: set to override the auth_settings for an a single
2590
+ request; this effectively ignores the
2591
+ authentication in the spec for a single request.
2592
+ :type _request_auth: dict, optional
2593
+ :param _content_type: force content-type for the request.
2594
+ :type _content_type: str, Optional
2595
+ :param _headers: set to override the headers for a single
2596
+ request; this effectively ignores the headers
2597
+ in the spec for a single request.
2598
+ :type _headers: dict, optional
2599
+ :param _host_index: set to override the host_index for a single
2600
+ request; this effectively ignores the host_index
2601
+ in the spec for a single request.
2602
+ :type _host_index: int, optional
2603
+ :return: Returns the result object.
2604
+ """ # noqa: E501
2605
+
2606
+ _param = self._validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
2607
+ pdf_file=pdf_file,
2608
+ profile=profile,
2609
+ use_verapdf=use_verapdf,
2610
+ _request_auth=_request_auth,
2611
+ _content_type=_content_type,
2612
+ _headers=_headers,
2613
+ _host_index=_host_index
2614
+ )
2615
+
2616
+ _response_types_map: Dict[str, Optional[str]] = {
2617
+ '202': "TaskResponse",
2618
+ '400': None,
2619
+ '422': "HTTPValidationError",
2620
+ }
2621
+ response_data = self.api_client.call_api(
2622
+ *_param,
2623
+ _request_timeout=_request_timeout
2624
+ )
2625
+ response_data.read()
2626
+ return self.api_client.response_deserialize(
2627
+ response_data=response_data,
2628
+ response_types_map=_response_types_map,
2629
+ ).data
2630
+
2631
+
2632
+ @validate_call
2633
+ def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(
2634
+ self,
2635
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
2636
+ profile: Optional[Any] = None,
2637
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.")] = None,
2638
+ _request_timeout: Union[
2639
+ None,
2640
+ Annotated[StrictFloat, Field(gt=0)],
2641
+ Tuple[
2642
+ Annotated[StrictFloat, Field(gt=0)],
2643
+ Annotated[StrictFloat, Field(gt=0)]
2644
+ ]
2645
+ ] = None,
2646
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2647
+ _content_type: Optional[StrictStr] = None,
2648
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2649
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2650
+ ) -> ApiResponse[TaskResponse]:
2651
+ """Validate a Factur-X PDF (asynchronous with polling)
2652
+
2653
+ 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
2654
+
2655
+ :param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
2656
+ :type pdf_file: bytearray
2657
+ :param profile:
2658
+ :type profile: FacturXProfile
2659
+ :param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
2660
+ :type use_verapdf: bool
2661
+ :param _request_timeout: timeout setting for this request. If one
2662
+ number provided, it will be total request
2663
+ timeout. It can also be a pair (tuple) of
2664
+ (connection, read) timeouts.
2665
+ :type _request_timeout: int, tuple(int, int), optional
2666
+ :param _request_auth: set to override the auth_settings for an a single
2667
+ request; this effectively ignores the
2668
+ authentication in the spec for a single request.
2669
+ :type _request_auth: dict, optional
2670
+ :param _content_type: force content-type for the request.
2671
+ :type _content_type: str, Optional
2672
+ :param _headers: set to override the headers for a single
2673
+ request; this effectively ignores the headers
2674
+ in the spec for a single request.
2675
+ :type _headers: dict, optional
2676
+ :param _host_index: set to override the host_index for a single
2677
+ request; this effectively ignores the host_index
2678
+ in the spec for a single request.
2679
+ :type _host_index: int, optional
2680
+ :return: Returns the result object.
2681
+ """ # noqa: E501
2682
+
2683
+ _param = self._validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
2684
+ pdf_file=pdf_file,
2685
+ profile=profile,
2686
+ use_verapdf=use_verapdf,
2687
+ _request_auth=_request_auth,
2688
+ _content_type=_content_type,
2689
+ _headers=_headers,
2690
+ _host_index=_host_index
2691
+ )
2692
+
2693
+ _response_types_map: Dict[str, Optional[str]] = {
2694
+ '202': "TaskResponse",
2695
+ '400': None,
2696
+ '422': "HTTPValidationError",
2697
+ }
2698
+ response_data = self.api_client.call_api(
2699
+ *_param,
2700
+ _request_timeout=_request_timeout
2701
+ )
2702
+ response_data.read()
2703
+ return self.api_client.response_deserialize(
2704
+ response_data=response_data,
2705
+ response_types_map=_response_types_map,
2706
+ )
2707
+
2708
+
2709
+ @validate_call
2710
+ def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_without_preload_content(
2711
+ self,
2712
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
2713
+ profile: Optional[Any] = None,
2714
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.")] = None,
2715
+ _request_timeout: Union[
2716
+ None,
2717
+ Annotated[StrictFloat, Field(gt=0)],
2718
+ Tuple[
2719
+ Annotated[StrictFloat, Field(gt=0)],
2720
+ Annotated[StrictFloat, Field(gt=0)]
2721
+ ]
2722
+ ] = None,
2723
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2724
+ _content_type: Optional[StrictStr] = None,
2725
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2726
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2727
+ ) -> RESTResponseType:
2728
+ """Validate a Factur-X PDF (asynchronous with polling)
2729
+
2730
+ 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
2731
+
2732
+ :param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
2733
+ :type pdf_file: bytearray
2734
+ :param profile:
2735
+ :type profile: FacturXProfile
2736
+ :param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
2737
+ :type use_verapdf: bool
2738
+ :param _request_timeout: timeout setting for this request. If one
2739
+ number provided, it will be total request
2740
+ timeout. It can also be a pair (tuple) of
2741
+ (connection, read) timeouts.
2742
+ :type _request_timeout: int, tuple(int, int), optional
2743
+ :param _request_auth: set to override the auth_settings for an a single
2744
+ request; this effectively ignores the
2745
+ authentication in the spec for a single request.
2746
+ :type _request_auth: dict, optional
2747
+ :param _content_type: force content-type for the request.
2748
+ :type _content_type: str, Optional
2749
+ :param _headers: set to override the headers for a single
2750
+ request; this effectively ignores the headers
2751
+ in the spec for a single request.
2752
+ :type _headers: dict, optional
2753
+ :param _host_index: set to override the host_index for a single
2754
+ request; this effectively ignores the host_index
2755
+ in the spec for a single request.
2756
+ :type _host_index: int, optional
2757
+ :return: Returns the result object.
2758
+ """ # noqa: E501
2759
+
2760
+ _param = self._validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
2761
+ pdf_file=pdf_file,
2762
+ profile=profile,
2763
+ use_verapdf=use_verapdf,
2764
+ _request_auth=_request_auth,
2765
+ _content_type=_content_type,
2766
+ _headers=_headers,
2767
+ _host_index=_host_index
2768
+ )
2769
+
2770
+ _response_types_map: Dict[str, Optional[str]] = {
2771
+ '202': "TaskResponse",
2772
+ '400': None,
2773
+ '422': "HTTPValidationError",
2774
+ }
2775
+ response_data = self.api_client.call_api(
2776
+ *_param,
2777
+ _request_timeout=_request_timeout
2778
+ )
2779
+ return response_data.response
2780
+
2781
+
2782
+ def _validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
2783
+ self,
2784
+ pdf_file,
2785
+ profile,
2786
+ use_verapdf,
2787
+ _request_auth,
2788
+ _content_type,
2789
+ _headers,
2790
+ _host_index,
2791
+ ) -> RequestSerialized:
2792
+
2793
+ _host = None
2794
+
2795
+ _collection_formats: Dict[str, str] = {
2796
+ }
2797
+
2798
+ _path_params: Dict[str, str] = {}
2799
+ _query_params: List[Tuple[str, str]] = []
2800
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2801
+ _form_params: List[Tuple[str, str]] = []
2802
+ _files: Dict[
2803
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2804
+ ] = {}
2805
+ _body_params: Optional[bytes] = None
2806
+
2807
+ # process the path parameters
2808
+ # process the query parameters
2809
+ # process the header parameters
2810
+ # process the form parameters
2811
+ if pdf_file is not None:
2812
+ _files['pdf_file'] = pdf_file
2813
+ if profile is not None:
2814
+ _form_params.append(('profile', profile))
2815
+ if use_verapdf is not None:
2816
+ _form_params.append(('use_verapdf', use_verapdf))
2817
+ # process the body parameter
2818
+
2819
+
2820
+ # set the HTTP header `Accept`
2821
+ if 'Accept' not in _header_params:
2822
+ _header_params['Accept'] = self.api_client.select_header_accept(
2823
+ [
2824
+ 'application/json'
2825
+ ]
2826
+ )
2827
+
2828
+ # set the HTTP header `Content-Type`
2829
+ if _content_type:
2830
+ _header_params['Content-Type'] = _content_type
2831
+ else:
2832
+ _default_content_type = (
2833
+ self.api_client.select_header_content_type(
2834
+ [
2835
+ 'multipart/form-data'
2836
+ ]
2837
+ )
2838
+ )
2839
+ if _default_content_type is not None:
2840
+ _header_params['Content-Type'] = _default_content_type
2841
+
2842
+ # authentication setting
2843
+ _auth_settings: List[str] = [
2844
+ 'HTTPBearer'
2845
+ ]
2846
+
2847
+ return self.api_client.param_serialize(
2848
+ method='POST',
2849
+ resource_path='/api/v1/processing/validate-facturx-async',
2850
+ path_params=_path_params,
2851
+ query_params=_query_params,
2852
+ header_params=_header_params,
2853
+ body=_body_params,
2854
+ post_params=_form_params,
2855
+ files=_files,
2856
+ auth_settings=_auth_settings,
2857
+ collection_formats=_collection_formats,
2858
+ _host=_host,
2859
+ _request_auth=_request_auth
2860
+ )
2861
+
2862
+
2863
+
2864
+
2865
+ @validate_call
2866
+ def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post(
2867
+ self,
2868
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to validate (will be analyzed to detect and validate signatures)")],
2869
+ _request_timeout: Union[
2870
+ None,
2871
+ Annotated[StrictFloat, Field(gt=0)],
2872
+ Tuple[
2873
+ Annotated[StrictFloat, Field(gt=0)],
2874
+ Annotated[StrictFloat, Field(gt=0)]
2875
+ ]
2876
+ ] = None,
2877
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2878
+ _content_type: Optional[StrictStr] = None,
2879
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2880
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2881
+ ) -> object:
2882
+ """Validate electronic signatures of a PDF
2883
+
2884
+ Validates electronic signatures present in an uploaded PDF. **Verifications performed**: - Presence of signatures - Document integrity (not modified since signing) - Certificate validity - Chain of trust (if available) - Presence of timestamp (PAdES-B-T) - Validation data (PAdES-B-LT) **Supported standards**: PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note**: This validation is technical (cryptographic integrity). Legal validity depends on the eIDAS level of the certificate (SES/AdES/QES) and the context of use.
2885
+
2886
+ :param pdf_file: PDF file to validate (will be analyzed to detect and validate signatures) (required)
2887
+ :type pdf_file: bytearray
2888
+ :param _request_timeout: timeout setting for this request. If one
2889
+ number provided, it will be total request
2890
+ timeout. It can also be a pair (tuple) of
2891
+ (connection, read) timeouts.
2892
+ :type _request_timeout: int, tuple(int, int), optional
2893
+ :param _request_auth: set to override the auth_settings for an a single
2894
+ request; this effectively ignores the
2895
+ authentication in the spec for a single request.
2896
+ :type _request_auth: dict, optional
2897
+ :param _content_type: force content-type for the request.
2898
+ :type _content_type: str, Optional
2899
+ :param _headers: set to override the headers for a single
2900
+ request; this effectively ignores the headers
2901
+ in the spec for a single request.
2902
+ :type _headers: dict, optional
2903
+ :param _host_index: set to override the host_index for a single
2904
+ request; this effectively ignores the host_index
2905
+ in the spec for a single request.
2906
+ :type _host_index: int, optional
2907
+ :return: Returns the result object.
2908
+ """ # noqa: E501
2909
+
2910
+ _param = self._validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
2911
+ pdf_file=pdf_file,
2912
+ _request_auth=_request_auth,
2913
+ _content_type=_content_type,
2914
+ _headers=_headers,
2915
+ _host_index=_host_index
2916
+ )
2917
+
2918
+ _response_types_map: Dict[str, Optional[str]] = {
2919
+ '200': "object",
2920
+ '400': None,
2921
+ '422': "HTTPValidationError",
2922
+ }
2923
+ response_data = self.api_client.call_api(
2924
+ *_param,
2925
+ _request_timeout=_request_timeout
2926
+ )
2927
+ response_data.read()
2928
+ return self.api_client.response_deserialize(
2929
+ response_data=response_data,
2930
+ response_types_map=_response_types_map,
2931
+ ).data
2932
+
2933
+
2934
+ @validate_call
2935
+ def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(
2936
+ self,
2937
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to validate (will be analyzed to detect and validate signatures)")],
2938
+ _request_timeout: Union[
2939
+ None,
2940
+ Annotated[StrictFloat, Field(gt=0)],
2941
+ Tuple[
2942
+ Annotated[StrictFloat, Field(gt=0)],
2943
+ Annotated[StrictFloat, Field(gt=0)]
2944
+ ]
2945
+ ] = None,
2946
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2947
+ _content_type: Optional[StrictStr] = None,
2948
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2949
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2950
+ ) -> ApiResponse[object]:
2951
+ """Validate electronic signatures of a PDF
2952
+
2953
+ Validates electronic signatures present in an uploaded PDF. **Verifications performed**: - Presence of signatures - Document integrity (not modified since signing) - Certificate validity - Chain of trust (if available) - Presence of timestamp (PAdES-B-T) - Validation data (PAdES-B-LT) **Supported standards**: PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note**: This validation is technical (cryptographic integrity). Legal validity depends on the eIDAS level of the certificate (SES/AdES/QES) and the context of use.
2954
+
2955
+ :param pdf_file: PDF file to validate (will be analyzed to detect and validate signatures) (required)
2956
+ :type pdf_file: bytearray
2957
+ :param _request_timeout: timeout setting for this request. If one
2958
+ number provided, it will be total request
2959
+ timeout. It can also be a pair (tuple) of
2960
+ (connection, read) timeouts.
2961
+ :type _request_timeout: int, tuple(int, int), optional
2962
+ :param _request_auth: set to override the auth_settings for an a single
2963
+ request; this effectively ignores the
2964
+ authentication in the spec for a single request.
2965
+ :type _request_auth: dict, optional
2966
+ :param _content_type: force content-type for the request.
2967
+ :type _content_type: str, Optional
2968
+ :param _headers: set to override the headers for a single
2969
+ request; this effectively ignores the headers
2970
+ in the spec for a single request.
2971
+ :type _headers: dict, optional
2972
+ :param _host_index: set to override the host_index for a single
2973
+ request; this effectively ignores the host_index
2974
+ in the spec for a single request.
2975
+ :type _host_index: int, optional
2976
+ :return: Returns the result object.
2977
+ """ # noqa: E501
2978
+
2979
+ _param = self._validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
2980
+ pdf_file=pdf_file,
2981
+ _request_auth=_request_auth,
2982
+ _content_type=_content_type,
2983
+ _headers=_headers,
2984
+ _host_index=_host_index
2985
+ )
2986
+
2987
+ _response_types_map: Dict[str, Optional[str]] = {
2988
+ '200': "object",
2989
+ '400': None,
2990
+ '422': "HTTPValidationError",
2991
+ }
2992
+ response_data = self.api_client.call_api(
2993
+ *_param,
2994
+ _request_timeout=_request_timeout
2995
+ )
2996
+ response_data.read()
2997
+ return self.api_client.response_deserialize(
2998
+ response_data=response_data,
2999
+ response_types_map=_response_types_map,
3000
+ )
3001
+
3002
+
3003
+ @validate_call
3004
+ def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_without_preload_content(
3005
+ self,
3006
+ pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to validate (will be analyzed to detect and validate signatures)")],
3007
+ _request_timeout: Union[
3008
+ None,
3009
+ Annotated[StrictFloat, Field(gt=0)],
3010
+ Tuple[
3011
+ Annotated[StrictFloat, Field(gt=0)],
3012
+ Annotated[StrictFloat, Field(gt=0)]
3013
+ ]
3014
+ ] = None,
3015
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3016
+ _content_type: Optional[StrictStr] = None,
3017
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3018
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3019
+ ) -> RESTResponseType:
3020
+ """Validate electronic signatures of a PDF
3021
+
3022
+ Validates electronic signatures present in an uploaded PDF. **Verifications performed**: - Presence of signatures - Document integrity (not modified since signing) - Certificate validity - Chain of trust (if available) - Presence of timestamp (PAdES-B-T) - Validation data (PAdES-B-LT) **Supported standards**: PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note**: This validation is technical (cryptographic integrity). Legal validity depends on the eIDAS level of the certificate (SES/AdES/QES) and the context of use.
3023
+
3024
+ :param pdf_file: PDF file to validate (will be analyzed to detect and validate signatures) (required)
3025
+ :type pdf_file: bytearray
3026
+ :param _request_timeout: timeout setting for this request. If one
3027
+ number provided, it will be total request
3028
+ timeout. It can also be a pair (tuple) of
3029
+ (connection, read) timeouts.
3030
+ :type _request_timeout: int, tuple(int, int), optional
3031
+ :param _request_auth: set to override the auth_settings for an a single
3032
+ request; this effectively ignores the
3033
+ authentication in the spec for a single request.
3034
+ :type _request_auth: dict, optional
3035
+ :param _content_type: force content-type for the request.
3036
+ :type _content_type: str, Optional
3037
+ :param _headers: set to override the headers for a single
3038
+ request; this effectively ignores the headers
3039
+ in the spec for a single request.
3040
+ :type _headers: dict, optional
3041
+ :param _host_index: set to override the host_index for a single
3042
+ request; this effectively ignores the host_index
3043
+ in the spec for a single request.
3044
+ :type _host_index: int, optional
3045
+ :return: Returns the result object.
3046
+ """ # noqa: E501
3047
+
3048
+ _param = self._validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
3049
+ pdf_file=pdf_file,
3050
+ _request_auth=_request_auth,
3051
+ _content_type=_content_type,
3052
+ _headers=_headers,
3053
+ _host_index=_host_index
3054
+ )
3055
+
3056
+ _response_types_map: Dict[str, Optional[str]] = {
3057
+ '200': "object",
3058
+ '400': None,
3059
+ '422': "HTTPValidationError",
3060
+ }
3061
+ response_data = self.api_client.call_api(
3062
+ *_param,
3063
+ _request_timeout=_request_timeout
3064
+ )
3065
+ return response_data.response
3066
+
3067
+
3068
+ def _validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
3069
+ self,
3070
+ pdf_file,
3071
+ _request_auth,
3072
+ _content_type,
3073
+ _headers,
3074
+ _host_index,
3075
+ ) -> RequestSerialized:
3076
+
3077
+ _host = None
3078
+
3079
+ _collection_formats: Dict[str, str] = {
3080
+ }
3081
+
3082
+ _path_params: Dict[str, str] = {}
3083
+ _query_params: List[Tuple[str, str]] = []
3084
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3085
+ _form_params: List[Tuple[str, str]] = []
3086
+ _files: Dict[
3087
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3088
+ ] = {}
3089
+ _body_params: Optional[bytes] = None
3090
+
3091
+ # process the path parameters
3092
+ # process the query parameters
3093
+ # process the header parameters
3094
+ # process the form parameters
3095
+ if pdf_file is not None:
3096
+ _files['pdf_file'] = pdf_file
3097
+ # process the body parameter
3098
+
3099
+
3100
+ # set the HTTP header `Accept`
3101
+ if 'Accept' not in _header_params:
3102
+ _header_params['Accept'] = self.api_client.select_header_accept(
3103
+ [
3104
+ 'application/json'
3105
+ ]
3106
+ )
3107
+
3108
+ # set the HTTP header `Content-Type`
3109
+ if _content_type:
3110
+ _header_params['Content-Type'] = _content_type
3111
+ else:
3112
+ _default_content_type = (
3113
+ self.api_client.select_header_content_type(
3114
+ [
3115
+ 'multipart/form-data'
3116
+ ]
3117
+ )
3118
+ )
3119
+ if _default_content_type is not None:
3120
+ _header_params['Content-Type'] = _default_content_type
3121
+
3122
+ # authentication setting
3123
+ _auth_settings: List[str] = [
3124
+ 'HTTPBearer'
3125
+ ]
3126
+
3127
+ return self.api_client.param_serialize(
3128
+ method='POST',
3129
+ resource_path='/api/v1/processing/validate-pdf-signature',
3130
+ path_params=_path_params,
3131
+ query_params=_query_params,
3132
+ header_params=_header_params,
3133
+ body=_body_params,
3134
+ post_params=_form_params,
3135
+ files=_files,
3136
+ auth_settings=_auth_settings,
3137
+ collection_formats=_collection_formats,
3138
+ _host=_host,
3139
+ _request_auth=_request_auth
3140
+ )
3141
+
3142
+
3143
+
3144
+
3145
+ @validate_call
3146
+ def validate_xml_api_v1_processing_validate_xml_post(
3147
+ self,
3148
+ xml_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X XML file to validate (.xml format).")],
3149
+ profile: Annotated[Optional[Any], Field(description="Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
3150
+ _request_timeout: Union[
3151
+ None,
3152
+ Annotated[StrictFloat, Field(gt=0)],
3153
+ Tuple[
3154
+ Annotated[StrictFloat, Field(gt=0)],
3155
+ Annotated[StrictFloat, Field(gt=0)]
3156
+ ]
3157
+ ] = None,
3158
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3159
+ _content_type: Optional[StrictStr] = None,
3160
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3161
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3162
+ ) -> ValidationSuccessResponse:
3163
+ """Validate an existing Factur-X XML
3164
+
3165
+ 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
3166
+
3167
+ :param xml_file: Factur-X XML file to validate (.xml format). (required)
3168
+ :type xml_file: bytearray
3169
+ :param profile: Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
3170
+ :type profile: FacturXProfile
3171
+ :param _request_timeout: timeout setting for this request. If one
3172
+ number provided, it will be total request
3173
+ timeout. It can also be a pair (tuple) of
3174
+ (connection, read) timeouts.
3175
+ :type _request_timeout: int, tuple(int, int), optional
3176
+ :param _request_auth: set to override the auth_settings for an a single
3177
+ request; this effectively ignores the
3178
+ authentication in the spec for a single request.
3179
+ :type _request_auth: dict, optional
3180
+ :param _content_type: force content-type for the request.
3181
+ :type _content_type: str, Optional
3182
+ :param _headers: set to override the headers for a single
3183
+ request; this effectively ignores the headers
3184
+ in the spec for a single request.
3185
+ :type _headers: dict, optional
3186
+ :param _host_index: set to override the host_index for a single
3187
+ request; this effectively ignores the host_index
3188
+ in the spec for a single request.
3189
+ :type _host_index: int, optional
3190
+ :return: Returns the result object.
3191
+ """ # noqa: E501
3192
+
3193
+ _param = self._validate_xml_api_v1_processing_validate_xml_post_serialize(
3194
+ xml_file=xml_file,
3195
+ profile=profile,
3196
+ _request_auth=_request_auth,
3197
+ _content_type=_content_type,
3198
+ _headers=_headers,
3199
+ _host_index=_host_index
3200
+ )
3201
+
3202
+ _response_types_map: Dict[str, Optional[str]] = {
3203
+ '200': "ValidationSuccessResponse",
3204
+ '400': "ValidationErrorResponse",
3205
+ '422': "HTTPValidationError",
3206
+ }
3207
+ response_data = self.api_client.call_api(
3208
+ *_param,
3209
+ _request_timeout=_request_timeout
3210
+ )
3211
+ response_data.read()
3212
+ return self.api_client.response_deserialize(
3213
+ response_data=response_data,
3214
+ response_types_map=_response_types_map,
3215
+ ).data
3216
+
3217
+
3218
+ @validate_call
3219
+ def validate_xml_api_v1_processing_validate_xml_post_with_http_info(
3220
+ self,
3221
+ xml_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X XML file to validate (.xml format).")],
3222
+ profile: Annotated[Optional[Any], Field(description="Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
3223
+ _request_timeout: Union[
3224
+ None,
3225
+ Annotated[StrictFloat, Field(gt=0)],
3226
+ Tuple[
3227
+ Annotated[StrictFloat, Field(gt=0)],
3228
+ Annotated[StrictFloat, Field(gt=0)]
3229
+ ]
3230
+ ] = None,
3231
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3232
+ _content_type: Optional[StrictStr] = None,
3233
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3234
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3235
+ ) -> ApiResponse[ValidationSuccessResponse]:
3236
+ """Validate an existing Factur-X XML
3237
+
3238
+ 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
3239
+
3240
+ :param xml_file: Factur-X XML file to validate (.xml format). (required)
3241
+ :type xml_file: bytearray
3242
+ :param profile: Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
3243
+ :type profile: FacturXProfile
3244
+ :param _request_timeout: timeout setting for this request. If one
3245
+ number provided, it will be total request
3246
+ timeout. It can also be a pair (tuple) of
3247
+ (connection, read) timeouts.
3248
+ :type _request_timeout: int, tuple(int, int), optional
3249
+ :param _request_auth: set to override the auth_settings for an a single
3250
+ request; this effectively ignores the
3251
+ authentication in the spec for a single request.
3252
+ :type _request_auth: dict, optional
3253
+ :param _content_type: force content-type for the request.
3254
+ :type _content_type: str, Optional
3255
+ :param _headers: set to override the headers for a single
3256
+ request; this effectively ignores the headers
3257
+ in the spec for a single request.
3258
+ :type _headers: dict, optional
3259
+ :param _host_index: set to override the host_index for a single
3260
+ request; this effectively ignores the host_index
3261
+ in the spec for a single request.
3262
+ :type _host_index: int, optional
3263
+ :return: Returns the result object.
3264
+ """ # noqa: E501
3265
+
3266
+ _param = self._validate_xml_api_v1_processing_validate_xml_post_serialize(
3267
+ xml_file=xml_file,
3268
+ profile=profile,
3269
+ _request_auth=_request_auth,
3270
+ _content_type=_content_type,
3271
+ _headers=_headers,
3272
+ _host_index=_host_index
3273
+ )
3274
+
3275
+ _response_types_map: Dict[str, Optional[str]] = {
3276
+ '200': "ValidationSuccessResponse",
3277
+ '400': "ValidationErrorResponse",
3278
+ '422': "HTTPValidationError",
3279
+ }
3280
+ response_data = self.api_client.call_api(
3281
+ *_param,
3282
+ _request_timeout=_request_timeout
3283
+ )
3284
+ response_data.read()
3285
+ return self.api_client.response_deserialize(
3286
+ response_data=response_data,
3287
+ response_types_map=_response_types_map,
3288
+ )
3289
+
3290
+
3291
+ @validate_call
3292
+ def validate_xml_api_v1_processing_validate_xml_post_without_preload_content(
3293
+ self,
3294
+ xml_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X XML file to validate (.xml format).")],
3295
+ profile: Annotated[Optional[Any], Field(description="Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
3296
+ _request_timeout: Union[
3297
+ None,
3298
+ Annotated[StrictFloat, Field(gt=0)],
3299
+ Tuple[
3300
+ Annotated[StrictFloat, Field(gt=0)],
3301
+ Annotated[StrictFloat, Field(gt=0)]
3302
+ ]
3303
+ ] = None,
3304
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3305
+ _content_type: Optional[StrictStr] = None,
3306
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3307
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3308
+ ) -> RESTResponseType:
3309
+ """Validate an existing Factur-X XML
3310
+
3311
+ 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
3312
+
3313
+ :param xml_file: Factur-X XML file to validate (.xml format). (required)
3314
+ :type xml_file: bytearray
3315
+ :param profile: Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
3316
+ :type profile: FacturXProfile
3317
+ :param _request_timeout: timeout setting for this request. If one
3318
+ number provided, it will be total request
3319
+ timeout. It can also be a pair (tuple) of
3320
+ (connection, read) timeouts.
3321
+ :type _request_timeout: int, tuple(int, int), optional
3322
+ :param _request_auth: set to override the auth_settings for an a single
3323
+ request; this effectively ignores the
3324
+ authentication in the spec for a single request.
3325
+ :type _request_auth: dict, optional
3326
+ :param _content_type: force content-type for the request.
3327
+ :type _content_type: str, Optional
3328
+ :param _headers: set to override the headers for a single
3329
+ request; this effectively ignores the headers
3330
+ in the spec for a single request.
3331
+ :type _headers: dict, optional
3332
+ :param _host_index: set to override the host_index for a single
3333
+ request; this effectively ignores the host_index
3334
+ in the spec for a single request.
3335
+ :type _host_index: int, optional
3336
+ :return: Returns the result object.
3337
+ """ # noqa: E501
3338
+
3339
+ _param = self._validate_xml_api_v1_processing_validate_xml_post_serialize(
3340
+ xml_file=xml_file,
3341
+ profile=profile,
3342
+ _request_auth=_request_auth,
3343
+ _content_type=_content_type,
3344
+ _headers=_headers,
3345
+ _host_index=_host_index
3346
+ )
3347
+
3348
+ _response_types_map: Dict[str, Optional[str]] = {
3349
+ '200': "ValidationSuccessResponse",
3350
+ '400': "ValidationErrorResponse",
3351
+ '422': "HTTPValidationError",
3352
+ }
3353
+ response_data = self.api_client.call_api(
3354
+ *_param,
3355
+ _request_timeout=_request_timeout
3356
+ )
3357
+ return response_data.response
3358
+
3359
+
3360
+ def _validate_xml_api_v1_processing_validate_xml_post_serialize(
3361
+ self,
3362
+ xml_file,
3363
+ profile,
3364
+ _request_auth,
3365
+ _content_type,
3366
+ _headers,
3367
+ _host_index,
3368
+ ) -> RequestSerialized:
3369
+
3370
+ _host = None
3371
+
3372
+ _collection_formats: Dict[str, str] = {
3373
+ }
3374
+
3375
+ _path_params: Dict[str, str] = {}
3376
+ _query_params: List[Tuple[str, str]] = []
3377
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3378
+ _form_params: List[Tuple[str, str]] = []
3379
+ _files: Dict[
3380
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3381
+ ] = {}
3382
+ _body_params: Optional[bytes] = None
3383
+
3384
+ # process the path parameters
3385
+ # process the query parameters
3386
+ # process the header parameters
3387
+ # process the form parameters
3388
+ if xml_file is not None:
3389
+ _files['xml_file'] = xml_file
3390
+ if profile is not None:
3391
+ _form_params.append(('profile', profile))
3392
+ # process the body parameter
3393
+
3394
+
3395
+ # set the HTTP header `Accept`
3396
+ if 'Accept' not in _header_params:
3397
+ _header_params['Accept'] = self.api_client.select_header_accept(
3398
+ [
3399
+ 'application/json'
3400
+ ]
3401
+ )
3402
+
3403
+ # set the HTTP header `Content-Type`
3404
+ if _content_type:
3405
+ _header_params['Content-Type'] = _content_type
3406
+ else:
3407
+ _default_content_type = (
3408
+ self.api_client.select_header_content_type(
3409
+ [
3410
+ 'multipart/form-data'
3411
+ ]
3412
+ )
3413
+ )
3414
+ if _default_content_type is not None:
3415
+ _header_params['Content-Type'] = _default_content_type
3416
+
3417
+ # authentication setting
3418
+ _auth_settings: List[str] = [
3419
+ 'HTTPBearer'
3420
+ ]
3421
+
3422
+ return self.api_client.param_serialize(
3423
+ method='POST',
3424
+ resource_path='/api/v1/processing/validate-xml',
3425
+ path_params=_path_params,
3426
+ query_params=_query_params,
3427
+ header_params=_header_params,
3428
+ body=_body_params,
3429
+ post_params=_form_params,
3430
+ files=_files,
3431
+ auth_settings=_auth_settings,
3432
+ collection_formats=_collection_formats,
3433
+ _host=_host,
3434
+ _request_auth=_request_auth
3435
+ )
3436
+
3437
+