factpulse 1.0.6__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.
Files changed (131) hide show
  1. factpulse/__init__.py +280 -0
  2. factpulse/api/__init__.py +13 -0
  3. factpulse/api/afnorpdppa_api.py +284 -0
  4. factpulse/api/afnorpdppa_directory_service_api.py +799 -0
  5. factpulse/api/afnorpdppa_flow_service_api.py +1075 -0
  6. factpulse/api/chorus_pro_api.py +4506 -0
  7. factpulse/api/processing_endpoints_unifis_api.py +592 -0
  8. factpulse/api/sant_api.py +281 -0
  9. factpulse/api/signature_lectronique_api.py +1358 -0
  10. factpulse/api/traitement_facture_api.py +3439 -0
  11. factpulse/api/utilisateur_api.py +282 -0
  12. factpulse/api_client.py +804 -0
  13. factpulse/api_response.py +21 -0
  14. factpulse/configuration.py +585 -0
  15. factpulse/exceptions.py +216 -0
  16. factpulse/models/__init__.py +124 -0
  17. factpulse/models/adresse_electronique.py +90 -0
  18. factpulse/models/adresse_postale.py +120 -0
  19. factpulse/models/body_ajouter_fichier_api_v1_chorus_pro_transverses_ajouter_fichier_post.py +104 -0
  20. factpulse/models/body_completer_facture_api_v1_chorus_pro_factures_completer_post.py +104 -0
  21. factpulse/models/body_lister_services_structure_api_v1_chorus_pro_structures_id_structure_cpp_services_get.py +102 -0
  22. factpulse/models/body_rechercher_factures_destinataire_api_v1_chorus_pro_factures_rechercher_destinataire_post.py +104 -0
  23. factpulse/models/body_rechercher_factures_fournisseur_api_v1_chorus_pro_factures_rechercher_fournisseur_post.py +104 -0
  24. factpulse/models/body_recycler_facture_api_v1_chorus_pro_factures_recycler_post.py +104 -0
  25. factpulse/models/body_telecharger_groupe_factures_api_v1_chorus_pro_factures_telecharger_groupe_post.py +104 -0
  26. factpulse/models/body_traiter_facture_recue_api_v1_chorus_pro_factures_traiter_facture_recue_post.py +104 -0
  27. factpulse/models/body_valideur_consulter_facture_api_v1_chorus_pro_factures_valideur_consulter_post.py +104 -0
  28. factpulse/models/body_valideur_rechercher_factures_api_v1_chorus_pro_factures_valideur_rechercher_post.py +104 -0
  29. factpulse/models/body_valideur_traiter_facture_api_v1_chorus_pro_factures_valideur_traiter_post.py +104 -0
  30. factpulse/models/cadre_de_facturation.py +102 -0
  31. factpulse/models/categorie_tva.py +44 -0
  32. factpulse/models/certificate_info_response.py +114 -0
  33. factpulse/models/chorus_pro_credentials.py +95 -0
  34. factpulse/models/code_cadre_facturation.py +39 -0
  35. factpulse/models/code_raison_reduction.py +42 -0
  36. factpulse/models/consulter_facture_request.py +98 -0
  37. factpulse/models/consulter_facture_response.py +142 -0
  38. factpulse/models/consulter_structure_request.py +100 -0
  39. factpulse/models/consulter_structure_response.py +142 -0
  40. factpulse/models/credentials_afnor.py +106 -0
  41. factpulse/models/credentials_chorus_pro.py +115 -0
  42. factpulse/models/destinataire.py +116 -0
  43. factpulse/models/destination.py +140 -0
  44. factpulse/models/destination_afnor.py +127 -0
  45. factpulse/models/destination_chorus_pro.py +108 -0
  46. factpulse/models/direction_flux.py +37 -0
  47. factpulse/models/donnees_facture_simplifiees.py +124 -0
  48. factpulse/models/facture_enrichie_info_input.py +123 -0
  49. factpulse/models/facture_enrichie_info_output.py +133 -0
  50. factpulse/models/facture_factur_x.py +173 -0
  51. factpulse/models/flux_resume.py +131 -0
  52. factpulse/models/format_sortie.py +37 -0
  53. factpulse/models/fournisseur.py +146 -0
  54. factpulse/models/generate_certificate_request.py +118 -0
  55. factpulse/models/generate_certificate_response.py +106 -0
  56. factpulse/models/http_validation_error.py +95 -0
  57. factpulse/models/information_signature_api.py +122 -0
  58. factpulse/models/ligne_de_poste.py +188 -0
  59. factpulse/models/ligne_de_poste_montant_remise_ht.py +145 -0
  60. factpulse/models/ligne_de_poste_montant_total_ligne_ht.py +145 -0
  61. factpulse/models/ligne_de_poste_taux_tva_manuel.py +145 -0
  62. factpulse/models/ligne_de_tva.py +118 -0
  63. factpulse/models/mode_depot.py +38 -0
  64. factpulse/models/mode_paiement.py +41 -0
  65. factpulse/models/montant_ht_total.py +139 -0
  66. factpulse/models/montant_total.py +138 -0
  67. factpulse/models/montant_total_acompte.py +145 -0
  68. factpulse/models/montant_total_montant_remise_globale_ttc.py +145 -0
  69. factpulse/models/montant_ttc_total.py +139 -0
  70. factpulse/models/montant_tva.py +139 -0
  71. factpulse/models/montantapayer.py +139 -0
  72. factpulse/models/montantbaseht.py +139 -0
  73. factpulse/models/montanthttotal.py +139 -0
  74. factpulse/models/montantttctotal.py +139 -0
  75. factpulse/models/montanttva.py +139 -0
  76. factpulse/models/montanttva1.py +139 -0
  77. factpulse/models/montantunitaireht.py +139 -0
  78. factpulse/models/obtenir_id_chorus_pro_request.py +100 -0
  79. factpulse/models/obtenir_id_chorus_pro_response.py +98 -0
  80. factpulse/models/options_processing.py +103 -0
  81. factpulse/models/parametres_signature.py +133 -0
  82. factpulse/models/parametres_structure.py +91 -0
  83. factpulse/models/pdf_factur_x_info.py +91 -0
  84. factpulse/models/pdp_credentials.py +93 -0
  85. factpulse/models/piece_jointe_complementaire.py +95 -0
  86. factpulse/models/profil_api.py +39 -0
  87. factpulse/models/profil_flux.py +38 -0
  88. factpulse/models/quantite.py +139 -0
  89. factpulse/models/quota_info.py +95 -0
  90. factpulse/models/rechercher_services_response.py +101 -0
  91. factpulse/models/rechercher_structure_request.py +119 -0
  92. factpulse/models/rechercher_structure_response.py +101 -0
  93. factpulse/models/references.py +124 -0
  94. factpulse/models/reponse_healthcheck_afnor.py +91 -0
  95. factpulse/models/reponse_recherche_flux.py +101 -0
  96. factpulse/models/reponse_soumission_flux.py +109 -0
  97. factpulse/models/reponse_tache.py +87 -0
  98. factpulse/models/reponse_validation_erreur.py +87 -0
  99. factpulse/models/reponse_validation_succes.py +87 -0
  100. factpulse/models/requete_recherche_flux.py +143 -0
  101. factpulse/models/requete_soumission_flux.py +123 -0
  102. factpulse/models/resultat_afnor.py +105 -0
  103. factpulse/models/resultat_chorus_pro.py +101 -0
  104. factpulse/models/resultat_validation_pdfapi.py +169 -0
  105. factpulse/models/scheme_id.py +40 -0
  106. factpulse/models/service_structure.py +93 -0
  107. factpulse/models/signature_info.py +101 -0
  108. factpulse/models/soumettre_facture_complete_request.py +116 -0
  109. factpulse/models/soumettre_facture_complete_response.py +145 -0
  110. factpulse/models/soumettre_facture_request.py +164 -0
  111. factpulse/models/soumettre_facture_response.py +103 -0
  112. factpulse/models/statut_acquittement.py +38 -0
  113. factpulse/models/statut_facture.py +96 -0
  114. factpulse/models/statut_tache.py +99 -0
  115. factpulse/models/structure_info.py +95 -0
  116. factpulse/models/syntaxe_flux.py +40 -0
  117. factpulse/models/tauxmanuel.py +139 -0
  118. factpulse/models/type_facture.py +37 -0
  119. factpulse/models/type_flux.py +40 -0
  120. factpulse/models/type_tva.py +39 -0
  121. factpulse/models/unite.py +41 -0
  122. factpulse/models/utilisateur.py +128 -0
  123. factpulse/models/validation_error.py +99 -0
  124. factpulse/models/validation_error_loc_inner.py +138 -0
  125. factpulse/py.typed +0 -0
  126. factpulse/rest.py +258 -0
  127. factpulse-1.0.6.dist-info/METADATA +182 -0
  128. factpulse-1.0.6.dist-info/RECORD +131 -0
  129. factpulse-1.0.6.dist-info/WHEEL +5 -0
  130. factpulse-1.0.6.dist-info/licenses/LICENSE +21 -0
  131. factpulse-1.0.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3439 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ API REST FactPulse
5
+
6
+ API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
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.format_sortie import FormatSortie
23
+ from factpulse.models.generate_certificate_request import GenerateCertificateRequest
24
+ from factpulse.models.generate_certificate_response import GenerateCertificateResponse
25
+ from factpulse.models.profil_api import ProfilAPI
26
+ from factpulse.models.reponse_tache import ReponseTache
27
+ from factpulse.models.reponse_validation_succes import ReponseValidationSucces
28
+ from factpulse.models.resultat_validation_pdfapi import ResultatValidationPDFAPI
29
+ from factpulse.models.soumettre_facture_complete_request import SoumettreFactureCompleteRequest
30
+ from factpulse.models.soumettre_facture_complete_response import SoumettreFactureCompleteResponse
31
+ from factpulse.models.statut_tache import StatutTache
32
+
33
+ from factpulse.api_client import ApiClient, RequestSerialized
34
+ from factpulse.api_response import ApiResponse
35
+ from factpulse.rest import RESTResponseType
36
+
37
+
38
+ class TraitementFactureApi:
39
+ """NOTE: This class is auto generated by OpenAPI Generator
40
+ Ref: https://openapi-generator.tech
41
+
42
+ Do not edit the class manually.
43
+ """
44
+
45
+ def __init__(self, api_client=None) -> None:
46
+ if api_client is None:
47
+ api_client = ApiClient.get_default()
48
+ self.api_client = api_client
49
+
50
+
51
+ @validate_call
52
+ def generer_certificat_test_api_v1_traitement_generer_certificat_test_post(
53
+ self,
54
+ generate_certificate_request: GenerateCertificateRequest,
55
+ _request_timeout: Union[
56
+ None,
57
+ Annotated[StrictFloat, Field(gt=0)],
58
+ Tuple[
59
+ Annotated[StrictFloat, Field(gt=0)],
60
+ Annotated[StrictFloat, Field(gt=0)]
61
+ ]
62
+ ] = None,
63
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
64
+ _content_type: Optional[StrictStr] = None,
65
+ _headers: Optional[Dict[StrictStr, Any]] = None,
66
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
67
+ ) -> GenerateCertificateResponse:
68
+ """Générer un certificat X.509 auto-signé de test
69
+
70
+ Génère un certificat X.509 auto-signé pour les tests de signature électronique PDF. **⚠️ ATTENTION : Certificat de TEST uniquement !** Ce certificat est : - ✅ Adapté pour tests et développement - ✅ Compatible signature PDF (PAdES) - ✅ Conforme eIDAS niveau **SES** (Simple Electronic Signature) - ❌ **JAMAIS utilisable en production** - ❌ **Non reconnu** par les navigateurs et lecteurs PDF - ❌ **Aucune valeur juridique** ## Niveaux eIDAS - **SES** (Simple) : Certificat auto-signé ← Généré par cet endpoint - **AdES** (Advanced) : Certificat CA commerciale (Let's Encrypt, etc.) - **QES** (Qualified) : Certificat qualifié PSCO (CertEurope, Universign, etc.) ## Utilisation Une fois généré, le certificat peut être : 1. **Enregistré dans Django** (recommandé) : - Django Admin > Certificats de signature - Upload `certificat_pem` et `cle_privee_pem` 2. **Utilisé directement** : - Signer un PDF avec `/signer-pdf` - Le certificat sera automatiquement utilisé ## Exemple d'appel ```bash curl -X POST \"https://www.factpulse.fr/api/facturation/generer-certificat-test\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organisation\": \"Client XYZ SARL\", \"email\": \"contact@xyz.fr\", \"duree_jours\": 365 }' ``` ## Cas d'usage - Tests de signature PDF en développement - POC de signature électronique - Formation et démos - Tests d'intégration automatisés ## Conformité technique Certificat généré avec : - Clé RSA 2048 ou 4096 bits - Algorithme SHA-256 - Extensions Key Usage : `digitalSignature`, `contentCommitment` (non-repudiation) - Extensions Extended Key Usage : `codeSigning`, `emailProtection` - Validité : 1 jour à 10 ans (configurable) - Format : PEM (certificat et clé) - Optionnel : PKCS#12 (.p12)
71
+
72
+ :param generate_certificate_request: (required)
73
+ :type generate_certificate_request: GenerateCertificateRequest
74
+ :param _request_timeout: timeout setting for this request. If one
75
+ number provided, it will be total request
76
+ timeout. It can also be a pair (tuple) of
77
+ (connection, read) timeouts.
78
+ :type _request_timeout: int, tuple(int, int), optional
79
+ :param _request_auth: set to override the auth_settings for an a single
80
+ request; this effectively ignores the
81
+ authentication in the spec for a single request.
82
+ :type _request_auth: dict, optional
83
+ :param _content_type: force content-type for the request.
84
+ :type _content_type: str, Optional
85
+ :param _headers: set to override the headers for a single
86
+ request; this effectively ignores the headers
87
+ in the spec for a single request.
88
+ :type _headers: dict, optional
89
+ :param _host_index: set to override the host_index for a single
90
+ request; this effectively ignores the host_index
91
+ in the spec for a single request.
92
+ :type _host_index: int, optional
93
+ :return: Returns the result object.
94
+ """ # noqa: E501
95
+
96
+ _param = self._generer_certificat_test_api_v1_traitement_generer_certificat_test_post_serialize(
97
+ generate_certificate_request=generate_certificate_request,
98
+ _request_auth=_request_auth,
99
+ _content_type=_content_type,
100
+ _headers=_headers,
101
+ _host_index=_host_index
102
+ )
103
+
104
+ _response_types_map: Dict[str, Optional[str]] = {
105
+ '200': "GenerateCertificateResponse",
106
+ '400': None,
107
+ '500': None,
108
+ '422': "HTTPValidationError",
109
+ }
110
+ response_data = self.api_client.call_api(
111
+ *_param,
112
+ _request_timeout=_request_timeout
113
+ )
114
+ response_data.read()
115
+ return self.api_client.response_deserialize(
116
+ response_data=response_data,
117
+ response_types_map=_response_types_map,
118
+ ).data
119
+
120
+
121
+ @validate_call
122
+ def generer_certificat_test_api_v1_traitement_generer_certificat_test_post_with_http_info(
123
+ self,
124
+ generate_certificate_request: GenerateCertificateRequest,
125
+ _request_timeout: Union[
126
+ None,
127
+ Annotated[StrictFloat, Field(gt=0)],
128
+ Tuple[
129
+ Annotated[StrictFloat, Field(gt=0)],
130
+ Annotated[StrictFloat, Field(gt=0)]
131
+ ]
132
+ ] = None,
133
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
134
+ _content_type: Optional[StrictStr] = None,
135
+ _headers: Optional[Dict[StrictStr, Any]] = None,
136
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
137
+ ) -> ApiResponse[GenerateCertificateResponse]:
138
+ """Générer un certificat X.509 auto-signé de test
139
+
140
+ Génère un certificat X.509 auto-signé pour les tests de signature électronique PDF. **⚠️ ATTENTION : Certificat de TEST uniquement !** Ce certificat est : - ✅ Adapté pour tests et développement - ✅ Compatible signature PDF (PAdES) - ✅ Conforme eIDAS niveau **SES** (Simple Electronic Signature) - ❌ **JAMAIS utilisable en production** - ❌ **Non reconnu** par les navigateurs et lecteurs PDF - ❌ **Aucune valeur juridique** ## Niveaux eIDAS - **SES** (Simple) : Certificat auto-signé ← Généré par cet endpoint - **AdES** (Advanced) : Certificat CA commerciale (Let's Encrypt, etc.) - **QES** (Qualified) : Certificat qualifié PSCO (CertEurope, Universign, etc.) ## Utilisation Une fois généré, le certificat peut être : 1. **Enregistré dans Django** (recommandé) : - Django Admin > Certificats de signature - Upload `certificat_pem` et `cle_privee_pem` 2. **Utilisé directement** : - Signer un PDF avec `/signer-pdf` - Le certificat sera automatiquement utilisé ## Exemple d'appel ```bash curl -X POST \"https://www.factpulse.fr/api/facturation/generer-certificat-test\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organisation\": \"Client XYZ SARL\", \"email\": \"contact@xyz.fr\", \"duree_jours\": 365 }' ``` ## Cas d'usage - Tests de signature PDF en développement - POC de signature électronique - Formation et démos - Tests d'intégration automatisés ## Conformité technique Certificat généré avec : - Clé RSA 2048 ou 4096 bits - Algorithme SHA-256 - Extensions Key Usage : `digitalSignature`, `contentCommitment` (non-repudiation) - Extensions Extended Key Usage : `codeSigning`, `emailProtection` - Validité : 1 jour à 10 ans (configurable) - Format : PEM (certificat et clé) - Optionnel : PKCS#12 (.p12)
141
+
142
+ :param generate_certificate_request: (required)
143
+ :type generate_certificate_request: GenerateCertificateRequest
144
+ :param _request_timeout: timeout setting for this request. If one
145
+ number provided, it will be total request
146
+ timeout. It can also be a pair (tuple) of
147
+ (connection, read) timeouts.
148
+ :type _request_timeout: int, tuple(int, int), optional
149
+ :param _request_auth: set to override the auth_settings for an a single
150
+ request; this effectively ignores the
151
+ authentication in the spec for a single request.
152
+ :type _request_auth: dict, optional
153
+ :param _content_type: force content-type for the request.
154
+ :type _content_type: str, Optional
155
+ :param _headers: set to override the headers for a single
156
+ request; this effectively ignores the headers
157
+ in the spec for a single request.
158
+ :type _headers: dict, optional
159
+ :param _host_index: set to override the host_index for a single
160
+ request; this effectively ignores the host_index
161
+ in the spec for a single request.
162
+ :type _host_index: int, optional
163
+ :return: Returns the result object.
164
+ """ # noqa: E501
165
+
166
+ _param = self._generer_certificat_test_api_v1_traitement_generer_certificat_test_post_serialize(
167
+ generate_certificate_request=generate_certificate_request,
168
+ _request_auth=_request_auth,
169
+ _content_type=_content_type,
170
+ _headers=_headers,
171
+ _host_index=_host_index
172
+ )
173
+
174
+ _response_types_map: Dict[str, Optional[str]] = {
175
+ '200': "GenerateCertificateResponse",
176
+ '400': None,
177
+ '500': None,
178
+ '422': "HTTPValidationError",
179
+ }
180
+ response_data = self.api_client.call_api(
181
+ *_param,
182
+ _request_timeout=_request_timeout
183
+ )
184
+ response_data.read()
185
+ return self.api_client.response_deserialize(
186
+ response_data=response_data,
187
+ response_types_map=_response_types_map,
188
+ )
189
+
190
+
191
+ @validate_call
192
+ def generer_certificat_test_api_v1_traitement_generer_certificat_test_post_without_preload_content(
193
+ self,
194
+ generate_certificate_request: GenerateCertificateRequest,
195
+ _request_timeout: Union[
196
+ None,
197
+ Annotated[StrictFloat, Field(gt=0)],
198
+ Tuple[
199
+ Annotated[StrictFloat, Field(gt=0)],
200
+ Annotated[StrictFloat, Field(gt=0)]
201
+ ]
202
+ ] = None,
203
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
204
+ _content_type: Optional[StrictStr] = None,
205
+ _headers: Optional[Dict[StrictStr, Any]] = None,
206
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
207
+ ) -> RESTResponseType:
208
+ """Générer un certificat X.509 auto-signé de test
209
+
210
+ Génère un certificat X.509 auto-signé pour les tests de signature électronique PDF. **⚠️ ATTENTION : Certificat de TEST uniquement !** Ce certificat est : - ✅ Adapté pour tests et développement - ✅ Compatible signature PDF (PAdES) - ✅ Conforme eIDAS niveau **SES** (Simple Electronic Signature) - ❌ **JAMAIS utilisable en production** - ❌ **Non reconnu** par les navigateurs et lecteurs PDF - ❌ **Aucune valeur juridique** ## Niveaux eIDAS - **SES** (Simple) : Certificat auto-signé ← Généré par cet endpoint - **AdES** (Advanced) : Certificat CA commerciale (Let's Encrypt, etc.) - **QES** (Qualified) : Certificat qualifié PSCO (CertEurope, Universign, etc.) ## Utilisation Une fois généré, le certificat peut être : 1. **Enregistré dans Django** (recommandé) : - Django Admin > Certificats de signature - Upload `certificat_pem` et `cle_privee_pem` 2. **Utilisé directement** : - Signer un PDF avec `/signer-pdf` - Le certificat sera automatiquement utilisé ## Exemple d'appel ```bash curl -X POST \"https://www.factpulse.fr/api/facturation/generer-certificat-test\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organisation\": \"Client XYZ SARL\", \"email\": \"contact@xyz.fr\", \"duree_jours\": 365 }' ``` ## Cas d'usage - Tests de signature PDF en développement - POC de signature électronique - Formation et démos - Tests d'intégration automatisés ## Conformité technique Certificat généré avec : - Clé RSA 2048 ou 4096 bits - Algorithme SHA-256 - Extensions Key Usage : `digitalSignature`, `contentCommitment` (non-repudiation) - Extensions Extended Key Usage : `codeSigning`, `emailProtection` - Validité : 1 jour à 10 ans (configurable) - Format : PEM (certificat et clé) - Optionnel : PKCS#12 (.p12)
211
+
212
+ :param generate_certificate_request: (required)
213
+ :type generate_certificate_request: GenerateCertificateRequest
214
+ :param _request_timeout: timeout setting for this request. If one
215
+ number provided, it will be total request
216
+ timeout. It can also be a pair (tuple) of
217
+ (connection, read) timeouts.
218
+ :type _request_timeout: int, tuple(int, int), optional
219
+ :param _request_auth: set to override the auth_settings for an a single
220
+ request; this effectively ignores the
221
+ authentication in the spec for a single request.
222
+ :type _request_auth: dict, optional
223
+ :param _content_type: force content-type for the request.
224
+ :type _content_type: str, Optional
225
+ :param _headers: set to override the headers for a single
226
+ request; this effectively ignores the headers
227
+ in the spec for a single request.
228
+ :type _headers: dict, optional
229
+ :param _host_index: set to override the host_index for a single
230
+ request; this effectively ignores the host_index
231
+ in the spec for a single request.
232
+ :type _host_index: int, optional
233
+ :return: Returns the result object.
234
+ """ # noqa: E501
235
+
236
+ _param = self._generer_certificat_test_api_v1_traitement_generer_certificat_test_post_serialize(
237
+ generate_certificate_request=generate_certificate_request,
238
+ _request_auth=_request_auth,
239
+ _content_type=_content_type,
240
+ _headers=_headers,
241
+ _host_index=_host_index
242
+ )
243
+
244
+ _response_types_map: Dict[str, Optional[str]] = {
245
+ '200': "GenerateCertificateResponse",
246
+ '400': None,
247
+ '500': None,
248
+ '422': "HTTPValidationError",
249
+ }
250
+ response_data = self.api_client.call_api(
251
+ *_param,
252
+ _request_timeout=_request_timeout
253
+ )
254
+ return response_data.response
255
+
256
+
257
+ def _generer_certificat_test_api_v1_traitement_generer_certificat_test_post_serialize(
258
+ self,
259
+ generate_certificate_request,
260
+ _request_auth,
261
+ _content_type,
262
+ _headers,
263
+ _host_index,
264
+ ) -> RequestSerialized:
265
+
266
+ _host = None
267
+
268
+ _collection_formats: Dict[str, str] = {
269
+ }
270
+
271
+ _path_params: Dict[str, str] = {}
272
+ _query_params: List[Tuple[str, str]] = []
273
+ _header_params: Dict[str, Optional[str]] = _headers or {}
274
+ _form_params: List[Tuple[str, str]] = []
275
+ _files: Dict[
276
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
277
+ ] = {}
278
+ _body_params: Optional[bytes] = None
279
+
280
+ # process the path parameters
281
+ # process the query parameters
282
+ # process the header parameters
283
+ # process the form parameters
284
+ # process the body parameter
285
+ if generate_certificate_request is not None:
286
+ _body_params = generate_certificate_request
287
+
288
+
289
+ # set the HTTP header `Accept`
290
+ if 'Accept' not in _header_params:
291
+ _header_params['Accept'] = self.api_client.select_header_accept(
292
+ [
293
+ 'application/json'
294
+ ]
295
+ )
296
+
297
+ # set the HTTP header `Content-Type`
298
+ if _content_type:
299
+ _header_params['Content-Type'] = _content_type
300
+ else:
301
+ _default_content_type = (
302
+ self.api_client.select_header_content_type(
303
+ [
304
+ 'application/json'
305
+ ]
306
+ )
307
+ )
308
+ if _default_content_type is not None:
309
+ _header_params['Content-Type'] = _default_content_type
310
+
311
+ # authentication setting
312
+ _auth_settings: List[str] = [
313
+ 'HTTPBearer'
314
+ ]
315
+
316
+ return self.api_client.param_serialize(
317
+ method='POST',
318
+ resource_path='/api/v1/traitement/generer-certificat-test',
319
+ path_params=_path_params,
320
+ query_params=_query_params,
321
+ header_params=_header_params,
322
+ body=_body_params,
323
+ post_params=_form_params,
324
+ files=_files,
325
+ auth_settings=_auth_settings,
326
+ collection_formats=_collection_formats,
327
+ _host=_host,
328
+ _request_auth=_request_auth
329
+ )
330
+
331
+
332
+
333
+
334
+ @validate_call
335
+ def generer_facture_api_v1_traitement_generer_facture_post(
336
+ self,
337
+ donnees_facture: Annotated[StrictStr, Field(description="Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement ! ")],
338
+ profil: Annotated[Optional[ProfilAPI], Field(description="Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED.")] = None,
339
+ format_sortie: Annotated[Optional[FormatSortie], Field(description="Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué).")] = None,
340
+ auto_enrichir: Annotated[Optional[StrictBool], Field(description="🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement)")] = None,
341
+ source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
342
+ _request_timeout: Union[
343
+ None,
344
+ Annotated[StrictFloat, Field(gt=0)],
345
+ Tuple[
346
+ Annotated[StrictFloat, Field(gt=0)],
347
+ Annotated[StrictFloat, Field(gt=0)]
348
+ ]
349
+ ] = None,
350
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
351
+ _content_type: Optional[StrictStr] = None,
352
+ _headers: Optional[Dict[StrictStr, Any]] = None,
353
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
354
+ ) -> ReponseTache:
355
+ """Générer une facture Factur-X
356
+
357
+ Génère une facture électronique au format Factur-X conforme aux normes européennes. ## Normes appliquées - **Factur-X** (France) : Norme FNFE-MPE (Forum National de la Facture Électronique) - **ZUGFeRD** (Allemagne) : Format allemand compatible Factur-X - **EN 16931** : Norme sémantique européenne pour la facturation électronique - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Cross Industry Invoice (CII)** : Syntaxe XML UN/CEFACT ## 🆕 Nouveau : Format simplifié avec auto-enrichissement (P0.1) Vous pouvez désormais créer une facture en fournissant uniquement : - Un numéro de facture - Un SIRET émetteur + **IBAN** (obligatoire) - Un SIRET destinataire - Les lignes de facture (description, quantité, prix HT) **Exemple format simplifié** : ```json { \"numero\": \"FACT-2025-001\", \"emetteur\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"destinataire\": {\"siret\": \"35600000000048\"}, \"lignes\": [ {\"description\": \"Prestation\", \"quantite\": 10, \"prix_ht\": 100.00, \"tva\": 20.0} ] } ``` **⚠️ Champs obligatoires (format simplifié)** : - `numero` : Numéro de facture unique - `emetteur.siret` : SIRET de l'émetteur (14 chiffres) - `emetteur.iban` : IBAN du compte bancaire (pas d'API publique pour le récupérer) - `destinataire.siret` : SIRET du destinataire - `lignes[]` : Au moins une ligne de facture **Ce qui se passe automatiquement avec `auto_enrichir=True`** : - ✅ Enrichissement des noms depuis API Chorus Pro - ✅ Enrichissement des adresses depuis API Recherche Entreprises (gratuite, publique) - ✅ Calcul automatique de la TVA intracommunautaire (FR + clé + SIREN) - ✅ Récupération de l'ID Chorus Pro pour la facturation électronique - ✅ Calcul des totaux HT/TVA/TTC - ✅ Génération des dates (aujourd'hui + échéance 30j) - ✅ Gestion multi-taux de TVA **Identifiants supportés** : - SIRET (14 chiffres) : Établissement précis ⭐ Recommandé - SIREN (9 chiffres) : Entreprise (sélection auto du siège) - Types spéciaux : UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Contrôles effectués lors de la génération ### 1. Validation des données (Pydantic) - Types de données (montants en Decimal, dates ISO 8601) - Formats (SIRET 14 chiffres, SIREN 9 chiffres, IBAN) - Champs obligatoires selon le profil - Cohérence des montants (HT + TVA = TTC) ### 2. Génération XML conforme CII - Sérialisation selon schéma XSD Cross Industry Invoice - Namespaces UN/CEFACT corrects - Structure hiérarchique respectée - Encodage UTF-8 sans BOM ### 3. Validation Schematron - Règles métier du profil sélectionné (MINIMUM, BASIC, EN16931, EXTENDED) - Cardinalité des éléments (obligatoire, optionnel, répétable) - Règles de calcul (totaux, TVA, remises) - Conformité européenne EN 16931 ### 4. Conversion PDF/A-3 (si format_sortie='pdf') - Conversion du PDF source en PDF/A-3 via Ghostscript - Embarquement du XML Factur-X dans le PDF - Métadonnées XMP conformes - Profil ICC sRGB pour les couleurs - Suppression des éléments interdits (JavaScript, formulaires) ## Fonctionnement 1. **Soumission** : La facture est mise en file d'attente Celery pour traitement asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202 Accepted) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Formats de sortie - **xml** : Génère uniquement le XML Factur-X (recommandé pour les tests) - **pdf** : Génère un PDF/A-3 avec XML embarqué (nécessite `source_pdf`) ## Profils Factur-X - **MINIMUM** : Données minimales (facture simplifiée) - **BASIC** : Informations de base (PME) - **EN16931** : Standard européen (recommandé, conforme directive 2014/55/UE) - **EXTENDED** : Toutes les données disponibles (grands comptes) ## Ce que vous obtenez Après traitement réussi (statut `completed`) : - **XML seul** : Fichier XML encodé base64 conforme Factur-X - **PDF/A-3** : PDF avec XML embarqué, prêt pour envoi/archivage - **Métadonnées** : Profil, version Factur-X, taille fichier - **Validation** : Confirmation de conformité Schematron ## Validation Les données sont validées automatiquement selon le format détecté. En cas d'erreur, un statut 422 est retourné avec les détails des champs invalides.
358
+
359
+ :param donnees_facture: Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement ! (required)
360
+ :type donnees_facture: str
361
+ :param profil: Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED.
362
+ :type profil: ProfilAPI
363
+ :param format_sortie: Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué).
364
+ :type format_sortie: FormatSortie
365
+ :param auto_enrichir: 🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement)
366
+ :type auto_enrichir: bool
367
+ :param source_pdf:
368
+ :type source_pdf: bytearray
369
+ :param _request_timeout: timeout setting for this request. If one
370
+ number provided, it will be total request
371
+ timeout. It can also be a pair (tuple) of
372
+ (connection, read) timeouts.
373
+ :type _request_timeout: int, tuple(int, int), optional
374
+ :param _request_auth: set to override the auth_settings for an a single
375
+ request; this effectively ignores the
376
+ authentication in the spec for a single request.
377
+ :type _request_auth: dict, optional
378
+ :param _content_type: force content-type for the request.
379
+ :type _content_type: str, Optional
380
+ :param _headers: set to override the headers for a single
381
+ request; this effectively ignores the headers
382
+ in the spec for a single request.
383
+ :type _headers: dict, optional
384
+ :param _host_index: set to override the host_index for a single
385
+ request; this effectively ignores the host_index
386
+ in the spec for a single request.
387
+ :type _host_index: int, optional
388
+ :return: Returns the result object.
389
+ """ # noqa: E501
390
+
391
+ _param = self._generer_facture_api_v1_traitement_generer_facture_post_serialize(
392
+ donnees_facture=donnees_facture,
393
+ profil=profil,
394
+ format_sortie=format_sortie,
395
+ auto_enrichir=auto_enrichir,
396
+ source_pdf=source_pdf,
397
+ _request_auth=_request_auth,
398
+ _content_type=_content_type,
399
+ _headers=_headers,
400
+ _host_index=_host_index
401
+ )
402
+
403
+ _response_types_map: Dict[str, Optional[str]] = {
404
+ '202': "ReponseTache",
405
+ '400': None,
406
+ '422': None,
407
+ }
408
+ response_data = self.api_client.call_api(
409
+ *_param,
410
+ _request_timeout=_request_timeout
411
+ )
412
+ response_data.read()
413
+ return self.api_client.response_deserialize(
414
+ response_data=response_data,
415
+ response_types_map=_response_types_map,
416
+ ).data
417
+
418
+
419
+ @validate_call
420
+ def generer_facture_api_v1_traitement_generer_facture_post_with_http_info(
421
+ self,
422
+ donnees_facture: Annotated[StrictStr, Field(description="Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement ! ")],
423
+ profil: Annotated[Optional[ProfilAPI], Field(description="Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED.")] = None,
424
+ format_sortie: Annotated[Optional[FormatSortie], Field(description="Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué).")] = None,
425
+ auto_enrichir: Annotated[Optional[StrictBool], Field(description="🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement)")] = None,
426
+ source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
427
+ _request_timeout: Union[
428
+ None,
429
+ Annotated[StrictFloat, Field(gt=0)],
430
+ Tuple[
431
+ Annotated[StrictFloat, Field(gt=0)],
432
+ Annotated[StrictFloat, Field(gt=0)]
433
+ ]
434
+ ] = None,
435
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
436
+ _content_type: Optional[StrictStr] = None,
437
+ _headers: Optional[Dict[StrictStr, Any]] = None,
438
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
439
+ ) -> ApiResponse[ReponseTache]:
440
+ """Générer une facture Factur-X
441
+
442
+ Génère une facture électronique au format Factur-X conforme aux normes européennes. ## Normes appliquées - **Factur-X** (France) : Norme FNFE-MPE (Forum National de la Facture Électronique) - **ZUGFeRD** (Allemagne) : Format allemand compatible Factur-X - **EN 16931** : Norme sémantique européenne pour la facturation électronique - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Cross Industry Invoice (CII)** : Syntaxe XML UN/CEFACT ## 🆕 Nouveau : Format simplifié avec auto-enrichissement (P0.1) Vous pouvez désormais créer une facture en fournissant uniquement : - Un numéro de facture - Un SIRET émetteur + **IBAN** (obligatoire) - Un SIRET destinataire - Les lignes de facture (description, quantité, prix HT) **Exemple format simplifié** : ```json { \"numero\": \"FACT-2025-001\", \"emetteur\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"destinataire\": {\"siret\": \"35600000000048\"}, \"lignes\": [ {\"description\": \"Prestation\", \"quantite\": 10, \"prix_ht\": 100.00, \"tva\": 20.0} ] } ``` **⚠️ Champs obligatoires (format simplifié)** : - `numero` : Numéro de facture unique - `emetteur.siret` : SIRET de l'émetteur (14 chiffres) - `emetteur.iban` : IBAN du compte bancaire (pas d'API publique pour le récupérer) - `destinataire.siret` : SIRET du destinataire - `lignes[]` : Au moins une ligne de facture **Ce qui se passe automatiquement avec `auto_enrichir=True`** : - ✅ Enrichissement des noms depuis API Chorus Pro - ✅ Enrichissement des adresses depuis API Recherche Entreprises (gratuite, publique) - ✅ Calcul automatique de la TVA intracommunautaire (FR + clé + SIREN) - ✅ Récupération de l'ID Chorus Pro pour la facturation électronique - ✅ Calcul des totaux HT/TVA/TTC - ✅ Génération des dates (aujourd'hui + échéance 30j) - ✅ Gestion multi-taux de TVA **Identifiants supportés** : - SIRET (14 chiffres) : Établissement précis ⭐ Recommandé - SIREN (9 chiffres) : Entreprise (sélection auto du siège) - Types spéciaux : UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Contrôles effectués lors de la génération ### 1. Validation des données (Pydantic) - Types de données (montants en Decimal, dates ISO 8601) - Formats (SIRET 14 chiffres, SIREN 9 chiffres, IBAN) - Champs obligatoires selon le profil - Cohérence des montants (HT + TVA = TTC) ### 2. Génération XML conforme CII - Sérialisation selon schéma XSD Cross Industry Invoice - Namespaces UN/CEFACT corrects - Structure hiérarchique respectée - Encodage UTF-8 sans BOM ### 3. Validation Schematron - Règles métier du profil sélectionné (MINIMUM, BASIC, EN16931, EXTENDED) - Cardinalité des éléments (obligatoire, optionnel, répétable) - Règles de calcul (totaux, TVA, remises) - Conformité européenne EN 16931 ### 4. Conversion PDF/A-3 (si format_sortie='pdf') - Conversion du PDF source en PDF/A-3 via Ghostscript - Embarquement du XML Factur-X dans le PDF - Métadonnées XMP conformes - Profil ICC sRGB pour les couleurs - Suppression des éléments interdits (JavaScript, formulaires) ## Fonctionnement 1. **Soumission** : La facture est mise en file d'attente Celery pour traitement asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202 Accepted) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Formats de sortie - **xml** : Génère uniquement le XML Factur-X (recommandé pour les tests) - **pdf** : Génère un PDF/A-3 avec XML embarqué (nécessite `source_pdf`) ## Profils Factur-X - **MINIMUM** : Données minimales (facture simplifiée) - **BASIC** : Informations de base (PME) - **EN16931** : Standard européen (recommandé, conforme directive 2014/55/UE) - **EXTENDED** : Toutes les données disponibles (grands comptes) ## Ce que vous obtenez Après traitement réussi (statut `completed`) : - **XML seul** : Fichier XML encodé base64 conforme Factur-X - **PDF/A-3** : PDF avec XML embarqué, prêt pour envoi/archivage - **Métadonnées** : Profil, version Factur-X, taille fichier - **Validation** : Confirmation de conformité Schematron ## Validation Les données sont validées automatiquement selon le format détecté. En cas d'erreur, un statut 422 est retourné avec les détails des champs invalides.
443
+
444
+ :param donnees_facture: Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement ! (required)
445
+ :type donnees_facture: str
446
+ :param profil: Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED.
447
+ :type profil: ProfilAPI
448
+ :param format_sortie: Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué).
449
+ :type format_sortie: FormatSortie
450
+ :param auto_enrichir: 🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement)
451
+ :type auto_enrichir: bool
452
+ :param source_pdf:
453
+ :type source_pdf: bytearray
454
+ :param _request_timeout: timeout setting for this request. If one
455
+ number provided, it will be total request
456
+ timeout. It can also be a pair (tuple) of
457
+ (connection, read) timeouts.
458
+ :type _request_timeout: int, tuple(int, int), optional
459
+ :param _request_auth: set to override the auth_settings for an a single
460
+ request; this effectively ignores the
461
+ authentication in the spec for a single request.
462
+ :type _request_auth: dict, optional
463
+ :param _content_type: force content-type for the request.
464
+ :type _content_type: str, Optional
465
+ :param _headers: set to override the headers for a single
466
+ request; this effectively ignores the headers
467
+ in the spec for a single request.
468
+ :type _headers: dict, optional
469
+ :param _host_index: set to override the host_index for a single
470
+ request; this effectively ignores the host_index
471
+ in the spec for a single request.
472
+ :type _host_index: int, optional
473
+ :return: Returns the result object.
474
+ """ # noqa: E501
475
+
476
+ _param = self._generer_facture_api_v1_traitement_generer_facture_post_serialize(
477
+ donnees_facture=donnees_facture,
478
+ profil=profil,
479
+ format_sortie=format_sortie,
480
+ auto_enrichir=auto_enrichir,
481
+ source_pdf=source_pdf,
482
+ _request_auth=_request_auth,
483
+ _content_type=_content_type,
484
+ _headers=_headers,
485
+ _host_index=_host_index
486
+ )
487
+
488
+ _response_types_map: Dict[str, Optional[str]] = {
489
+ '202': "ReponseTache",
490
+ '400': None,
491
+ '422': None,
492
+ }
493
+ response_data = self.api_client.call_api(
494
+ *_param,
495
+ _request_timeout=_request_timeout
496
+ )
497
+ response_data.read()
498
+ return self.api_client.response_deserialize(
499
+ response_data=response_data,
500
+ response_types_map=_response_types_map,
501
+ )
502
+
503
+
504
+ @validate_call
505
+ def generer_facture_api_v1_traitement_generer_facture_post_without_preload_content(
506
+ self,
507
+ donnees_facture: Annotated[StrictStr, Field(description="Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement ! ")],
508
+ profil: Annotated[Optional[ProfilAPI], Field(description="Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED.")] = None,
509
+ format_sortie: Annotated[Optional[FormatSortie], Field(description="Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué).")] = None,
510
+ auto_enrichir: Annotated[Optional[StrictBool], Field(description="🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement)")] = None,
511
+ source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
512
+ _request_timeout: Union[
513
+ None,
514
+ Annotated[StrictFloat, Field(gt=0)],
515
+ Tuple[
516
+ Annotated[StrictFloat, Field(gt=0)],
517
+ Annotated[StrictFloat, Field(gt=0)]
518
+ ]
519
+ ] = None,
520
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
521
+ _content_type: Optional[StrictStr] = None,
522
+ _headers: Optional[Dict[StrictStr, Any]] = None,
523
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
524
+ ) -> RESTResponseType:
525
+ """Générer une facture Factur-X
526
+
527
+ Génère une facture électronique au format Factur-X conforme aux normes européennes. ## Normes appliquées - **Factur-X** (France) : Norme FNFE-MPE (Forum National de la Facture Électronique) - **ZUGFeRD** (Allemagne) : Format allemand compatible Factur-X - **EN 16931** : Norme sémantique européenne pour la facturation électronique - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Cross Industry Invoice (CII)** : Syntaxe XML UN/CEFACT ## 🆕 Nouveau : Format simplifié avec auto-enrichissement (P0.1) Vous pouvez désormais créer une facture en fournissant uniquement : - Un numéro de facture - Un SIRET émetteur + **IBAN** (obligatoire) - Un SIRET destinataire - Les lignes de facture (description, quantité, prix HT) **Exemple format simplifié** : ```json { \"numero\": \"FACT-2025-001\", \"emetteur\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"destinataire\": {\"siret\": \"35600000000048\"}, \"lignes\": [ {\"description\": \"Prestation\", \"quantite\": 10, \"prix_ht\": 100.00, \"tva\": 20.0} ] } ``` **⚠️ Champs obligatoires (format simplifié)** : - `numero` : Numéro de facture unique - `emetteur.siret` : SIRET de l'émetteur (14 chiffres) - `emetteur.iban` : IBAN du compte bancaire (pas d'API publique pour le récupérer) - `destinataire.siret` : SIRET du destinataire - `lignes[]` : Au moins une ligne de facture **Ce qui se passe automatiquement avec `auto_enrichir=True`** : - ✅ Enrichissement des noms depuis API Chorus Pro - ✅ Enrichissement des adresses depuis API Recherche Entreprises (gratuite, publique) - ✅ Calcul automatique de la TVA intracommunautaire (FR + clé + SIREN) - ✅ Récupération de l'ID Chorus Pro pour la facturation électronique - ✅ Calcul des totaux HT/TVA/TTC - ✅ Génération des dates (aujourd'hui + échéance 30j) - ✅ Gestion multi-taux de TVA **Identifiants supportés** : - SIRET (14 chiffres) : Établissement précis ⭐ Recommandé - SIREN (9 chiffres) : Entreprise (sélection auto du siège) - Types spéciaux : UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Contrôles effectués lors de la génération ### 1. Validation des données (Pydantic) - Types de données (montants en Decimal, dates ISO 8601) - Formats (SIRET 14 chiffres, SIREN 9 chiffres, IBAN) - Champs obligatoires selon le profil - Cohérence des montants (HT + TVA = TTC) ### 2. Génération XML conforme CII - Sérialisation selon schéma XSD Cross Industry Invoice - Namespaces UN/CEFACT corrects - Structure hiérarchique respectée - Encodage UTF-8 sans BOM ### 3. Validation Schematron - Règles métier du profil sélectionné (MINIMUM, BASIC, EN16931, EXTENDED) - Cardinalité des éléments (obligatoire, optionnel, répétable) - Règles de calcul (totaux, TVA, remises) - Conformité européenne EN 16931 ### 4. Conversion PDF/A-3 (si format_sortie='pdf') - Conversion du PDF source en PDF/A-3 via Ghostscript - Embarquement du XML Factur-X dans le PDF - Métadonnées XMP conformes - Profil ICC sRGB pour les couleurs - Suppression des éléments interdits (JavaScript, formulaires) ## Fonctionnement 1. **Soumission** : La facture est mise en file d'attente Celery pour traitement asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202 Accepted) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Formats de sortie - **xml** : Génère uniquement le XML Factur-X (recommandé pour les tests) - **pdf** : Génère un PDF/A-3 avec XML embarqué (nécessite `source_pdf`) ## Profils Factur-X - **MINIMUM** : Données minimales (facture simplifiée) - **BASIC** : Informations de base (PME) - **EN16931** : Standard européen (recommandé, conforme directive 2014/55/UE) - **EXTENDED** : Toutes les données disponibles (grands comptes) ## Ce que vous obtenez Après traitement réussi (statut `completed`) : - **XML seul** : Fichier XML encodé base64 conforme Factur-X - **PDF/A-3** : PDF avec XML embarqué, prêt pour envoi/archivage - **Métadonnées** : Profil, version Factur-X, taille fichier - **Validation** : Confirmation de conformité Schematron ## Validation Les données sont validées automatiquement selon le format détecté. En cas d'erreur, un statut 422 est retourné avec les détails des champs invalides.
528
+
529
+ :param donnees_facture: Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement ! (required)
530
+ :type donnees_facture: str
531
+ :param profil: Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED.
532
+ :type profil: ProfilAPI
533
+ :param format_sortie: Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué).
534
+ :type format_sortie: FormatSortie
535
+ :param auto_enrichir: 🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement)
536
+ :type auto_enrichir: bool
537
+ :param source_pdf:
538
+ :type source_pdf: bytearray
539
+ :param _request_timeout: timeout setting for this request. If one
540
+ number provided, it will be total request
541
+ timeout. It can also be a pair (tuple) of
542
+ (connection, read) timeouts.
543
+ :type _request_timeout: int, tuple(int, int), optional
544
+ :param _request_auth: set to override the auth_settings for an a single
545
+ request; this effectively ignores the
546
+ authentication in the spec for a single request.
547
+ :type _request_auth: dict, optional
548
+ :param _content_type: force content-type for the request.
549
+ :type _content_type: str, Optional
550
+ :param _headers: set to override the headers for a single
551
+ request; this effectively ignores the headers
552
+ in the spec for a single request.
553
+ :type _headers: dict, optional
554
+ :param _host_index: set to override the host_index for a single
555
+ request; this effectively ignores the host_index
556
+ in the spec for a single request.
557
+ :type _host_index: int, optional
558
+ :return: Returns the result object.
559
+ """ # noqa: E501
560
+
561
+ _param = self._generer_facture_api_v1_traitement_generer_facture_post_serialize(
562
+ donnees_facture=donnees_facture,
563
+ profil=profil,
564
+ format_sortie=format_sortie,
565
+ auto_enrichir=auto_enrichir,
566
+ source_pdf=source_pdf,
567
+ _request_auth=_request_auth,
568
+ _content_type=_content_type,
569
+ _headers=_headers,
570
+ _host_index=_host_index
571
+ )
572
+
573
+ _response_types_map: Dict[str, Optional[str]] = {
574
+ '202': "ReponseTache",
575
+ '400': None,
576
+ '422': None,
577
+ }
578
+ response_data = self.api_client.call_api(
579
+ *_param,
580
+ _request_timeout=_request_timeout
581
+ )
582
+ return response_data.response
583
+
584
+
585
+ def _generer_facture_api_v1_traitement_generer_facture_post_serialize(
586
+ self,
587
+ donnees_facture,
588
+ profil,
589
+ format_sortie,
590
+ auto_enrichir,
591
+ source_pdf,
592
+ _request_auth,
593
+ _content_type,
594
+ _headers,
595
+ _host_index,
596
+ ) -> RequestSerialized:
597
+
598
+ _host = None
599
+
600
+ _collection_formats: Dict[str, str] = {
601
+ }
602
+
603
+ _path_params: Dict[str, str] = {}
604
+ _query_params: List[Tuple[str, str]] = []
605
+ _header_params: Dict[str, Optional[str]] = _headers or {}
606
+ _form_params: List[Tuple[str, str]] = []
607
+ _files: Dict[
608
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
609
+ ] = {}
610
+ _body_params: Optional[bytes] = None
611
+
612
+ # process the path parameters
613
+ # process the query parameters
614
+ # process the header parameters
615
+ # process the form parameters
616
+ if donnees_facture is not None:
617
+ _form_params.append(('donnees_facture', donnees_facture))
618
+ if profil is not None:
619
+ _form_params.append(('profil', profil))
620
+ if format_sortie is not None:
621
+ _form_params.append(('format_sortie', format_sortie))
622
+ if auto_enrichir is not None:
623
+ _form_params.append(('auto_enrichir', auto_enrichir))
624
+ if source_pdf is not None:
625
+ _files['source_pdf'] = source_pdf
626
+ # process the body parameter
627
+
628
+
629
+ # set the HTTP header `Accept`
630
+ if 'Accept' not in _header_params:
631
+ _header_params['Accept'] = self.api_client.select_header_accept(
632
+ [
633
+ 'application/json'
634
+ ]
635
+ )
636
+
637
+ # set the HTTP header `Content-Type`
638
+ if _content_type:
639
+ _header_params['Content-Type'] = _content_type
640
+ else:
641
+ _default_content_type = (
642
+ self.api_client.select_header_content_type(
643
+ [
644
+ 'multipart/form-data'
645
+ ]
646
+ )
647
+ )
648
+ if _default_content_type is not None:
649
+ _header_params['Content-Type'] = _default_content_type
650
+
651
+ # authentication setting
652
+ _auth_settings: List[str] = [
653
+ 'HTTPBearer'
654
+ ]
655
+
656
+ return self.api_client.param_serialize(
657
+ method='POST',
658
+ resource_path='/api/v1/traitement/generer-facture',
659
+ path_params=_path_params,
660
+ query_params=_query_params,
661
+ header_params=_header_params,
662
+ body=_body_params,
663
+ post_params=_form_params,
664
+ files=_files,
665
+ auth_settings=_auth_settings,
666
+ collection_formats=_collection_formats,
667
+ _host=_host,
668
+ _request_auth=_request_auth
669
+ )
670
+
671
+
672
+
673
+
674
+ @validate_call
675
+ def obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get(
676
+ self,
677
+ id_tache: StrictStr,
678
+ _request_timeout: Union[
679
+ None,
680
+ Annotated[StrictFloat, Field(gt=0)],
681
+ Tuple[
682
+ Annotated[StrictFloat, Field(gt=0)],
683
+ Annotated[StrictFloat, Field(gt=0)]
684
+ ]
685
+ ] = None,
686
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
687
+ _content_type: Optional[StrictStr] = None,
688
+ _headers: Optional[Dict[StrictStr, Any]] = None,
689
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
690
+ ) -> StatutTache:
691
+ """Obtenir le statut d'une tâche de génération
692
+
693
+ Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles - **PENDING** : Tâche en attente de traitement - **STARTED** : Tâche en cours d'exécution - **SUCCESS** : Tâche terminée (vérifier `resultat.statut` pour le résultat réel) - **FAILURE** : Erreur système lors de l'exécution - **RETRY** : Tentative de ré-exécution en cours ## Champ resultat Quand la tâche est terminée (SUCCESS), le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" - `chemin_fichier` : Chemin du fichier généré (si succès) - `message_erreur` : Détails de l'erreur (si échec) ## Usage Appelez cet endpoint en boucle (polling) toutes les 2-3 secondes jusqu'à ce que le statut soit SUCCESS ou FAILURE.
694
+
695
+ :param id_tache: (required)
696
+ :type id_tache: str
697
+ :param _request_timeout: timeout setting for this request. If one
698
+ number provided, it will be total request
699
+ timeout. It can also be a pair (tuple) of
700
+ (connection, read) timeouts.
701
+ :type _request_timeout: int, tuple(int, int), optional
702
+ :param _request_auth: set to override the auth_settings for an a single
703
+ request; this effectively ignores the
704
+ authentication in the spec for a single request.
705
+ :type _request_auth: dict, optional
706
+ :param _content_type: force content-type for the request.
707
+ :type _content_type: str, Optional
708
+ :param _headers: set to override the headers for a single
709
+ request; this effectively ignores the headers
710
+ in the spec for a single request.
711
+ :type _headers: dict, optional
712
+ :param _host_index: set to override the host_index for a single
713
+ request; this effectively ignores the host_index
714
+ in the spec for a single request.
715
+ :type _host_index: int, optional
716
+ :return: Returns the result object.
717
+ """ # noqa: E501
718
+
719
+ _param = self._obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_serialize(
720
+ id_tache=id_tache,
721
+ _request_auth=_request_auth,
722
+ _content_type=_content_type,
723
+ _headers=_headers,
724
+ _host_index=_host_index
725
+ )
726
+
727
+ _response_types_map: Dict[str, Optional[str]] = {
728
+ '200': "StatutTache",
729
+ '422': "HTTPValidationError",
730
+ }
731
+ response_data = self.api_client.call_api(
732
+ *_param,
733
+ _request_timeout=_request_timeout
734
+ )
735
+ response_data.read()
736
+ return self.api_client.response_deserialize(
737
+ response_data=response_data,
738
+ response_types_map=_response_types_map,
739
+ ).data
740
+
741
+
742
+ @validate_call
743
+ def obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_with_http_info(
744
+ self,
745
+ id_tache: StrictStr,
746
+ _request_timeout: Union[
747
+ None,
748
+ Annotated[StrictFloat, Field(gt=0)],
749
+ Tuple[
750
+ Annotated[StrictFloat, Field(gt=0)],
751
+ Annotated[StrictFloat, Field(gt=0)]
752
+ ]
753
+ ] = None,
754
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
755
+ _content_type: Optional[StrictStr] = None,
756
+ _headers: Optional[Dict[StrictStr, Any]] = None,
757
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
758
+ ) -> ApiResponse[StatutTache]:
759
+ """Obtenir le statut d'une tâche de génération
760
+
761
+ Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles - **PENDING** : Tâche en attente de traitement - **STARTED** : Tâche en cours d'exécution - **SUCCESS** : Tâche terminée (vérifier `resultat.statut` pour le résultat réel) - **FAILURE** : Erreur système lors de l'exécution - **RETRY** : Tentative de ré-exécution en cours ## Champ resultat Quand la tâche est terminée (SUCCESS), le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" - `chemin_fichier` : Chemin du fichier généré (si succès) - `message_erreur` : Détails de l'erreur (si échec) ## Usage Appelez cet endpoint en boucle (polling) toutes les 2-3 secondes jusqu'à ce que le statut soit SUCCESS ou FAILURE.
762
+
763
+ :param id_tache: (required)
764
+ :type id_tache: str
765
+ :param _request_timeout: timeout setting for this request. If one
766
+ number provided, it will be total request
767
+ timeout. It can also be a pair (tuple) of
768
+ (connection, read) timeouts.
769
+ :type _request_timeout: int, tuple(int, int), optional
770
+ :param _request_auth: set to override the auth_settings for an a single
771
+ request; this effectively ignores the
772
+ authentication in the spec for a single request.
773
+ :type _request_auth: dict, optional
774
+ :param _content_type: force content-type for the request.
775
+ :type _content_type: str, Optional
776
+ :param _headers: set to override the headers for a single
777
+ request; this effectively ignores the headers
778
+ in the spec for a single request.
779
+ :type _headers: dict, optional
780
+ :param _host_index: set to override the host_index for a single
781
+ request; this effectively ignores the host_index
782
+ in the spec for a single request.
783
+ :type _host_index: int, optional
784
+ :return: Returns the result object.
785
+ """ # noqa: E501
786
+
787
+ _param = self._obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_serialize(
788
+ id_tache=id_tache,
789
+ _request_auth=_request_auth,
790
+ _content_type=_content_type,
791
+ _headers=_headers,
792
+ _host_index=_host_index
793
+ )
794
+
795
+ _response_types_map: Dict[str, Optional[str]] = {
796
+ '200': "StatutTache",
797
+ '422': "HTTPValidationError",
798
+ }
799
+ response_data = self.api_client.call_api(
800
+ *_param,
801
+ _request_timeout=_request_timeout
802
+ )
803
+ response_data.read()
804
+ return self.api_client.response_deserialize(
805
+ response_data=response_data,
806
+ response_types_map=_response_types_map,
807
+ )
808
+
809
+
810
+ @validate_call
811
+ def obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_without_preload_content(
812
+ self,
813
+ id_tache: StrictStr,
814
+ _request_timeout: Union[
815
+ None,
816
+ Annotated[StrictFloat, Field(gt=0)],
817
+ Tuple[
818
+ Annotated[StrictFloat, Field(gt=0)],
819
+ Annotated[StrictFloat, Field(gt=0)]
820
+ ]
821
+ ] = None,
822
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
823
+ _content_type: Optional[StrictStr] = None,
824
+ _headers: Optional[Dict[StrictStr, Any]] = None,
825
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
826
+ ) -> RESTResponseType:
827
+ """Obtenir le statut d'une tâche de génération
828
+
829
+ Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles - **PENDING** : Tâche en attente de traitement - **STARTED** : Tâche en cours d'exécution - **SUCCESS** : Tâche terminée (vérifier `resultat.statut` pour le résultat réel) - **FAILURE** : Erreur système lors de l'exécution - **RETRY** : Tentative de ré-exécution en cours ## Champ resultat Quand la tâche est terminée (SUCCESS), le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" - `chemin_fichier` : Chemin du fichier généré (si succès) - `message_erreur` : Détails de l'erreur (si échec) ## Usage Appelez cet endpoint en boucle (polling) toutes les 2-3 secondes jusqu'à ce que le statut soit SUCCESS ou FAILURE.
830
+
831
+ :param id_tache: (required)
832
+ :type id_tache: str
833
+ :param _request_timeout: timeout setting for this request. If one
834
+ number provided, it will be total request
835
+ timeout. It can also be a pair (tuple) of
836
+ (connection, read) timeouts.
837
+ :type _request_timeout: int, tuple(int, int), optional
838
+ :param _request_auth: set to override the auth_settings for an a single
839
+ request; this effectively ignores the
840
+ authentication in the spec for a single request.
841
+ :type _request_auth: dict, optional
842
+ :param _content_type: force content-type for the request.
843
+ :type _content_type: str, Optional
844
+ :param _headers: set to override the headers for a single
845
+ request; this effectively ignores the headers
846
+ in the spec for a single request.
847
+ :type _headers: dict, optional
848
+ :param _host_index: set to override the host_index for a single
849
+ request; this effectively ignores the host_index
850
+ in the spec for a single request.
851
+ :type _host_index: int, optional
852
+ :return: Returns the result object.
853
+ """ # noqa: E501
854
+
855
+ _param = self._obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_serialize(
856
+ id_tache=id_tache,
857
+ _request_auth=_request_auth,
858
+ _content_type=_content_type,
859
+ _headers=_headers,
860
+ _host_index=_host_index
861
+ )
862
+
863
+ _response_types_map: Dict[str, Optional[str]] = {
864
+ '200': "StatutTache",
865
+ '422': "HTTPValidationError",
866
+ }
867
+ response_data = self.api_client.call_api(
868
+ *_param,
869
+ _request_timeout=_request_timeout
870
+ )
871
+ return response_data.response
872
+
873
+
874
+ def _obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_serialize(
875
+ self,
876
+ id_tache,
877
+ _request_auth,
878
+ _content_type,
879
+ _headers,
880
+ _host_index,
881
+ ) -> RequestSerialized:
882
+
883
+ _host = None
884
+
885
+ _collection_formats: Dict[str, str] = {
886
+ }
887
+
888
+ _path_params: Dict[str, str] = {}
889
+ _query_params: List[Tuple[str, str]] = []
890
+ _header_params: Dict[str, Optional[str]] = _headers or {}
891
+ _form_params: List[Tuple[str, str]] = []
892
+ _files: Dict[
893
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
894
+ ] = {}
895
+ _body_params: Optional[bytes] = None
896
+
897
+ # process the path parameters
898
+ if id_tache is not None:
899
+ _path_params['id_tache'] = id_tache
900
+ # process the query parameters
901
+ # process the header parameters
902
+ # process the form parameters
903
+ # process the body parameter
904
+
905
+
906
+ # set the HTTP header `Accept`
907
+ if 'Accept' not in _header_params:
908
+ _header_params['Accept'] = self.api_client.select_header_accept(
909
+ [
910
+ 'application/json'
911
+ ]
912
+ )
913
+
914
+
915
+ # authentication setting
916
+ _auth_settings: List[str] = [
917
+ 'HTTPBearer'
918
+ ]
919
+
920
+ return self.api_client.param_serialize(
921
+ method='GET',
922
+ resource_path='/api/v1/traitement/taches/{id_tache}/statut',
923
+ path_params=_path_params,
924
+ query_params=_query_params,
925
+ header_params=_header_params,
926
+ body=_body_params,
927
+ post_params=_form_params,
928
+ files=_files,
929
+ auth_settings=_auth_settings,
930
+ collection_formats=_collection_formats,
931
+ _host=_host,
932
+ _request_auth=_request_auth
933
+ )
934
+
935
+
936
+
937
+
938
+ @validate_call
939
+ def signer_pdf_api_v1_traitement_signer_pdf_post(
940
+ self,
941
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à signer (sera traité puis retourné signé en base64)")],
942
+ raison: Optional[StrictStr] = None,
943
+ localisation: Optional[StrictStr] = None,
944
+ contact: Optional[StrictStr] = None,
945
+ field_name: Annotated[Optional[StrictStr], Field(description="Nom du champ de signature PDF")] = None,
946
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.")] = None,
947
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)")] = None,
948
+ _request_timeout: Union[
949
+ None,
950
+ Annotated[StrictFloat, Field(gt=0)],
951
+ Tuple[
952
+ Annotated[StrictFloat, Field(gt=0)],
953
+ Annotated[StrictFloat, Field(gt=0)]
954
+ ]
955
+ ] = None,
956
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
957
+ _content_type: Optional[StrictStr] = None,
958
+ _headers: Optional[Dict[StrictStr, Any]] = None,
959
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
960
+ ) -> object:
961
+ """Signer un PDF avec le certificat du client (PAdES-B-LT)
962
+
963
+ Signe un PDF uploadé avec le certificat électronique configuré pour le client (via client_uid du JWT). **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO - hors scope). **⚠️ Disclaimer légal** : Les signatures générées sont des cachets électroniques au sens du règlement eIDAS. Le niveau de validité juridique dépend du certificat utilisé (SES/AdES/QES). FactPulse ne fournit pas de certificats qualifiés QES - vous devez obtenir un certificat auprès d'un PSCO (Prestataire de Services de Confiance qualifié) pour une validité juridique maximale.
964
+
965
+ :param fichier_pdf: Fichier PDF à signer (sera traité puis retourné signé en base64) (required)
966
+ :type fichier_pdf: bytearray
967
+ :param raison:
968
+ :type raison: str
969
+ :param localisation:
970
+ :type localisation: str
971
+ :param contact:
972
+ :type contact: str
973
+ :param field_name: Nom du champ de signature PDF
974
+ :type field_name: str
975
+ :param use_pades_lt: Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
976
+ :type use_pades_lt: bool
977
+ :param use_timestamp: Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
978
+ :type use_timestamp: bool
979
+ :param _request_timeout: timeout setting for this request. If one
980
+ number provided, it will be total request
981
+ timeout. It can also be a pair (tuple) of
982
+ (connection, read) timeouts.
983
+ :type _request_timeout: int, tuple(int, int), optional
984
+ :param _request_auth: set to override the auth_settings for an a single
985
+ request; this effectively ignores the
986
+ authentication in the spec for a single request.
987
+ :type _request_auth: dict, optional
988
+ :param _content_type: force content-type for the request.
989
+ :type _content_type: str, Optional
990
+ :param _headers: set to override the headers for a single
991
+ request; this effectively ignores the headers
992
+ in the spec for a single request.
993
+ :type _headers: dict, optional
994
+ :param _host_index: set to override the host_index for a single
995
+ request; this effectively ignores the host_index
996
+ in the spec for a single request.
997
+ :type _host_index: int, optional
998
+ :return: Returns the result object.
999
+ """ # noqa: E501
1000
+
1001
+ _param = self._signer_pdf_api_v1_traitement_signer_pdf_post_serialize(
1002
+ fichier_pdf=fichier_pdf,
1003
+ raison=raison,
1004
+ localisation=localisation,
1005
+ contact=contact,
1006
+ field_name=field_name,
1007
+ use_pades_lt=use_pades_lt,
1008
+ use_timestamp=use_timestamp,
1009
+ _request_auth=_request_auth,
1010
+ _content_type=_content_type,
1011
+ _headers=_headers,
1012
+ _host_index=_host_index
1013
+ )
1014
+
1015
+ _response_types_map: Dict[str, Optional[str]] = {
1016
+ '200': "object",
1017
+ '400': None,
1018
+ '404': None,
1019
+ '401': None,
1020
+ '503': None,
1021
+ '422': "HTTPValidationError",
1022
+ }
1023
+ response_data = self.api_client.call_api(
1024
+ *_param,
1025
+ _request_timeout=_request_timeout
1026
+ )
1027
+ response_data.read()
1028
+ return self.api_client.response_deserialize(
1029
+ response_data=response_data,
1030
+ response_types_map=_response_types_map,
1031
+ ).data
1032
+
1033
+
1034
+ @validate_call
1035
+ def signer_pdf_api_v1_traitement_signer_pdf_post_with_http_info(
1036
+ self,
1037
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à signer (sera traité puis retourné signé en base64)")],
1038
+ raison: Optional[StrictStr] = None,
1039
+ localisation: Optional[StrictStr] = None,
1040
+ contact: Optional[StrictStr] = None,
1041
+ field_name: Annotated[Optional[StrictStr], Field(description="Nom du champ de signature PDF")] = None,
1042
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.")] = None,
1043
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)")] = None,
1044
+ _request_timeout: Union[
1045
+ None,
1046
+ Annotated[StrictFloat, Field(gt=0)],
1047
+ Tuple[
1048
+ Annotated[StrictFloat, Field(gt=0)],
1049
+ Annotated[StrictFloat, Field(gt=0)]
1050
+ ]
1051
+ ] = None,
1052
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1053
+ _content_type: Optional[StrictStr] = None,
1054
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1055
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1056
+ ) -> ApiResponse[object]:
1057
+ """Signer un PDF avec le certificat du client (PAdES-B-LT)
1058
+
1059
+ Signe un PDF uploadé avec le certificat électronique configuré pour le client (via client_uid du JWT). **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO - hors scope). **⚠️ Disclaimer légal** : Les signatures générées sont des cachets électroniques au sens du règlement eIDAS. Le niveau de validité juridique dépend du certificat utilisé (SES/AdES/QES). FactPulse ne fournit pas de certificats qualifiés QES - vous devez obtenir un certificat auprès d'un PSCO (Prestataire de Services de Confiance qualifié) pour une validité juridique maximale.
1060
+
1061
+ :param fichier_pdf: Fichier PDF à signer (sera traité puis retourné signé en base64) (required)
1062
+ :type fichier_pdf: bytearray
1063
+ :param raison:
1064
+ :type raison: str
1065
+ :param localisation:
1066
+ :type localisation: str
1067
+ :param contact:
1068
+ :type contact: str
1069
+ :param field_name: Nom du champ de signature PDF
1070
+ :type field_name: str
1071
+ :param use_pades_lt: Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
1072
+ :type use_pades_lt: bool
1073
+ :param use_timestamp: Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
1074
+ :type use_timestamp: bool
1075
+ :param _request_timeout: timeout setting for this request. If one
1076
+ number provided, it will be total request
1077
+ timeout. It can also be a pair (tuple) of
1078
+ (connection, read) timeouts.
1079
+ :type _request_timeout: int, tuple(int, int), optional
1080
+ :param _request_auth: set to override the auth_settings for an a single
1081
+ request; this effectively ignores the
1082
+ authentication in the spec for a single request.
1083
+ :type _request_auth: dict, optional
1084
+ :param _content_type: force content-type for the request.
1085
+ :type _content_type: str, Optional
1086
+ :param _headers: set to override the headers for a single
1087
+ request; this effectively ignores the headers
1088
+ in the spec for a single request.
1089
+ :type _headers: dict, optional
1090
+ :param _host_index: set to override the host_index for a single
1091
+ request; this effectively ignores the host_index
1092
+ in the spec for a single request.
1093
+ :type _host_index: int, optional
1094
+ :return: Returns the result object.
1095
+ """ # noqa: E501
1096
+
1097
+ _param = self._signer_pdf_api_v1_traitement_signer_pdf_post_serialize(
1098
+ fichier_pdf=fichier_pdf,
1099
+ raison=raison,
1100
+ localisation=localisation,
1101
+ contact=contact,
1102
+ field_name=field_name,
1103
+ use_pades_lt=use_pades_lt,
1104
+ use_timestamp=use_timestamp,
1105
+ _request_auth=_request_auth,
1106
+ _content_type=_content_type,
1107
+ _headers=_headers,
1108
+ _host_index=_host_index
1109
+ )
1110
+
1111
+ _response_types_map: Dict[str, Optional[str]] = {
1112
+ '200': "object",
1113
+ '400': None,
1114
+ '404': None,
1115
+ '401': None,
1116
+ '503': None,
1117
+ '422': "HTTPValidationError",
1118
+ }
1119
+ response_data = self.api_client.call_api(
1120
+ *_param,
1121
+ _request_timeout=_request_timeout
1122
+ )
1123
+ response_data.read()
1124
+ return self.api_client.response_deserialize(
1125
+ response_data=response_data,
1126
+ response_types_map=_response_types_map,
1127
+ )
1128
+
1129
+
1130
+ @validate_call
1131
+ def signer_pdf_api_v1_traitement_signer_pdf_post_without_preload_content(
1132
+ self,
1133
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à signer (sera traité puis retourné signé en base64)")],
1134
+ raison: Optional[StrictStr] = None,
1135
+ localisation: Optional[StrictStr] = None,
1136
+ contact: Optional[StrictStr] = None,
1137
+ field_name: Annotated[Optional[StrictStr], Field(description="Nom du champ de signature PDF")] = None,
1138
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.")] = None,
1139
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)")] = None,
1140
+ _request_timeout: Union[
1141
+ None,
1142
+ Annotated[StrictFloat, Field(gt=0)],
1143
+ Tuple[
1144
+ Annotated[StrictFloat, Field(gt=0)],
1145
+ Annotated[StrictFloat, Field(gt=0)]
1146
+ ]
1147
+ ] = None,
1148
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1149
+ _content_type: Optional[StrictStr] = None,
1150
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1151
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1152
+ ) -> RESTResponseType:
1153
+ """Signer un PDF avec le certificat du client (PAdES-B-LT)
1154
+
1155
+ Signe un PDF uploadé avec le certificat électronique configuré pour le client (via client_uid du JWT). **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO - hors scope). **⚠️ Disclaimer légal** : Les signatures générées sont des cachets électroniques au sens du règlement eIDAS. Le niveau de validité juridique dépend du certificat utilisé (SES/AdES/QES). FactPulse ne fournit pas de certificats qualifiés QES - vous devez obtenir un certificat auprès d'un PSCO (Prestataire de Services de Confiance qualifié) pour une validité juridique maximale.
1156
+
1157
+ :param fichier_pdf: Fichier PDF à signer (sera traité puis retourné signé en base64) (required)
1158
+ :type fichier_pdf: bytearray
1159
+ :param raison:
1160
+ :type raison: str
1161
+ :param localisation:
1162
+ :type localisation: str
1163
+ :param contact:
1164
+ :type contact: str
1165
+ :param field_name: Nom du champ de signature PDF
1166
+ :type field_name: str
1167
+ :param use_pades_lt: Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
1168
+ :type use_pades_lt: bool
1169
+ :param use_timestamp: Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
1170
+ :type use_timestamp: bool
1171
+ :param _request_timeout: timeout setting for this request. If one
1172
+ number provided, it will be total request
1173
+ timeout. It can also be a pair (tuple) of
1174
+ (connection, read) timeouts.
1175
+ :type _request_timeout: int, tuple(int, int), optional
1176
+ :param _request_auth: set to override the auth_settings for an a single
1177
+ request; this effectively ignores the
1178
+ authentication in the spec for a single request.
1179
+ :type _request_auth: dict, optional
1180
+ :param _content_type: force content-type for the request.
1181
+ :type _content_type: str, Optional
1182
+ :param _headers: set to override the headers for a single
1183
+ request; this effectively ignores the headers
1184
+ in the spec for a single request.
1185
+ :type _headers: dict, optional
1186
+ :param _host_index: set to override the host_index for a single
1187
+ request; this effectively ignores the host_index
1188
+ in the spec for a single request.
1189
+ :type _host_index: int, optional
1190
+ :return: Returns the result object.
1191
+ """ # noqa: E501
1192
+
1193
+ _param = self._signer_pdf_api_v1_traitement_signer_pdf_post_serialize(
1194
+ fichier_pdf=fichier_pdf,
1195
+ raison=raison,
1196
+ localisation=localisation,
1197
+ contact=contact,
1198
+ field_name=field_name,
1199
+ use_pades_lt=use_pades_lt,
1200
+ use_timestamp=use_timestamp,
1201
+ _request_auth=_request_auth,
1202
+ _content_type=_content_type,
1203
+ _headers=_headers,
1204
+ _host_index=_host_index
1205
+ )
1206
+
1207
+ _response_types_map: Dict[str, Optional[str]] = {
1208
+ '200': "object",
1209
+ '400': None,
1210
+ '404': None,
1211
+ '401': None,
1212
+ '503': None,
1213
+ '422': "HTTPValidationError",
1214
+ }
1215
+ response_data = self.api_client.call_api(
1216
+ *_param,
1217
+ _request_timeout=_request_timeout
1218
+ )
1219
+ return response_data.response
1220
+
1221
+
1222
+ def _signer_pdf_api_v1_traitement_signer_pdf_post_serialize(
1223
+ self,
1224
+ fichier_pdf,
1225
+ raison,
1226
+ localisation,
1227
+ contact,
1228
+ field_name,
1229
+ use_pades_lt,
1230
+ use_timestamp,
1231
+ _request_auth,
1232
+ _content_type,
1233
+ _headers,
1234
+ _host_index,
1235
+ ) -> RequestSerialized:
1236
+
1237
+ _host = None
1238
+
1239
+ _collection_formats: Dict[str, str] = {
1240
+ }
1241
+
1242
+ _path_params: Dict[str, str] = {}
1243
+ _query_params: List[Tuple[str, str]] = []
1244
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1245
+ _form_params: List[Tuple[str, str]] = []
1246
+ _files: Dict[
1247
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1248
+ ] = {}
1249
+ _body_params: Optional[bytes] = None
1250
+
1251
+ # process the path parameters
1252
+ # process the query parameters
1253
+ # process the header parameters
1254
+ # process the form parameters
1255
+ if fichier_pdf is not None:
1256
+ _files['fichier_pdf'] = fichier_pdf
1257
+ if raison is not None:
1258
+ _form_params.append(('raison', raison))
1259
+ if localisation is not None:
1260
+ _form_params.append(('localisation', localisation))
1261
+ if contact is not None:
1262
+ _form_params.append(('contact', contact))
1263
+ if field_name is not None:
1264
+ _form_params.append(('field_name', field_name))
1265
+ if use_pades_lt is not None:
1266
+ _form_params.append(('use_pades_lt', use_pades_lt))
1267
+ if use_timestamp is not None:
1268
+ _form_params.append(('use_timestamp', use_timestamp))
1269
+ # process the body parameter
1270
+
1271
+
1272
+ # set the HTTP header `Accept`
1273
+ if 'Accept' not in _header_params:
1274
+ _header_params['Accept'] = self.api_client.select_header_accept(
1275
+ [
1276
+ 'application/json'
1277
+ ]
1278
+ )
1279
+
1280
+ # set the HTTP header `Content-Type`
1281
+ if _content_type:
1282
+ _header_params['Content-Type'] = _content_type
1283
+ else:
1284
+ _default_content_type = (
1285
+ self.api_client.select_header_content_type(
1286
+ [
1287
+ 'multipart/form-data'
1288
+ ]
1289
+ )
1290
+ )
1291
+ if _default_content_type is not None:
1292
+ _header_params['Content-Type'] = _default_content_type
1293
+
1294
+ # authentication setting
1295
+ _auth_settings: List[str] = [
1296
+ 'HTTPBearer'
1297
+ ]
1298
+
1299
+ return self.api_client.param_serialize(
1300
+ method='POST',
1301
+ resource_path='/api/v1/traitement/signer-pdf',
1302
+ path_params=_path_params,
1303
+ query_params=_query_params,
1304
+ header_params=_header_params,
1305
+ body=_body_params,
1306
+ post_params=_form_params,
1307
+ files=_files,
1308
+ auth_settings=_auth_settings,
1309
+ collection_formats=_collection_formats,
1310
+ _host=_host,
1311
+ _request_auth=_request_auth
1312
+ )
1313
+
1314
+
1315
+
1316
+
1317
+ @validate_call
1318
+ def signer_pdf_async_api_v1_traitement_signer_pdf_async_post(
1319
+ self,
1320
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à signer (traité de manière asynchrone)")],
1321
+ raison: Optional[StrictStr] = None,
1322
+ localisation: Optional[StrictStr] = None,
1323
+ contact: Optional[StrictStr] = None,
1324
+ field_name: Annotated[Optional[StrictStr], Field(description="Nom du champ de signature PDF")] = None,
1325
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.")] = None,
1326
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)")] = None,
1327
+ _request_timeout: Union[
1328
+ None,
1329
+ Annotated[StrictFloat, Field(gt=0)],
1330
+ Tuple[
1331
+ Annotated[StrictFloat, Field(gt=0)],
1332
+ Annotated[StrictFloat, Field(gt=0)]
1333
+ ]
1334
+ ] = None,
1335
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1336
+ _content_type: Optional[StrictStr] = None,
1337
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1338
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1339
+ ) -> object:
1340
+ """Signer un PDF de manière asynchrone (Celery)
1341
+
1342
+ Signe un PDF uploadé de manière asynchrone via une tâche Celery. **Différence avec /signer-pdf** : - `/signer-pdf` : Signature synchrone (blocage jusqu'à la fin) - `/signer-pdf-async` : Signature asynchrone (retourne immédiatement un task_id) **Avantages de l'async** : - Pas de timeout pour les gros fichiers - Pas de blocage du worker FastAPI - Possibilité de suivre la progression via le task_id - Idéal pour les traitements par lot **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **⚠️ Disclaimer légal** : Identique à /signer-pdf (voir documentation de cet endpoint).
1343
+
1344
+ :param fichier_pdf: Fichier PDF à signer (traité de manière asynchrone) (required)
1345
+ :type fichier_pdf: bytearray
1346
+ :param raison:
1347
+ :type raison: str
1348
+ :param localisation:
1349
+ :type localisation: str
1350
+ :param contact:
1351
+ :type contact: str
1352
+ :param field_name: Nom du champ de signature PDF
1353
+ :type field_name: str
1354
+ :param use_pades_lt: Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
1355
+ :type use_pades_lt: bool
1356
+ :param use_timestamp: Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
1357
+ :type use_timestamp: bool
1358
+ :param _request_timeout: timeout setting for this request. If one
1359
+ number provided, it will be total request
1360
+ timeout. It can also be a pair (tuple) of
1361
+ (connection, read) timeouts.
1362
+ :type _request_timeout: int, tuple(int, int), optional
1363
+ :param _request_auth: set to override the auth_settings for an a single
1364
+ request; this effectively ignores the
1365
+ authentication in the spec for a single request.
1366
+ :type _request_auth: dict, optional
1367
+ :param _content_type: force content-type for the request.
1368
+ :type _content_type: str, Optional
1369
+ :param _headers: set to override the headers for a single
1370
+ request; this effectively ignores the headers
1371
+ in the spec for a single request.
1372
+ :type _headers: dict, optional
1373
+ :param _host_index: set to override the host_index for a single
1374
+ request; this effectively ignores the host_index
1375
+ in the spec for a single request.
1376
+ :type _host_index: int, optional
1377
+ :return: Returns the result object.
1378
+ """ # noqa: E501
1379
+
1380
+ _param = self._signer_pdf_async_api_v1_traitement_signer_pdf_async_post_serialize(
1381
+ fichier_pdf=fichier_pdf,
1382
+ raison=raison,
1383
+ localisation=localisation,
1384
+ contact=contact,
1385
+ field_name=field_name,
1386
+ use_pades_lt=use_pades_lt,
1387
+ use_timestamp=use_timestamp,
1388
+ _request_auth=_request_auth,
1389
+ _content_type=_content_type,
1390
+ _headers=_headers,
1391
+ _host_index=_host_index
1392
+ )
1393
+
1394
+ _response_types_map: Dict[str, Optional[str]] = {
1395
+ '200': "object",
1396
+ '202': None,
1397
+ '400': None,
1398
+ '401': None,
1399
+ '422': "HTTPValidationError",
1400
+ }
1401
+ response_data = self.api_client.call_api(
1402
+ *_param,
1403
+ _request_timeout=_request_timeout
1404
+ )
1405
+ response_data.read()
1406
+ return self.api_client.response_deserialize(
1407
+ response_data=response_data,
1408
+ response_types_map=_response_types_map,
1409
+ ).data
1410
+
1411
+
1412
+ @validate_call
1413
+ def signer_pdf_async_api_v1_traitement_signer_pdf_async_post_with_http_info(
1414
+ self,
1415
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à signer (traité de manière asynchrone)")],
1416
+ raison: Optional[StrictStr] = None,
1417
+ localisation: Optional[StrictStr] = None,
1418
+ contact: Optional[StrictStr] = None,
1419
+ field_name: Annotated[Optional[StrictStr], Field(description="Nom du champ de signature PDF")] = None,
1420
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.")] = None,
1421
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)")] = None,
1422
+ _request_timeout: Union[
1423
+ None,
1424
+ Annotated[StrictFloat, Field(gt=0)],
1425
+ Tuple[
1426
+ Annotated[StrictFloat, Field(gt=0)],
1427
+ Annotated[StrictFloat, Field(gt=0)]
1428
+ ]
1429
+ ] = None,
1430
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1431
+ _content_type: Optional[StrictStr] = None,
1432
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1433
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1434
+ ) -> ApiResponse[object]:
1435
+ """Signer un PDF de manière asynchrone (Celery)
1436
+
1437
+ Signe un PDF uploadé de manière asynchrone via une tâche Celery. **Différence avec /signer-pdf** : - `/signer-pdf` : Signature synchrone (blocage jusqu'à la fin) - `/signer-pdf-async` : Signature asynchrone (retourne immédiatement un task_id) **Avantages de l'async** : - Pas de timeout pour les gros fichiers - Pas de blocage du worker FastAPI - Possibilité de suivre la progression via le task_id - Idéal pour les traitements par lot **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **⚠️ Disclaimer légal** : Identique à /signer-pdf (voir documentation de cet endpoint).
1438
+
1439
+ :param fichier_pdf: Fichier PDF à signer (traité de manière asynchrone) (required)
1440
+ :type fichier_pdf: bytearray
1441
+ :param raison:
1442
+ :type raison: str
1443
+ :param localisation:
1444
+ :type localisation: str
1445
+ :param contact:
1446
+ :type contact: str
1447
+ :param field_name: Nom du champ de signature PDF
1448
+ :type field_name: str
1449
+ :param use_pades_lt: Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
1450
+ :type use_pades_lt: bool
1451
+ :param use_timestamp: Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
1452
+ :type use_timestamp: bool
1453
+ :param _request_timeout: timeout setting for this request. If one
1454
+ number provided, it will be total request
1455
+ timeout. It can also be a pair (tuple) of
1456
+ (connection, read) timeouts.
1457
+ :type _request_timeout: int, tuple(int, int), optional
1458
+ :param _request_auth: set to override the auth_settings for an a single
1459
+ request; this effectively ignores the
1460
+ authentication in the spec for a single request.
1461
+ :type _request_auth: dict, optional
1462
+ :param _content_type: force content-type for the request.
1463
+ :type _content_type: str, Optional
1464
+ :param _headers: set to override the headers for a single
1465
+ request; this effectively ignores the headers
1466
+ in the spec for a single request.
1467
+ :type _headers: dict, optional
1468
+ :param _host_index: set to override the host_index for a single
1469
+ request; this effectively ignores the host_index
1470
+ in the spec for a single request.
1471
+ :type _host_index: int, optional
1472
+ :return: Returns the result object.
1473
+ """ # noqa: E501
1474
+
1475
+ _param = self._signer_pdf_async_api_v1_traitement_signer_pdf_async_post_serialize(
1476
+ fichier_pdf=fichier_pdf,
1477
+ raison=raison,
1478
+ localisation=localisation,
1479
+ contact=contact,
1480
+ field_name=field_name,
1481
+ use_pades_lt=use_pades_lt,
1482
+ use_timestamp=use_timestamp,
1483
+ _request_auth=_request_auth,
1484
+ _content_type=_content_type,
1485
+ _headers=_headers,
1486
+ _host_index=_host_index
1487
+ )
1488
+
1489
+ _response_types_map: Dict[str, Optional[str]] = {
1490
+ '200': "object",
1491
+ '202': None,
1492
+ '400': None,
1493
+ '401': None,
1494
+ '422': "HTTPValidationError",
1495
+ }
1496
+ response_data = self.api_client.call_api(
1497
+ *_param,
1498
+ _request_timeout=_request_timeout
1499
+ )
1500
+ response_data.read()
1501
+ return self.api_client.response_deserialize(
1502
+ response_data=response_data,
1503
+ response_types_map=_response_types_map,
1504
+ )
1505
+
1506
+
1507
+ @validate_call
1508
+ def signer_pdf_async_api_v1_traitement_signer_pdf_async_post_without_preload_content(
1509
+ self,
1510
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à signer (traité de manière asynchrone)")],
1511
+ raison: Optional[StrictStr] = None,
1512
+ localisation: Optional[StrictStr] = None,
1513
+ contact: Optional[StrictStr] = None,
1514
+ field_name: Annotated[Optional[StrictStr], Field(description="Nom du champ de signature PDF")] = None,
1515
+ use_pades_lt: Annotated[Optional[StrictBool], Field(description="Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.")] = None,
1516
+ use_timestamp: Annotated[Optional[StrictBool], Field(description="Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)")] = None,
1517
+ _request_timeout: Union[
1518
+ None,
1519
+ Annotated[StrictFloat, Field(gt=0)],
1520
+ Tuple[
1521
+ Annotated[StrictFloat, Field(gt=0)],
1522
+ Annotated[StrictFloat, Field(gt=0)]
1523
+ ]
1524
+ ] = None,
1525
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1526
+ _content_type: Optional[StrictStr] = None,
1527
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1528
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1529
+ ) -> RESTResponseType:
1530
+ """Signer un PDF de manière asynchrone (Celery)
1531
+
1532
+ Signe un PDF uploadé de manière asynchrone via une tâche Celery. **Différence avec /signer-pdf** : - `/signer-pdf` : Signature synchrone (blocage jusqu'à la fin) - `/signer-pdf-async` : Signature asynchrone (retourne immédiatement un task_id) **Avantages de l'async** : - Pas de timeout pour les gros fichiers - Pas de blocage du worker FastAPI - Possibilité de suivre la progression via le task_id - Idéal pour les traitements par lot **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **⚠️ Disclaimer légal** : Identique à /signer-pdf (voir documentation de cet endpoint).
1533
+
1534
+ :param fichier_pdf: Fichier PDF à signer (traité de manière asynchrone) (required)
1535
+ :type fichier_pdf: bytearray
1536
+ :param raison:
1537
+ :type raison: str
1538
+ :param localisation:
1539
+ :type localisation: str
1540
+ :param contact:
1541
+ :type contact: str
1542
+ :param field_name: Nom du champ de signature PDF
1543
+ :type field_name: str
1544
+ :param use_pades_lt: Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
1545
+ :type use_pades_lt: bool
1546
+ :param use_timestamp: Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
1547
+ :type use_timestamp: bool
1548
+ :param _request_timeout: timeout setting for this request. If one
1549
+ number provided, it will be total request
1550
+ timeout. It can also be a pair (tuple) of
1551
+ (connection, read) timeouts.
1552
+ :type _request_timeout: int, tuple(int, int), optional
1553
+ :param _request_auth: set to override the auth_settings for an a single
1554
+ request; this effectively ignores the
1555
+ authentication in the spec for a single request.
1556
+ :type _request_auth: dict, optional
1557
+ :param _content_type: force content-type for the request.
1558
+ :type _content_type: str, Optional
1559
+ :param _headers: set to override the headers for a single
1560
+ request; this effectively ignores the headers
1561
+ in the spec for a single request.
1562
+ :type _headers: dict, optional
1563
+ :param _host_index: set to override the host_index for a single
1564
+ request; this effectively ignores the host_index
1565
+ in the spec for a single request.
1566
+ :type _host_index: int, optional
1567
+ :return: Returns the result object.
1568
+ """ # noqa: E501
1569
+
1570
+ _param = self._signer_pdf_async_api_v1_traitement_signer_pdf_async_post_serialize(
1571
+ fichier_pdf=fichier_pdf,
1572
+ raison=raison,
1573
+ localisation=localisation,
1574
+ contact=contact,
1575
+ field_name=field_name,
1576
+ use_pades_lt=use_pades_lt,
1577
+ use_timestamp=use_timestamp,
1578
+ _request_auth=_request_auth,
1579
+ _content_type=_content_type,
1580
+ _headers=_headers,
1581
+ _host_index=_host_index
1582
+ )
1583
+
1584
+ _response_types_map: Dict[str, Optional[str]] = {
1585
+ '200': "object",
1586
+ '202': None,
1587
+ '400': None,
1588
+ '401': None,
1589
+ '422': "HTTPValidationError",
1590
+ }
1591
+ response_data = self.api_client.call_api(
1592
+ *_param,
1593
+ _request_timeout=_request_timeout
1594
+ )
1595
+ return response_data.response
1596
+
1597
+
1598
+ def _signer_pdf_async_api_v1_traitement_signer_pdf_async_post_serialize(
1599
+ self,
1600
+ fichier_pdf,
1601
+ raison,
1602
+ localisation,
1603
+ contact,
1604
+ field_name,
1605
+ use_pades_lt,
1606
+ use_timestamp,
1607
+ _request_auth,
1608
+ _content_type,
1609
+ _headers,
1610
+ _host_index,
1611
+ ) -> RequestSerialized:
1612
+
1613
+ _host = None
1614
+
1615
+ _collection_formats: Dict[str, str] = {
1616
+ }
1617
+
1618
+ _path_params: Dict[str, str] = {}
1619
+ _query_params: List[Tuple[str, str]] = []
1620
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1621
+ _form_params: List[Tuple[str, str]] = []
1622
+ _files: Dict[
1623
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1624
+ ] = {}
1625
+ _body_params: Optional[bytes] = None
1626
+
1627
+ # process the path parameters
1628
+ # process the query parameters
1629
+ # process the header parameters
1630
+ # process the form parameters
1631
+ if fichier_pdf is not None:
1632
+ _files['fichier_pdf'] = fichier_pdf
1633
+ if raison is not None:
1634
+ _form_params.append(('raison', raison))
1635
+ if localisation is not None:
1636
+ _form_params.append(('localisation', localisation))
1637
+ if contact is not None:
1638
+ _form_params.append(('contact', contact))
1639
+ if field_name is not None:
1640
+ _form_params.append(('field_name', field_name))
1641
+ if use_pades_lt is not None:
1642
+ _form_params.append(('use_pades_lt', use_pades_lt))
1643
+ if use_timestamp is not None:
1644
+ _form_params.append(('use_timestamp', use_timestamp))
1645
+ # process the body parameter
1646
+
1647
+
1648
+ # set the HTTP header `Accept`
1649
+ if 'Accept' not in _header_params:
1650
+ _header_params['Accept'] = self.api_client.select_header_accept(
1651
+ [
1652
+ 'application/json'
1653
+ ]
1654
+ )
1655
+
1656
+ # set the HTTP header `Content-Type`
1657
+ if _content_type:
1658
+ _header_params['Content-Type'] = _content_type
1659
+ else:
1660
+ _default_content_type = (
1661
+ self.api_client.select_header_content_type(
1662
+ [
1663
+ 'multipart/form-data'
1664
+ ]
1665
+ )
1666
+ )
1667
+ if _default_content_type is not None:
1668
+ _header_params['Content-Type'] = _default_content_type
1669
+
1670
+ # authentication setting
1671
+ _auth_settings: List[str] = [
1672
+ 'HTTPBearer'
1673
+ ]
1674
+
1675
+ return self.api_client.param_serialize(
1676
+ method='POST',
1677
+ resource_path='/api/v1/traitement/signer-pdf-async',
1678
+ path_params=_path_params,
1679
+ query_params=_query_params,
1680
+ header_params=_header_params,
1681
+ body=_body_params,
1682
+ post_params=_form_params,
1683
+ files=_files,
1684
+ auth_settings=_auth_settings,
1685
+ collection_formats=_collection_formats,
1686
+ _host=_host,
1687
+ _request_auth=_request_auth
1688
+ )
1689
+
1690
+
1691
+
1692
+
1693
+ @validate_call
1694
+ def soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post(
1695
+ self,
1696
+ soumettre_facture_complete_request: SoumettreFactureCompleteRequest,
1697
+ _request_timeout: Union[
1698
+ None,
1699
+ Annotated[StrictFloat, Field(gt=0)],
1700
+ Tuple[
1701
+ Annotated[StrictFloat, Field(gt=0)],
1702
+ Annotated[StrictFloat, Field(gt=0)]
1703
+ ]
1704
+ ] = None,
1705
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1706
+ _content_type: Optional[StrictStr] = None,
1707
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1708
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1709
+ ) -> SoumettreFactureCompleteResponse:
1710
+ """Soumettre une facture complète (génération + signature + soumission)
1711
+
1712
+ Endpoint unifié pour soumettre une facture complète vers différentes destinations. **Workflow automatisé :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Credentials de destination - 2 modes disponibles :** **Mode 1 - Récupération via JWT (recommandé) :** - Les credentials sont récupérés automatiquement via le `client_uid` du JWT - Ne pas fournir le champ `credentials` dans `destination` - Architecture 0-trust : aucun secret dans le payload - Exemple : `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials dans le payload :** - Fournir les credentials directement dans le payload - Utile pour tests ou intégrations tierces - Exemple : `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Signature électronique (optionnelle) - 2 modes disponibles :** **Mode 1 - Certificat stocké (recommandé) :** - Le certificat est récupéré automatiquement via le `client_uid` du JWT - Aucune clé à fournir dans le payload - Signature PAdES-B-LT avec horodatage (conforme eIDAS) - Exemple : `\"signature\": {\"raison\": \"Conformité Factur-X\"}` **Mode 2 - Clés dans le payload (pour tests) :** - Fournir `key_pem` et `cert_pem` directement - Format PEM accepté : brut ou base64 - Utile pour tests ou cas spéciaux sans certificat stocké - Exemple : `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` Si `key_pem` et `cert_pem` sont fournis → Mode 2 Sinon → Mode 1 (certificat récupéré via `client_uid`)
1713
+
1714
+ :param soumettre_facture_complete_request: (required)
1715
+ :type soumettre_facture_complete_request: SoumettreFactureCompleteRequest
1716
+ :param _request_timeout: timeout setting for this request. If one
1717
+ number provided, it will be total request
1718
+ timeout. It can also be a pair (tuple) of
1719
+ (connection, read) timeouts.
1720
+ :type _request_timeout: int, tuple(int, int), optional
1721
+ :param _request_auth: set to override the auth_settings for an a single
1722
+ request; this effectively ignores the
1723
+ authentication in the spec for a single request.
1724
+ :type _request_auth: dict, optional
1725
+ :param _content_type: force content-type for the request.
1726
+ :type _content_type: str, Optional
1727
+ :param _headers: set to override the headers for a single
1728
+ request; this effectively ignores the headers
1729
+ in the spec for a single request.
1730
+ :type _headers: dict, optional
1731
+ :param _host_index: set to override the host_index for a single
1732
+ request; this effectively ignores the host_index
1733
+ in the spec for a single request.
1734
+ :type _host_index: int, optional
1735
+ :return: Returns the result object.
1736
+ """ # noqa: E501
1737
+
1738
+ _param = self._soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_serialize(
1739
+ soumettre_facture_complete_request=soumettre_facture_complete_request,
1740
+ _request_auth=_request_auth,
1741
+ _content_type=_content_type,
1742
+ _headers=_headers,
1743
+ _host_index=_host_index
1744
+ )
1745
+
1746
+ _response_types_map: Dict[str, Optional[str]] = {
1747
+ '200': "SoumettreFactureCompleteResponse",
1748
+ '422': "HTTPValidationError",
1749
+ }
1750
+ response_data = self.api_client.call_api(
1751
+ *_param,
1752
+ _request_timeout=_request_timeout
1753
+ )
1754
+ response_data.read()
1755
+ return self.api_client.response_deserialize(
1756
+ response_data=response_data,
1757
+ response_types_map=_response_types_map,
1758
+ ).data
1759
+
1760
+
1761
+ @validate_call
1762
+ def soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_with_http_info(
1763
+ self,
1764
+ soumettre_facture_complete_request: SoumettreFactureCompleteRequest,
1765
+ _request_timeout: Union[
1766
+ None,
1767
+ Annotated[StrictFloat, Field(gt=0)],
1768
+ Tuple[
1769
+ Annotated[StrictFloat, Field(gt=0)],
1770
+ Annotated[StrictFloat, Field(gt=0)]
1771
+ ]
1772
+ ] = None,
1773
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1774
+ _content_type: Optional[StrictStr] = None,
1775
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1776
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1777
+ ) -> ApiResponse[SoumettreFactureCompleteResponse]:
1778
+ """Soumettre une facture complète (génération + signature + soumission)
1779
+
1780
+ Endpoint unifié pour soumettre une facture complète vers différentes destinations. **Workflow automatisé :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Credentials de destination - 2 modes disponibles :** **Mode 1 - Récupération via JWT (recommandé) :** - Les credentials sont récupérés automatiquement via le `client_uid` du JWT - Ne pas fournir le champ `credentials` dans `destination` - Architecture 0-trust : aucun secret dans le payload - Exemple : `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials dans le payload :** - Fournir les credentials directement dans le payload - Utile pour tests ou intégrations tierces - Exemple : `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Signature électronique (optionnelle) - 2 modes disponibles :** **Mode 1 - Certificat stocké (recommandé) :** - Le certificat est récupéré automatiquement via le `client_uid` du JWT - Aucune clé à fournir dans le payload - Signature PAdES-B-LT avec horodatage (conforme eIDAS) - Exemple : `\"signature\": {\"raison\": \"Conformité Factur-X\"}` **Mode 2 - Clés dans le payload (pour tests) :** - Fournir `key_pem` et `cert_pem` directement - Format PEM accepté : brut ou base64 - Utile pour tests ou cas spéciaux sans certificat stocké - Exemple : `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` Si `key_pem` et `cert_pem` sont fournis → Mode 2 Sinon → Mode 1 (certificat récupéré via `client_uid`)
1781
+
1782
+ :param soumettre_facture_complete_request: (required)
1783
+ :type soumettre_facture_complete_request: SoumettreFactureCompleteRequest
1784
+ :param _request_timeout: timeout setting for this request. If one
1785
+ number provided, it will be total request
1786
+ timeout. It can also be a pair (tuple) of
1787
+ (connection, read) timeouts.
1788
+ :type _request_timeout: int, tuple(int, int), optional
1789
+ :param _request_auth: set to override the auth_settings for an a single
1790
+ request; this effectively ignores the
1791
+ authentication in the spec for a single request.
1792
+ :type _request_auth: dict, optional
1793
+ :param _content_type: force content-type for the request.
1794
+ :type _content_type: str, Optional
1795
+ :param _headers: set to override the headers for a single
1796
+ request; this effectively ignores the headers
1797
+ in the spec for a single request.
1798
+ :type _headers: dict, optional
1799
+ :param _host_index: set to override the host_index for a single
1800
+ request; this effectively ignores the host_index
1801
+ in the spec for a single request.
1802
+ :type _host_index: int, optional
1803
+ :return: Returns the result object.
1804
+ """ # noqa: E501
1805
+
1806
+ _param = self._soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_serialize(
1807
+ soumettre_facture_complete_request=soumettre_facture_complete_request,
1808
+ _request_auth=_request_auth,
1809
+ _content_type=_content_type,
1810
+ _headers=_headers,
1811
+ _host_index=_host_index
1812
+ )
1813
+
1814
+ _response_types_map: Dict[str, Optional[str]] = {
1815
+ '200': "SoumettreFactureCompleteResponse",
1816
+ '422': "HTTPValidationError",
1817
+ }
1818
+ response_data = self.api_client.call_api(
1819
+ *_param,
1820
+ _request_timeout=_request_timeout
1821
+ )
1822
+ response_data.read()
1823
+ return self.api_client.response_deserialize(
1824
+ response_data=response_data,
1825
+ response_types_map=_response_types_map,
1826
+ )
1827
+
1828
+
1829
+ @validate_call
1830
+ def soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_without_preload_content(
1831
+ self,
1832
+ soumettre_facture_complete_request: SoumettreFactureCompleteRequest,
1833
+ _request_timeout: Union[
1834
+ None,
1835
+ Annotated[StrictFloat, Field(gt=0)],
1836
+ Tuple[
1837
+ Annotated[StrictFloat, Field(gt=0)],
1838
+ Annotated[StrictFloat, Field(gt=0)]
1839
+ ]
1840
+ ] = None,
1841
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1842
+ _content_type: Optional[StrictStr] = None,
1843
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1844
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1845
+ ) -> RESTResponseType:
1846
+ """Soumettre une facture complète (génération + signature + soumission)
1847
+
1848
+ Endpoint unifié pour soumettre une facture complète vers différentes destinations. **Workflow automatisé :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Credentials de destination - 2 modes disponibles :** **Mode 1 - Récupération via JWT (recommandé) :** - Les credentials sont récupérés automatiquement via le `client_uid` du JWT - Ne pas fournir le champ `credentials` dans `destination` - Architecture 0-trust : aucun secret dans le payload - Exemple : `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials dans le payload :** - Fournir les credentials directement dans le payload - Utile pour tests ou intégrations tierces - Exemple : `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Signature électronique (optionnelle) - 2 modes disponibles :** **Mode 1 - Certificat stocké (recommandé) :** - Le certificat est récupéré automatiquement via le `client_uid` du JWT - Aucune clé à fournir dans le payload - Signature PAdES-B-LT avec horodatage (conforme eIDAS) - Exemple : `\"signature\": {\"raison\": \"Conformité Factur-X\"}` **Mode 2 - Clés dans le payload (pour tests) :** - Fournir `key_pem` et `cert_pem` directement - Format PEM accepté : brut ou base64 - Utile pour tests ou cas spéciaux sans certificat stocké - Exemple : `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` Si `key_pem` et `cert_pem` sont fournis → Mode 2 Sinon → Mode 1 (certificat récupéré via `client_uid`)
1849
+
1850
+ :param soumettre_facture_complete_request: (required)
1851
+ :type soumettre_facture_complete_request: SoumettreFactureCompleteRequest
1852
+ :param _request_timeout: timeout setting for this request. If one
1853
+ number provided, it will be total request
1854
+ timeout. It can also be a pair (tuple) of
1855
+ (connection, read) timeouts.
1856
+ :type _request_timeout: int, tuple(int, int), optional
1857
+ :param _request_auth: set to override the auth_settings for an a single
1858
+ request; this effectively ignores the
1859
+ authentication in the spec for a single request.
1860
+ :type _request_auth: dict, optional
1861
+ :param _content_type: force content-type for the request.
1862
+ :type _content_type: str, Optional
1863
+ :param _headers: set to override the headers for a single
1864
+ request; this effectively ignores the headers
1865
+ in the spec for a single request.
1866
+ :type _headers: dict, optional
1867
+ :param _host_index: set to override the host_index for a single
1868
+ request; this effectively ignores the host_index
1869
+ in the spec for a single request.
1870
+ :type _host_index: int, optional
1871
+ :return: Returns the result object.
1872
+ """ # noqa: E501
1873
+
1874
+ _param = self._soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_serialize(
1875
+ soumettre_facture_complete_request=soumettre_facture_complete_request,
1876
+ _request_auth=_request_auth,
1877
+ _content_type=_content_type,
1878
+ _headers=_headers,
1879
+ _host_index=_host_index
1880
+ )
1881
+
1882
+ _response_types_map: Dict[str, Optional[str]] = {
1883
+ '200': "SoumettreFactureCompleteResponse",
1884
+ '422': "HTTPValidationError",
1885
+ }
1886
+ response_data = self.api_client.call_api(
1887
+ *_param,
1888
+ _request_timeout=_request_timeout
1889
+ )
1890
+ return response_data.response
1891
+
1892
+
1893
+ def _soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_serialize(
1894
+ self,
1895
+ soumettre_facture_complete_request,
1896
+ _request_auth,
1897
+ _content_type,
1898
+ _headers,
1899
+ _host_index,
1900
+ ) -> RequestSerialized:
1901
+
1902
+ _host = None
1903
+
1904
+ _collection_formats: Dict[str, str] = {
1905
+ }
1906
+
1907
+ _path_params: Dict[str, str] = {}
1908
+ _query_params: List[Tuple[str, str]] = []
1909
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1910
+ _form_params: List[Tuple[str, str]] = []
1911
+ _files: Dict[
1912
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1913
+ ] = {}
1914
+ _body_params: Optional[bytes] = None
1915
+
1916
+ # process the path parameters
1917
+ # process the query parameters
1918
+ # process the header parameters
1919
+ # process the form parameters
1920
+ # process the body parameter
1921
+ if soumettre_facture_complete_request is not None:
1922
+ _body_params = soumettre_facture_complete_request
1923
+
1924
+
1925
+ # set the HTTP header `Accept`
1926
+ if 'Accept' not in _header_params:
1927
+ _header_params['Accept'] = self.api_client.select_header_accept(
1928
+ [
1929
+ 'application/json'
1930
+ ]
1931
+ )
1932
+
1933
+ # set the HTTP header `Content-Type`
1934
+ if _content_type:
1935
+ _header_params['Content-Type'] = _content_type
1936
+ else:
1937
+ _default_content_type = (
1938
+ self.api_client.select_header_content_type(
1939
+ [
1940
+ 'application/json'
1941
+ ]
1942
+ )
1943
+ )
1944
+ if _default_content_type is not None:
1945
+ _header_params['Content-Type'] = _default_content_type
1946
+
1947
+ # authentication setting
1948
+ _auth_settings: List[str] = [
1949
+ 'HTTPBearer'
1950
+ ]
1951
+
1952
+ return self.api_client.param_serialize(
1953
+ method='POST',
1954
+ resource_path='/api/v1/traitement/factures/soumettre-complete',
1955
+ path_params=_path_params,
1956
+ query_params=_query_params,
1957
+ header_params=_header_params,
1958
+ body=_body_params,
1959
+ post_params=_form_params,
1960
+ files=_files,
1961
+ auth_settings=_auth_settings,
1962
+ collection_formats=_collection_formats,
1963
+ _host=_host,
1964
+ _request_auth=_request_auth
1965
+ )
1966
+
1967
+
1968
+
1969
+
1970
+ @validate_call
1971
+ def soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post(
1972
+ self,
1973
+ soumettre_facture_complete_request: SoumettreFactureCompleteRequest,
1974
+ _request_timeout: Union[
1975
+ None,
1976
+ Annotated[StrictFloat, Field(gt=0)],
1977
+ Tuple[
1978
+ Annotated[StrictFloat, Field(gt=0)],
1979
+ Annotated[StrictFloat, Field(gt=0)]
1980
+ ]
1981
+ ] = None,
1982
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1983
+ _content_type: Optional[StrictStr] = None,
1984
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1985
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1986
+ ) -> ReponseTache:
1987
+ """Soumettre une facture complète (asynchrone avec Celery)
1988
+
1989
+ Version asynchrone de l'endpoint `/factures/soumettre-complete` utilisant Celery pour le traitement en arrière-plan. **Workflow automatisé (identique à la version synchrone) :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Différences avec la version synchrone :** - ✅ **Non-bloquant** : Retourne immédiatement un `id_tache` (HTTP 202 Accepted) - ✅ **Traitement en arrière-plan** : La facture est traitée par un worker Celery - ✅ **Suivi d'avancement** : Utilisez `/taches/{id_tache}/statut` pour suivre le statut - ✅ **Idéal pour gros volumes** : Permet de traiter de nombreuses factures en parallèle **Comment utiliser :** 1. **Soumission** : Appelez cet endpoint avec vos données de facture 2. **Retour immédiat** : Vous recevez un `id_tache` (ex: \"abc123-def456\") 3. **Suivi** : Appelez `/taches/{id_tache}/statut` pour vérifier l'avancement 4. **Résultat** : Quand `statut = \"SUCCESS\"`, le champ `resultat` contient la réponse complète **Credentials et signature** : Mêmes modes que la version synchrone (JWT ou payload).
1990
+
1991
+ :param soumettre_facture_complete_request: (required)
1992
+ :type soumettre_facture_complete_request: SoumettreFactureCompleteRequest
1993
+ :param _request_timeout: timeout setting for this request. If one
1994
+ number provided, it will be total request
1995
+ timeout. It can also be a pair (tuple) of
1996
+ (connection, read) timeouts.
1997
+ :type _request_timeout: int, tuple(int, int), optional
1998
+ :param _request_auth: set to override the auth_settings for an a single
1999
+ request; this effectively ignores the
2000
+ authentication in the spec for a single request.
2001
+ :type _request_auth: dict, optional
2002
+ :param _content_type: force content-type for the request.
2003
+ :type _content_type: str, Optional
2004
+ :param _headers: set to override the headers for a single
2005
+ request; this effectively ignores the headers
2006
+ in the spec for a single request.
2007
+ :type _headers: dict, optional
2008
+ :param _host_index: set to override the host_index for a single
2009
+ request; this effectively ignores the host_index
2010
+ in the spec for a single request.
2011
+ :type _host_index: int, optional
2012
+ :return: Returns the result object.
2013
+ """ # noqa: E501
2014
+
2015
+ _param = self._soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_serialize(
2016
+ soumettre_facture_complete_request=soumettre_facture_complete_request,
2017
+ _request_auth=_request_auth,
2018
+ _content_type=_content_type,
2019
+ _headers=_headers,
2020
+ _host_index=_host_index
2021
+ )
2022
+
2023
+ _response_types_map: Dict[str, Optional[str]] = {
2024
+ '202': "ReponseTache",
2025
+ '422': "HTTPValidationError",
2026
+ }
2027
+ response_data = self.api_client.call_api(
2028
+ *_param,
2029
+ _request_timeout=_request_timeout
2030
+ )
2031
+ response_data.read()
2032
+ return self.api_client.response_deserialize(
2033
+ response_data=response_data,
2034
+ response_types_map=_response_types_map,
2035
+ ).data
2036
+
2037
+
2038
+ @validate_call
2039
+ def soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_with_http_info(
2040
+ self,
2041
+ soumettre_facture_complete_request: SoumettreFactureCompleteRequest,
2042
+ _request_timeout: Union[
2043
+ None,
2044
+ Annotated[StrictFloat, Field(gt=0)],
2045
+ Tuple[
2046
+ Annotated[StrictFloat, Field(gt=0)],
2047
+ Annotated[StrictFloat, Field(gt=0)]
2048
+ ]
2049
+ ] = None,
2050
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2051
+ _content_type: Optional[StrictStr] = None,
2052
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2053
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2054
+ ) -> ApiResponse[ReponseTache]:
2055
+ """Soumettre une facture complète (asynchrone avec Celery)
2056
+
2057
+ Version asynchrone de l'endpoint `/factures/soumettre-complete` utilisant Celery pour le traitement en arrière-plan. **Workflow automatisé (identique à la version synchrone) :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Différences avec la version synchrone :** - ✅ **Non-bloquant** : Retourne immédiatement un `id_tache` (HTTP 202 Accepted) - ✅ **Traitement en arrière-plan** : La facture est traitée par un worker Celery - ✅ **Suivi d'avancement** : Utilisez `/taches/{id_tache}/statut` pour suivre le statut - ✅ **Idéal pour gros volumes** : Permet de traiter de nombreuses factures en parallèle **Comment utiliser :** 1. **Soumission** : Appelez cet endpoint avec vos données de facture 2. **Retour immédiat** : Vous recevez un `id_tache` (ex: \"abc123-def456\") 3. **Suivi** : Appelez `/taches/{id_tache}/statut` pour vérifier l'avancement 4. **Résultat** : Quand `statut = \"SUCCESS\"`, le champ `resultat` contient la réponse complète **Credentials et signature** : Mêmes modes que la version synchrone (JWT ou payload).
2058
+
2059
+ :param soumettre_facture_complete_request: (required)
2060
+ :type soumettre_facture_complete_request: SoumettreFactureCompleteRequest
2061
+ :param _request_timeout: timeout setting for this request. If one
2062
+ number provided, it will be total request
2063
+ timeout. It can also be a pair (tuple) of
2064
+ (connection, read) timeouts.
2065
+ :type _request_timeout: int, tuple(int, int), optional
2066
+ :param _request_auth: set to override the auth_settings for an a single
2067
+ request; this effectively ignores the
2068
+ authentication in the spec for a single request.
2069
+ :type _request_auth: dict, optional
2070
+ :param _content_type: force content-type for the request.
2071
+ :type _content_type: str, Optional
2072
+ :param _headers: set to override the headers for a single
2073
+ request; this effectively ignores the headers
2074
+ in the spec for a single request.
2075
+ :type _headers: dict, optional
2076
+ :param _host_index: set to override the host_index for a single
2077
+ request; this effectively ignores the host_index
2078
+ in the spec for a single request.
2079
+ :type _host_index: int, optional
2080
+ :return: Returns the result object.
2081
+ """ # noqa: E501
2082
+
2083
+ _param = self._soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_serialize(
2084
+ soumettre_facture_complete_request=soumettre_facture_complete_request,
2085
+ _request_auth=_request_auth,
2086
+ _content_type=_content_type,
2087
+ _headers=_headers,
2088
+ _host_index=_host_index
2089
+ )
2090
+
2091
+ _response_types_map: Dict[str, Optional[str]] = {
2092
+ '202': "ReponseTache",
2093
+ '422': "HTTPValidationError",
2094
+ }
2095
+ response_data = self.api_client.call_api(
2096
+ *_param,
2097
+ _request_timeout=_request_timeout
2098
+ )
2099
+ response_data.read()
2100
+ return self.api_client.response_deserialize(
2101
+ response_data=response_data,
2102
+ response_types_map=_response_types_map,
2103
+ )
2104
+
2105
+
2106
+ @validate_call
2107
+ def soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_without_preload_content(
2108
+ self,
2109
+ soumettre_facture_complete_request: SoumettreFactureCompleteRequest,
2110
+ _request_timeout: Union[
2111
+ None,
2112
+ Annotated[StrictFloat, Field(gt=0)],
2113
+ Tuple[
2114
+ Annotated[StrictFloat, Field(gt=0)],
2115
+ Annotated[StrictFloat, Field(gt=0)]
2116
+ ]
2117
+ ] = None,
2118
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2119
+ _content_type: Optional[StrictStr] = None,
2120
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2121
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2122
+ ) -> RESTResponseType:
2123
+ """Soumettre une facture complète (asynchrone avec Celery)
2124
+
2125
+ Version asynchrone de l'endpoint `/factures/soumettre-complete` utilisant Celery pour le traitement en arrière-plan. **Workflow automatisé (identique à la version synchrone) :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Différences avec la version synchrone :** - ✅ **Non-bloquant** : Retourne immédiatement un `id_tache` (HTTP 202 Accepted) - ✅ **Traitement en arrière-plan** : La facture est traitée par un worker Celery - ✅ **Suivi d'avancement** : Utilisez `/taches/{id_tache}/statut` pour suivre le statut - ✅ **Idéal pour gros volumes** : Permet de traiter de nombreuses factures en parallèle **Comment utiliser :** 1. **Soumission** : Appelez cet endpoint avec vos données de facture 2. **Retour immédiat** : Vous recevez un `id_tache` (ex: \"abc123-def456\") 3. **Suivi** : Appelez `/taches/{id_tache}/statut` pour vérifier l'avancement 4. **Résultat** : Quand `statut = \"SUCCESS\"`, le champ `resultat` contient la réponse complète **Credentials et signature** : Mêmes modes que la version synchrone (JWT ou payload).
2126
+
2127
+ :param soumettre_facture_complete_request: (required)
2128
+ :type soumettre_facture_complete_request: SoumettreFactureCompleteRequest
2129
+ :param _request_timeout: timeout setting for this request. If one
2130
+ number provided, it will be total request
2131
+ timeout. It can also be a pair (tuple) of
2132
+ (connection, read) timeouts.
2133
+ :type _request_timeout: int, tuple(int, int), optional
2134
+ :param _request_auth: set to override the auth_settings for an a single
2135
+ request; this effectively ignores the
2136
+ authentication in the spec for a single request.
2137
+ :type _request_auth: dict, optional
2138
+ :param _content_type: force content-type for the request.
2139
+ :type _content_type: str, Optional
2140
+ :param _headers: set to override the headers for a single
2141
+ request; this effectively ignores the headers
2142
+ in the spec for a single request.
2143
+ :type _headers: dict, optional
2144
+ :param _host_index: set to override the host_index for a single
2145
+ request; this effectively ignores the host_index
2146
+ in the spec for a single request.
2147
+ :type _host_index: int, optional
2148
+ :return: Returns the result object.
2149
+ """ # noqa: E501
2150
+
2151
+ _param = self._soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_serialize(
2152
+ soumettre_facture_complete_request=soumettre_facture_complete_request,
2153
+ _request_auth=_request_auth,
2154
+ _content_type=_content_type,
2155
+ _headers=_headers,
2156
+ _host_index=_host_index
2157
+ )
2158
+
2159
+ _response_types_map: Dict[str, Optional[str]] = {
2160
+ '202': "ReponseTache",
2161
+ '422': "HTTPValidationError",
2162
+ }
2163
+ response_data = self.api_client.call_api(
2164
+ *_param,
2165
+ _request_timeout=_request_timeout
2166
+ )
2167
+ return response_data.response
2168
+
2169
+
2170
+ def _soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_serialize(
2171
+ self,
2172
+ soumettre_facture_complete_request,
2173
+ _request_auth,
2174
+ _content_type,
2175
+ _headers,
2176
+ _host_index,
2177
+ ) -> RequestSerialized:
2178
+
2179
+ _host = None
2180
+
2181
+ _collection_formats: Dict[str, str] = {
2182
+ }
2183
+
2184
+ _path_params: Dict[str, str] = {}
2185
+ _query_params: List[Tuple[str, str]] = []
2186
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2187
+ _form_params: List[Tuple[str, str]] = []
2188
+ _files: Dict[
2189
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2190
+ ] = {}
2191
+ _body_params: Optional[bytes] = None
2192
+
2193
+ # process the path parameters
2194
+ # process the query parameters
2195
+ # process the header parameters
2196
+ # process the form parameters
2197
+ # process the body parameter
2198
+ if soumettre_facture_complete_request is not None:
2199
+ _body_params = soumettre_facture_complete_request
2200
+
2201
+
2202
+ # set the HTTP header `Accept`
2203
+ if 'Accept' not in _header_params:
2204
+ _header_params['Accept'] = self.api_client.select_header_accept(
2205
+ [
2206
+ 'application/json'
2207
+ ]
2208
+ )
2209
+
2210
+ # set the HTTP header `Content-Type`
2211
+ if _content_type:
2212
+ _header_params['Content-Type'] = _content_type
2213
+ else:
2214
+ _default_content_type = (
2215
+ self.api_client.select_header_content_type(
2216
+ [
2217
+ 'application/json'
2218
+ ]
2219
+ )
2220
+ )
2221
+ if _default_content_type is not None:
2222
+ _header_params['Content-Type'] = _default_content_type
2223
+
2224
+ # authentication setting
2225
+ _auth_settings: List[str] = [
2226
+ 'HTTPBearer'
2227
+ ]
2228
+
2229
+ return self.api_client.param_serialize(
2230
+ method='POST',
2231
+ resource_path='/api/v1/traitement/factures/soumettre-complete-async',
2232
+ path_params=_path_params,
2233
+ query_params=_query_params,
2234
+ header_params=_header_params,
2235
+ body=_body_params,
2236
+ post_params=_form_params,
2237
+ files=_files,
2238
+ auth_settings=_auth_settings,
2239
+ collection_formats=_collection_formats,
2240
+ _host=_host,
2241
+ _request_auth=_request_auth
2242
+ )
2243
+
2244
+
2245
+
2246
+
2247
+ @validate_call
2248
+ def valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post(
2249
+ self,
2250
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF Factur-X à valider (format .pdf).")],
2251
+ profil: Optional[ProfilAPI] = None,
2252
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées.")] = None,
2253
+ _request_timeout: Union[
2254
+ None,
2255
+ Annotated[StrictFloat, Field(gt=0)],
2256
+ Tuple[
2257
+ Annotated[StrictFloat, Field(gt=0)],
2258
+ Annotated[StrictFloat, Field(gt=0)]
2259
+ ]
2260
+ ] = None,
2261
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2262
+ _content_type: Optional[StrictStr] = None,
2263
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2264
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2265
+ ) -> ResultatValidationPDFAPI:
2266
+ """Valider un PDF Factur-X complet
2267
+
2268
+ Valide un PDF Factur-X complet selon les normes européennes et françaises. ## Normes de validation appliquées - **EN 16931** : Norme sémantique européenne (directive 2014/55/UE) - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Factur-X / ZUGFeRD** : Spécification franco-allemande - **Schematron** : Validation des règles métier XML - **eIDAS** : Règlement européen sur l'identification électronique (signatures) ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X **Contrôles réalisés :** - Présence d'un fichier XML embarqué (`factur-x.xml` ou `zugferd-invoice.xml`) - Détection automatique du profil (MINIMUM, BASIC, EN16931, EXTENDED) - Parsing XML avec validation UTF-8 - Extraction du GuidelineSpecifiedDocumentContextParameter/ID **Validation Schematron :** - Règles métier du profil détecté (MINIMUM : 45 règles, EN16931 : 178 règles) - Cardinalité des éléments obligatoires - Cohérence des calculs (montants HT, TVA, TTC, remises) - Formats des identifiants (SIRET, TVA intracommunautaire, IBAN) - Codes normalisés (codes pays ISO, unités UN/ECE, codes TVA) **Ce qui est vérifié :** - ✅ Structure XML conforme XSD Cross Industry Invoice - ✅ Namespace UN/CEFACT correct - ✅ Règles de gestion européennes (BR-xx) - ✅ Règles françaises spécifiques (FR-xx) ### 2. Conformité PDF/A-3 **Validation de base (métadonnées) :** - Présence du champ `/Type` à `Catalog` - Métadonnée `pdfaid:part` = 3 (PDF/A-3) - Métadonnée `pdfaid:conformance` = B ou U - Version PDF >= 1.4 **Validation stricte VeraPDF (si use_verapdf=True) :** - 146+ règles ISO 19005-3 (PDF/A-3B) - Absence de contenu interdit (JavaScript, multimedia, formulaires dynamiques) - Polices embarquées et sous-ensembles corrects - Espaces colorimétriques conformes (sRGB, DeviceGray) - Structure de fichier valide (cross-reference table) - Métadonnées XMP conformes ISO 16684-1 **Ce qui est vérifié :** - ✅ Fichier archivable à long terme (20+ ans) - ✅ Lisibilité garantie (polices embarquées) - ✅ Conformité légale (France, Allemagne, UE) ### 3. Métadonnées XMP (eXtensible Metadata Platform) **Contrôles réalisés :** - Présence du bloc `<?xpacket>` avec métadonnées XMP - Namespace `fx:` pour Factur-X : `urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#` - Champs Factur-X obligatoires : - `fx:ConformanceLevel` : Profil (MINIMUM, BASIC, EN16931, EXTENDED) - `fx:DocumentFileName` : Nom du XML embarqué - `fx:DocumentType` : \"INVOICE\" - `fx:Version` : Version Factur-X (1.0.07) **Ce qui est vérifié :** - ✅ Métadonnées conformes ISO 16684-1 - ✅ Profil Factur-X déclaré correct - ✅ Version Factur-X supportée ### 4. Signatures électroniques **Détection et analyse :** - Présence de dictionnaires `/Sig` dans le PDF - Type de signature : PAdES (PDF Advanced Electronic Signature) - Extraction des informations : - Nom du signataire (`/Name`) - Date de signature (`/M`) - Raison de la signature (`/Reason`) - Lieu de signature (`/Location`) - Type de signature (approval, certification) **Ce qui est vérifié :** - ✅ Présence de signatures ou cachets - ✅ Nombre de signatures (mono ou multi-signature) - ℹ️ Pas de vérification cryptographique (nécessite certificats) ## Paramètres - **fichier_pdf** (requis) : Le fichier PDF Factur-X à valider - **profil** (optionnel) : Profil attendu. Si absent, détection automatique depuis le XML - **use_verapdf** (optionnel, défaut=false) : Active la validation stricte PDF/A avec VeraPDF - `false` : Validation rapide par métadonnées (2-3 secondes) - `true` : Validation complète ISO 19005-3 (15-30 secondes, **recommandé en production**) ## Réponse détaillée ```json { \"est_conforme\": true, \"xml\": { \"present\": true, \"conforme\": true, \"profil\": \"EN16931\", \"erreurs\": [] }, \"pdfa\": { \"conforme\": true, \"version\": \"PDF/A-3B\", \"methode\": \"verapdf\", \"erreurs\": [] }, \"xmp\": { \"present\": true, \"conforme\": true, \"metadonnees\": {...} }, \"signatures\": { \"present\": true, \"nombre\": 1, \"details\": [...] } } ``` ## Cas d'usage - **Avant envoi** : Valider la facture générée avant transmission à un client - **À réception** : Vérifier la conformité d'une facture reçue d'un fournisseur - **Audit** : Contrôler la qualité de lots de factures - **Conformité légale** : S'assurer du respect des obligations B2B/B2G en France - **Debugging** : Identifier les problèmes dans le processus de génération - **Archivage** : Garantir la validité à long terme (PDF/A-3) ## Temps de traitement - Validation basique : 2-3 secondes - Validation VeraPDF : 15-30 secondes (dépend de la taille du PDF)
2269
+
2270
+ :param fichier_pdf: Fichier PDF Factur-X à valider (format .pdf). (required)
2271
+ :type fichier_pdf: bytearray
2272
+ :param profil:
2273
+ :type profil: ProfilAPI
2274
+ :param use_verapdf: Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées.
2275
+ :type use_verapdf: bool
2276
+ :param _request_timeout: timeout setting for this request. If one
2277
+ number provided, it will be total request
2278
+ timeout. It can also be a pair (tuple) of
2279
+ (connection, read) timeouts.
2280
+ :type _request_timeout: int, tuple(int, int), optional
2281
+ :param _request_auth: set to override the auth_settings for an a single
2282
+ request; this effectively ignores the
2283
+ authentication in the spec for a single request.
2284
+ :type _request_auth: dict, optional
2285
+ :param _content_type: force content-type for the request.
2286
+ :type _content_type: str, Optional
2287
+ :param _headers: set to override the headers for a single
2288
+ request; this effectively ignores the headers
2289
+ in the spec for a single request.
2290
+ :type _headers: dict, optional
2291
+ :param _host_index: set to override the host_index for a single
2292
+ request; this effectively ignores the host_index
2293
+ in the spec for a single request.
2294
+ :type _host_index: int, optional
2295
+ :return: Returns the result object.
2296
+ """ # noqa: E501
2297
+
2298
+ _param = self._valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_serialize(
2299
+ fichier_pdf=fichier_pdf,
2300
+ profil=profil,
2301
+ use_verapdf=use_verapdf,
2302
+ _request_auth=_request_auth,
2303
+ _content_type=_content_type,
2304
+ _headers=_headers,
2305
+ _host_index=_host_index
2306
+ )
2307
+
2308
+ _response_types_map: Dict[str, Optional[str]] = {
2309
+ '200': "ResultatValidationPDFAPI",
2310
+ '400': None,
2311
+ '422': "HTTPValidationError",
2312
+ }
2313
+ response_data = self.api_client.call_api(
2314
+ *_param,
2315
+ _request_timeout=_request_timeout
2316
+ )
2317
+ response_data.read()
2318
+ return self.api_client.response_deserialize(
2319
+ response_data=response_data,
2320
+ response_types_map=_response_types_map,
2321
+ ).data
2322
+
2323
+
2324
+ @validate_call
2325
+ def valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_with_http_info(
2326
+ self,
2327
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF Factur-X à valider (format .pdf).")],
2328
+ profil: Optional[ProfilAPI] = None,
2329
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées.")] = None,
2330
+ _request_timeout: Union[
2331
+ None,
2332
+ Annotated[StrictFloat, Field(gt=0)],
2333
+ Tuple[
2334
+ Annotated[StrictFloat, Field(gt=0)],
2335
+ Annotated[StrictFloat, Field(gt=0)]
2336
+ ]
2337
+ ] = None,
2338
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2339
+ _content_type: Optional[StrictStr] = None,
2340
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2341
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2342
+ ) -> ApiResponse[ResultatValidationPDFAPI]:
2343
+ """Valider un PDF Factur-X complet
2344
+
2345
+ Valide un PDF Factur-X complet selon les normes européennes et françaises. ## Normes de validation appliquées - **EN 16931** : Norme sémantique européenne (directive 2014/55/UE) - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Factur-X / ZUGFeRD** : Spécification franco-allemande - **Schematron** : Validation des règles métier XML - **eIDAS** : Règlement européen sur l'identification électronique (signatures) ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X **Contrôles réalisés :** - Présence d'un fichier XML embarqué (`factur-x.xml` ou `zugferd-invoice.xml`) - Détection automatique du profil (MINIMUM, BASIC, EN16931, EXTENDED) - Parsing XML avec validation UTF-8 - Extraction du GuidelineSpecifiedDocumentContextParameter/ID **Validation Schematron :** - Règles métier du profil détecté (MINIMUM : 45 règles, EN16931 : 178 règles) - Cardinalité des éléments obligatoires - Cohérence des calculs (montants HT, TVA, TTC, remises) - Formats des identifiants (SIRET, TVA intracommunautaire, IBAN) - Codes normalisés (codes pays ISO, unités UN/ECE, codes TVA) **Ce qui est vérifié :** - ✅ Structure XML conforme XSD Cross Industry Invoice - ✅ Namespace UN/CEFACT correct - ✅ Règles de gestion européennes (BR-xx) - ✅ Règles françaises spécifiques (FR-xx) ### 2. Conformité PDF/A-3 **Validation de base (métadonnées) :** - Présence du champ `/Type` à `Catalog` - Métadonnée `pdfaid:part` = 3 (PDF/A-3) - Métadonnée `pdfaid:conformance` = B ou U - Version PDF >= 1.4 **Validation stricte VeraPDF (si use_verapdf=True) :** - 146+ règles ISO 19005-3 (PDF/A-3B) - Absence de contenu interdit (JavaScript, multimedia, formulaires dynamiques) - Polices embarquées et sous-ensembles corrects - Espaces colorimétriques conformes (sRGB, DeviceGray) - Structure de fichier valide (cross-reference table) - Métadonnées XMP conformes ISO 16684-1 **Ce qui est vérifié :** - ✅ Fichier archivable à long terme (20+ ans) - ✅ Lisibilité garantie (polices embarquées) - ✅ Conformité légale (France, Allemagne, UE) ### 3. Métadonnées XMP (eXtensible Metadata Platform) **Contrôles réalisés :** - Présence du bloc `<?xpacket>` avec métadonnées XMP - Namespace `fx:` pour Factur-X : `urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#` - Champs Factur-X obligatoires : - `fx:ConformanceLevel` : Profil (MINIMUM, BASIC, EN16931, EXTENDED) - `fx:DocumentFileName` : Nom du XML embarqué - `fx:DocumentType` : \"INVOICE\" - `fx:Version` : Version Factur-X (1.0.07) **Ce qui est vérifié :** - ✅ Métadonnées conformes ISO 16684-1 - ✅ Profil Factur-X déclaré correct - ✅ Version Factur-X supportée ### 4. Signatures électroniques **Détection et analyse :** - Présence de dictionnaires `/Sig` dans le PDF - Type de signature : PAdES (PDF Advanced Electronic Signature) - Extraction des informations : - Nom du signataire (`/Name`) - Date de signature (`/M`) - Raison de la signature (`/Reason`) - Lieu de signature (`/Location`) - Type de signature (approval, certification) **Ce qui est vérifié :** - ✅ Présence de signatures ou cachets - ✅ Nombre de signatures (mono ou multi-signature) - ℹ️ Pas de vérification cryptographique (nécessite certificats) ## Paramètres - **fichier_pdf** (requis) : Le fichier PDF Factur-X à valider - **profil** (optionnel) : Profil attendu. Si absent, détection automatique depuis le XML - **use_verapdf** (optionnel, défaut=false) : Active la validation stricte PDF/A avec VeraPDF - `false` : Validation rapide par métadonnées (2-3 secondes) - `true` : Validation complète ISO 19005-3 (15-30 secondes, **recommandé en production**) ## Réponse détaillée ```json { \"est_conforme\": true, \"xml\": { \"present\": true, \"conforme\": true, \"profil\": \"EN16931\", \"erreurs\": [] }, \"pdfa\": { \"conforme\": true, \"version\": \"PDF/A-3B\", \"methode\": \"verapdf\", \"erreurs\": [] }, \"xmp\": { \"present\": true, \"conforme\": true, \"metadonnees\": {...} }, \"signatures\": { \"present\": true, \"nombre\": 1, \"details\": [...] } } ``` ## Cas d'usage - **Avant envoi** : Valider la facture générée avant transmission à un client - **À réception** : Vérifier la conformité d'une facture reçue d'un fournisseur - **Audit** : Contrôler la qualité de lots de factures - **Conformité légale** : S'assurer du respect des obligations B2B/B2G en France - **Debugging** : Identifier les problèmes dans le processus de génération - **Archivage** : Garantir la validité à long terme (PDF/A-3) ## Temps de traitement - Validation basique : 2-3 secondes - Validation VeraPDF : 15-30 secondes (dépend de la taille du PDF)
2346
+
2347
+ :param fichier_pdf: Fichier PDF Factur-X à valider (format .pdf). (required)
2348
+ :type fichier_pdf: bytearray
2349
+ :param profil:
2350
+ :type profil: ProfilAPI
2351
+ :param use_verapdf: Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées.
2352
+ :type use_verapdf: bool
2353
+ :param _request_timeout: timeout setting for this request. If one
2354
+ number provided, it will be total request
2355
+ timeout. It can also be a pair (tuple) of
2356
+ (connection, read) timeouts.
2357
+ :type _request_timeout: int, tuple(int, int), optional
2358
+ :param _request_auth: set to override the auth_settings for an a single
2359
+ request; this effectively ignores the
2360
+ authentication in the spec for a single request.
2361
+ :type _request_auth: dict, optional
2362
+ :param _content_type: force content-type for the request.
2363
+ :type _content_type: str, Optional
2364
+ :param _headers: set to override the headers for a single
2365
+ request; this effectively ignores the headers
2366
+ in the spec for a single request.
2367
+ :type _headers: dict, optional
2368
+ :param _host_index: set to override the host_index for a single
2369
+ request; this effectively ignores the host_index
2370
+ in the spec for a single request.
2371
+ :type _host_index: int, optional
2372
+ :return: Returns the result object.
2373
+ """ # noqa: E501
2374
+
2375
+ _param = self._valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_serialize(
2376
+ fichier_pdf=fichier_pdf,
2377
+ profil=profil,
2378
+ use_verapdf=use_verapdf,
2379
+ _request_auth=_request_auth,
2380
+ _content_type=_content_type,
2381
+ _headers=_headers,
2382
+ _host_index=_host_index
2383
+ )
2384
+
2385
+ _response_types_map: Dict[str, Optional[str]] = {
2386
+ '200': "ResultatValidationPDFAPI",
2387
+ '400': None,
2388
+ '422': "HTTPValidationError",
2389
+ }
2390
+ response_data = self.api_client.call_api(
2391
+ *_param,
2392
+ _request_timeout=_request_timeout
2393
+ )
2394
+ response_data.read()
2395
+ return self.api_client.response_deserialize(
2396
+ response_data=response_data,
2397
+ response_types_map=_response_types_map,
2398
+ )
2399
+
2400
+
2401
+ @validate_call
2402
+ def valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_without_preload_content(
2403
+ self,
2404
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF Factur-X à valider (format .pdf).")],
2405
+ profil: Optional[ProfilAPI] = None,
2406
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées.")] = None,
2407
+ _request_timeout: Union[
2408
+ None,
2409
+ Annotated[StrictFloat, Field(gt=0)],
2410
+ Tuple[
2411
+ Annotated[StrictFloat, Field(gt=0)],
2412
+ Annotated[StrictFloat, Field(gt=0)]
2413
+ ]
2414
+ ] = None,
2415
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2416
+ _content_type: Optional[StrictStr] = None,
2417
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2418
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2419
+ ) -> RESTResponseType:
2420
+ """Valider un PDF Factur-X complet
2421
+
2422
+ Valide un PDF Factur-X complet selon les normes européennes et françaises. ## Normes de validation appliquées - **EN 16931** : Norme sémantique européenne (directive 2014/55/UE) - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Factur-X / ZUGFeRD** : Spécification franco-allemande - **Schematron** : Validation des règles métier XML - **eIDAS** : Règlement européen sur l'identification électronique (signatures) ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X **Contrôles réalisés :** - Présence d'un fichier XML embarqué (`factur-x.xml` ou `zugferd-invoice.xml`) - Détection automatique du profil (MINIMUM, BASIC, EN16931, EXTENDED) - Parsing XML avec validation UTF-8 - Extraction du GuidelineSpecifiedDocumentContextParameter/ID **Validation Schematron :** - Règles métier du profil détecté (MINIMUM : 45 règles, EN16931 : 178 règles) - Cardinalité des éléments obligatoires - Cohérence des calculs (montants HT, TVA, TTC, remises) - Formats des identifiants (SIRET, TVA intracommunautaire, IBAN) - Codes normalisés (codes pays ISO, unités UN/ECE, codes TVA) **Ce qui est vérifié :** - ✅ Structure XML conforme XSD Cross Industry Invoice - ✅ Namespace UN/CEFACT correct - ✅ Règles de gestion européennes (BR-xx) - ✅ Règles françaises spécifiques (FR-xx) ### 2. Conformité PDF/A-3 **Validation de base (métadonnées) :** - Présence du champ `/Type` à `Catalog` - Métadonnée `pdfaid:part` = 3 (PDF/A-3) - Métadonnée `pdfaid:conformance` = B ou U - Version PDF >= 1.4 **Validation stricte VeraPDF (si use_verapdf=True) :** - 146+ règles ISO 19005-3 (PDF/A-3B) - Absence de contenu interdit (JavaScript, multimedia, formulaires dynamiques) - Polices embarquées et sous-ensembles corrects - Espaces colorimétriques conformes (sRGB, DeviceGray) - Structure de fichier valide (cross-reference table) - Métadonnées XMP conformes ISO 16684-1 **Ce qui est vérifié :** - ✅ Fichier archivable à long terme (20+ ans) - ✅ Lisibilité garantie (polices embarquées) - ✅ Conformité légale (France, Allemagne, UE) ### 3. Métadonnées XMP (eXtensible Metadata Platform) **Contrôles réalisés :** - Présence du bloc `<?xpacket>` avec métadonnées XMP - Namespace `fx:` pour Factur-X : `urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#` - Champs Factur-X obligatoires : - `fx:ConformanceLevel` : Profil (MINIMUM, BASIC, EN16931, EXTENDED) - `fx:DocumentFileName` : Nom du XML embarqué - `fx:DocumentType` : \"INVOICE\" - `fx:Version` : Version Factur-X (1.0.07) **Ce qui est vérifié :** - ✅ Métadonnées conformes ISO 16684-1 - ✅ Profil Factur-X déclaré correct - ✅ Version Factur-X supportée ### 4. Signatures électroniques **Détection et analyse :** - Présence de dictionnaires `/Sig` dans le PDF - Type de signature : PAdES (PDF Advanced Electronic Signature) - Extraction des informations : - Nom du signataire (`/Name`) - Date de signature (`/M`) - Raison de la signature (`/Reason`) - Lieu de signature (`/Location`) - Type de signature (approval, certification) **Ce qui est vérifié :** - ✅ Présence de signatures ou cachets - ✅ Nombre de signatures (mono ou multi-signature) - ℹ️ Pas de vérification cryptographique (nécessite certificats) ## Paramètres - **fichier_pdf** (requis) : Le fichier PDF Factur-X à valider - **profil** (optionnel) : Profil attendu. Si absent, détection automatique depuis le XML - **use_verapdf** (optionnel, défaut=false) : Active la validation stricte PDF/A avec VeraPDF - `false` : Validation rapide par métadonnées (2-3 secondes) - `true` : Validation complète ISO 19005-3 (15-30 secondes, **recommandé en production**) ## Réponse détaillée ```json { \"est_conforme\": true, \"xml\": { \"present\": true, \"conforme\": true, \"profil\": \"EN16931\", \"erreurs\": [] }, \"pdfa\": { \"conforme\": true, \"version\": \"PDF/A-3B\", \"methode\": \"verapdf\", \"erreurs\": [] }, \"xmp\": { \"present\": true, \"conforme\": true, \"metadonnees\": {...} }, \"signatures\": { \"present\": true, \"nombre\": 1, \"details\": [...] } } ``` ## Cas d'usage - **Avant envoi** : Valider la facture générée avant transmission à un client - **À réception** : Vérifier la conformité d'une facture reçue d'un fournisseur - **Audit** : Contrôler la qualité de lots de factures - **Conformité légale** : S'assurer du respect des obligations B2B/B2G en France - **Debugging** : Identifier les problèmes dans le processus de génération - **Archivage** : Garantir la validité à long terme (PDF/A-3) ## Temps de traitement - Validation basique : 2-3 secondes - Validation VeraPDF : 15-30 secondes (dépend de la taille du PDF)
2423
+
2424
+ :param fichier_pdf: Fichier PDF Factur-X à valider (format .pdf). (required)
2425
+ :type fichier_pdf: bytearray
2426
+ :param profil:
2427
+ :type profil: ProfilAPI
2428
+ :param use_verapdf: Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées.
2429
+ :type use_verapdf: bool
2430
+ :param _request_timeout: timeout setting for this request. If one
2431
+ number provided, it will be total request
2432
+ timeout. It can also be a pair (tuple) of
2433
+ (connection, read) timeouts.
2434
+ :type _request_timeout: int, tuple(int, int), optional
2435
+ :param _request_auth: set to override the auth_settings for an a single
2436
+ request; this effectively ignores the
2437
+ authentication in the spec for a single request.
2438
+ :type _request_auth: dict, optional
2439
+ :param _content_type: force content-type for the request.
2440
+ :type _content_type: str, Optional
2441
+ :param _headers: set to override the headers for a single
2442
+ request; this effectively ignores the headers
2443
+ in the spec for a single request.
2444
+ :type _headers: dict, optional
2445
+ :param _host_index: set to override the host_index for a single
2446
+ request; this effectively ignores the host_index
2447
+ in the spec for a single request.
2448
+ :type _host_index: int, optional
2449
+ :return: Returns the result object.
2450
+ """ # noqa: E501
2451
+
2452
+ _param = self._valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_serialize(
2453
+ fichier_pdf=fichier_pdf,
2454
+ profil=profil,
2455
+ use_verapdf=use_verapdf,
2456
+ _request_auth=_request_auth,
2457
+ _content_type=_content_type,
2458
+ _headers=_headers,
2459
+ _host_index=_host_index
2460
+ )
2461
+
2462
+ _response_types_map: Dict[str, Optional[str]] = {
2463
+ '200': "ResultatValidationPDFAPI",
2464
+ '400': None,
2465
+ '422': "HTTPValidationError",
2466
+ }
2467
+ response_data = self.api_client.call_api(
2468
+ *_param,
2469
+ _request_timeout=_request_timeout
2470
+ )
2471
+ return response_data.response
2472
+
2473
+
2474
+ def _valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_serialize(
2475
+ self,
2476
+ fichier_pdf,
2477
+ profil,
2478
+ use_verapdf,
2479
+ _request_auth,
2480
+ _content_type,
2481
+ _headers,
2482
+ _host_index,
2483
+ ) -> RequestSerialized:
2484
+
2485
+ _host = None
2486
+
2487
+ _collection_formats: Dict[str, str] = {
2488
+ }
2489
+
2490
+ _path_params: Dict[str, str] = {}
2491
+ _query_params: List[Tuple[str, str]] = []
2492
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2493
+ _form_params: List[Tuple[str, str]] = []
2494
+ _files: Dict[
2495
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2496
+ ] = {}
2497
+ _body_params: Optional[bytes] = None
2498
+
2499
+ # process the path parameters
2500
+ # process the query parameters
2501
+ # process the header parameters
2502
+ # process the form parameters
2503
+ if fichier_pdf is not None:
2504
+ _files['fichier_pdf'] = fichier_pdf
2505
+ if profil is not None:
2506
+ _form_params.append(('profil', profil))
2507
+ if use_verapdf is not None:
2508
+ _form_params.append(('use_verapdf', use_verapdf))
2509
+ # process the body parameter
2510
+
2511
+
2512
+ # set the HTTP header `Accept`
2513
+ if 'Accept' not in _header_params:
2514
+ _header_params['Accept'] = self.api_client.select_header_accept(
2515
+ [
2516
+ 'application/json'
2517
+ ]
2518
+ )
2519
+
2520
+ # set the HTTP header `Content-Type`
2521
+ if _content_type:
2522
+ _header_params['Content-Type'] = _content_type
2523
+ else:
2524
+ _default_content_type = (
2525
+ self.api_client.select_header_content_type(
2526
+ [
2527
+ 'multipart/form-data'
2528
+ ]
2529
+ )
2530
+ )
2531
+ if _default_content_type is not None:
2532
+ _header_params['Content-Type'] = _default_content_type
2533
+
2534
+ # authentication setting
2535
+ _auth_settings: List[str] = [
2536
+ 'HTTPBearer'
2537
+ ]
2538
+
2539
+ return self.api_client.param_serialize(
2540
+ method='POST',
2541
+ resource_path='/api/v1/traitement/valider-pdf-facturx',
2542
+ path_params=_path_params,
2543
+ query_params=_query_params,
2544
+ header_params=_header_params,
2545
+ body=_body_params,
2546
+ post_params=_form_params,
2547
+ files=_files,
2548
+ auth_settings=_auth_settings,
2549
+ collection_formats=_collection_formats,
2550
+ _host=_host,
2551
+ _request_auth=_request_auth
2552
+ )
2553
+
2554
+
2555
+
2556
+
2557
+ @validate_call
2558
+ def valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post(
2559
+ self,
2560
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF Factur-X à valider (format .pdf).")],
2561
+ profil: Optional[ProfilAPI] = None,
2562
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes.")] = None,
2563
+ _request_timeout: Union[
2564
+ None,
2565
+ Annotated[StrictFloat, Field(gt=0)],
2566
+ Tuple[
2567
+ Annotated[StrictFloat, Field(gt=0)],
2568
+ Annotated[StrictFloat, Field(gt=0)]
2569
+ ]
2570
+ ] = None,
2571
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2572
+ _content_type: Optional[StrictStr] = None,
2573
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2574
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2575
+ ) -> ReponseTache:
2576
+ """Valider un PDF Factur-X (asynchrone avec polling)
2577
+
2578
+ Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['message_erreur']}\") break time.sleep(2) # Attendre 2 secondes avant le prochain check ``` ## Cas d'usage - Valider des factures avant envoi avec VeraPDF (validation stricte) - Traiter des lots de factures en parallèle - Intégrer la validation dans un pipeline asynchrone - Valider des PDFs volumineux sans risque de timeout
2579
+
2580
+ :param fichier_pdf: Fichier PDF Factur-X à valider (format .pdf). (required)
2581
+ :type fichier_pdf: bytearray
2582
+ :param profil:
2583
+ :type profil: ProfilAPI
2584
+ :param use_verapdf: Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes.
2585
+ :type use_verapdf: bool
2586
+ :param _request_timeout: timeout setting for this request. If one
2587
+ number provided, it will be total request
2588
+ timeout. It can also be a pair (tuple) of
2589
+ (connection, read) timeouts.
2590
+ :type _request_timeout: int, tuple(int, int), optional
2591
+ :param _request_auth: set to override the auth_settings for an a single
2592
+ request; this effectively ignores the
2593
+ authentication in the spec for a single request.
2594
+ :type _request_auth: dict, optional
2595
+ :param _content_type: force content-type for the request.
2596
+ :type _content_type: str, Optional
2597
+ :param _headers: set to override the headers for a single
2598
+ request; this effectively ignores the headers
2599
+ in the spec for a single request.
2600
+ :type _headers: dict, optional
2601
+ :param _host_index: set to override the host_index for a single
2602
+ request; this effectively ignores the host_index
2603
+ in the spec for a single request.
2604
+ :type _host_index: int, optional
2605
+ :return: Returns the result object.
2606
+ """ # noqa: E501
2607
+
2608
+ _param = self._valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_serialize(
2609
+ fichier_pdf=fichier_pdf,
2610
+ profil=profil,
2611
+ use_verapdf=use_verapdf,
2612
+ _request_auth=_request_auth,
2613
+ _content_type=_content_type,
2614
+ _headers=_headers,
2615
+ _host_index=_host_index
2616
+ )
2617
+
2618
+ _response_types_map: Dict[str, Optional[str]] = {
2619
+ '202': "ReponseTache",
2620
+ '400': None,
2621
+ '422': "HTTPValidationError",
2622
+ }
2623
+ response_data = self.api_client.call_api(
2624
+ *_param,
2625
+ _request_timeout=_request_timeout
2626
+ )
2627
+ response_data.read()
2628
+ return self.api_client.response_deserialize(
2629
+ response_data=response_data,
2630
+ response_types_map=_response_types_map,
2631
+ ).data
2632
+
2633
+
2634
+ @validate_call
2635
+ def valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_with_http_info(
2636
+ self,
2637
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF Factur-X à valider (format .pdf).")],
2638
+ profil: Optional[ProfilAPI] = None,
2639
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes.")] = None,
2640
+ _request_timeout: Union[
2641
+ None,
2642
+ Annotated[StrictFloat, Field(gt=0)],
2643
+ Tuple[
2644
+ Annotated[StrictFloat, Field(gt=0)],
2645
+ Annotated[StrictFloat, Field(gt=0)]
2646
+ ]
2647
+ ] = None,
2648
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2649
+ _content_type: Optional[StrictStr] = None,
2650
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2651
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2652
+ ) -> ApiResponse[ReponseTache]:
2653
+ """Valider un PDF Factur-X (asynchrone avec polling)
2654
+
2655
+ Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['message_erreur']}\") break time.sleep(2) # Attendre 2 secondes avant le prochain check ``` ## Cas d'usage - Valider des factures avant envoi avec VeraPDF (validation stricte) - Traiter des lots de factures en parallèle - Intégrer la validation dans un pipeline asynchrone - Valider des PDFs volumineux sans risque de timeout
2656
+
2657
+ :param fichier_pdf: Fichier PDF Factur-X à valider (format .pdf). (required)
2658
+ :type fichier_pdf: bytearray
2659
+ :param profil:
2660
+ :type profil: ProfilAPI
2661
+ :param use_verapdf: Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes.
2662
+ :type use_verapdf: bool
2663
+ :param _request_timeout: timeout setting for this request. If one
2664
+ number provided, it will be total request
2665
+ timeout. It can also be a pair (tuple) of
2666
+ (connection, read) timeouts.
2667
+ :type _request_timeout: int, tuple(int, int), optional
2668
+ :param _request_auth: set to override the auth_settings for an a single
2669
+ request; this effectively ignores the
2670
+ authentication in the spec for a single request.
2671
+ :type _request_auth: dict, optional
2672
+ :param _content_type: force content-type for the request.
2673
+ :type _content_type: str, Optional
2674
+ :param _headers: set to override the headers for a single
2675
+ request; this effectively ignores the headers
2676
+ in the spec for a single request.
2677
+ :type _headers: dict, optional
2678
+ :param _host_index: set to override the host_index for a single
2679
+ request; this effectively ignores the host_index
2680
+ in the spec for a single request.
2681
+ :type _host_index: int, optional
2682
+ :return: Returns the result object.
2683
+ """ # noqa: E501
2684
+
2685
+ _param = self._valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_serialize(
2686
+ fichier_pdf=fichier_pdf,
2687
+ profil=profil,
2688
+ use_verapdf=use_verapdf,
2689
+ _request_auth=_request_auth,
2690
+ _content_type=_content_type,
2691
+ _headers=_headers,
2692
+ _host_index=_host_index
2693
+ )
2694
+
2695
+ _response_types_map: Dict[str, Optional[str]] = {
2696
+ '202': "ReponseTache",
2697
+ '400': None,
2698
+ '422': "HTTPValidationError",
2699
+ }
2700
+ response_data = self.api_client.call_api(
2701
+ *_param,
2702
+ _request_timeout=_request_timeout
2703
+ )
2704
+ response_data.read()
2705
+ return self.api_client.response_deserialize(
2706
+ response_data=response_data,
2707
+ response_types_map=_response_types_map,
2708
+ )
2709
+
2710
+
2711
+ @validate_call
2712
+ def valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_without_preload_content(
2713
+ self,
2714
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF Factur-X à valider (format .pdf).")],
2715
+ profil: Optional[ProfilAPI] = None,
2716
+ use_verapdf: Annotated[Optional[StrictBool], Field(description="Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes.")] = None,
2717
+ _request_timeout: Union[
2718
+ None,
2719
+ Annotated[StrictFloat, Field(gt=0)],
2720
+ Tuple[
2721
+ Annotated[StrictFloat, Field(gt=0)],
2722
+ Annotated[StrictFloat, Field(gt=0)]
2723
+ ]
2724
+ ] = None,
2725
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2726
+ _content_type: Optional[StrictStr] = None,
2727
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2728
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2729
+ ) -> RESTResponseType:
2730
+ """Valider un PDF Factur-X (asynchrone avec polling)
2731
+
2732
+ Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['message_erreur']}\") break time.sleep(2) # Attendre 2 secondes avant le prochain check ``` ## Cas d'usage - Valider des factures avant envoi avec VeraPDF (validation stricte) - Traiter des lots de factures en parallèle - Intégrer la validation dans un pipeline asynchrone - Valider des PDFs volumineux sans risque de timeout
2733
+
2734
+ :param fichier_pdf: Fichier PDF Factur-X à valider (format .pdf). (required)
2735
+ :type fichier_pdf: bytearray
2736
+ :param profil:
2737
+ :type profil: ProfilAPI
2738
+ :param use_verapdf: Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes.
2739
+ :type use_verapdf: bool
2740
+ :param _request_timeout: timeout setting for this request. If one
2741
+ number provided, it will be total request
2742
+ timeout. It can also be a pair (tuple) of
2743
+ (connection, read) timeouts.
2744
+ :type _request_timeout: int, tuple(int, int), optional
2745
+ :param _request_auth: set to override the auth_settings for an a single
2746
+ request; this effectively ignores the
2747
+ authentication in the spec for a single request.
2748
+ :type _request_auth: dict, optional
2749
+ :param _content_type: force content-type for the request.
2750
+ :type _content_type: str, Optional
2751
+ :param _headers: set to override the headers for a single
2752
+ request; this effectively ignores the headers
2753
+ in the spec for a single request.
2754
+ :type _headers: dict, optional
2755
+ :param _host_index: set to override the host_index for a single
2756
+ request; this effectively ignores the host_index
2757
+ in the spec for a single request.
2758
+ :type _host_index: int, optional
2759
+ :return: Returns the result object.
2760
+ """ # noqa: E501
2761
+
2762
+ _param = self._valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_serialize(
2763
+ fichier_pdf=fichier_pdf,
2764
+ profil=profil,
2765
+ use_verapdf=use_verapdf,
2766
+ _request_auth=_request_auth,
2767
+ _content_type=_content_type,
2768
+ _headers=_headers,
2769
+ _host_index=_host_index
2770
+ )
2771
+
2772
+ _response_types_map: Dict[str, Optional[str]] = {
2773
+ '202': "ReponseTache",
2774
+ '400': None,
2775
+ '422': "HTTPValidationError",
2776
+ }
2777
+ response_data = self.api_client.call_api(
2778
+ *_param,
2779
+ _request_timeout=_request_timeout
2780
+ )
2781
+ return response_data.response
2782
+
2783
+
2784
+ def _valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_serialize(
2785
+ self,
2786
+ fichier_pdf,
2787
+ profil,
2788
+ use_verapdf,
2789
+ _request_auth,
2790
+ _content_type,
2791
+ _headers,
2792
+ _host_index,
2793
+ ) -> RequestSerialized:
2794
+
2795
+ _host = None
2796
+
2797
+ _collection_formats: Dict[str, str] = {
2798
+ }
2799
+
2800
+ _path_params: Dict[str, str] = {}
2801
+ _query_params: List[Tuple[str, str]] = []
2802
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2803
+ _form_params: List[Tuple[str, str]] = []
2804
+ _files: Dict[
2805
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2806
+ ] = {}
2807
+ _body_params: Optional[bytes] = None
2808
+
2809
+ # process the path parameters
2810
+ # process the query parameters
2811
+ # process the header parameters
2812
+ # process the form parameters
2813
+ if fichier_pdf is not None:
2814
+ _files['fichier_pdf'] = fichier_pdf
2815
+ if profil is not None:
2816
+ _form_params.append(('profil', profil))
2817
+ if use_verapdf is not None:
2818
+ _form_params.append(('use_verapdf', use_verapdf))
2819
+ # process the body parameter
2820
+
2821
+
2822
+ # set the HTTP header `Accept`
2823
+ if 'Accept' not in _header_params:
2824
+ _header_params['Accept'] = self.api_client.select_header_accept(
2825
+ [
2826
+ 'application/json'
2827
+ ]
2828
+ )
2829
+
2830
+ # set the HTTP header `Content-Type`
2831
+ if _content_type:
2832
+ _header_params['Content-Type'] = _content_type
2833
+ else:
2834
+ _default_content_type = (
2835
+ self.api_client.select_header_content_type(
2836
+ [
2837
+ 'multipart/form-data'
2838
+ ]
2839
+ )
2840
+ )
2841
+ if _default_content_type is not None:
2842
+ _header_params['Content-Type'] = _default_content_type
2843
+
2844
+ # authentication setting
2845
+ _auth_settings: List[str] = [
2846
+ 'HTTPBearer'
2847
+ ]
2848
+
2849
+ return self.api_client.param_serialize(
2850
+ method='POST',
2851
+ resource_path='/api/v1/traitement/valider-facturx-async',
2852
+ path_params=_path_params,
2853
+ query_params=_query_params,
2854
+ header_params=_header_params,
2855
+ body=_body_params,
2856
+ post_params=_form_params,
2857
+ files=_files,
2858
+ auth_settings=_auth_settings,
2859
+ collection_formats=_collection_formats,
2860
+ _host=_host,
2861
+ _request_auth=_request_auth
2862
+ )
2863
+
2864
+
2865
+
2866
+
2867
+ @validate_call
2868
+ def valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post(
2869
+ self,
2870
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à valider (sera analysé pour détecter et valider les signatures)")],
2871
+ _request_timeout: Union[
2872
+ None,
2873
+ Annotated[StrictFloat, Field(gt=0)],
2874
+ Tuple[
2875
+ Annotated[StrictFloat, Field(gt=0)],
2876
+ Annotated[StrictFloat, Field(gt=0)]
2877
+ ]
2878
+ ] = None,
2879
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2880
+ _content_type: Optional[StrictStr] = None,
2881
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2882
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2883
+ ) -> object:
2884
+ """Valider les signatures électroniques d'un PDF
2885
+
2886
+ Valide les signatures électroniques présentes dans un PDF uploadé. **Vérifications effectuées** : - Présence de signatures - Intégrité du document (non modifié depuis signature) - Validité des certificats - Chaîne de confiance (si disponible) - Présence d'horodatage (PAdES-B-T) - Données de validation (PAdES-B-LT) **Standards supportés** : PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note** : Cette validation est technique (intégrité cryptographique). La validité juridique dépend du niveau eIDAS du certificat (SES/AdES/QES) et du contexte d'utilisation.
2887
+
2888
+ :param fichier_pdf: Fichier PDF à valider (sera analysé pour détecter et valider les signatures) (required)
2889
+ :type fichier_pdf: bytearray
2890
+ :param _request_timeout: timeout setting for this request. If one
2891
+ number provided, it will be total request
2892
+ timeout. It can also be a pair (tuple) of
2893
+ (connection, read) timeouts.
2894
+ :type _request_timeout: int, tuple(int, int), optional
2895
+ :param _request_auth: set to override the auth_settings for an a single
2896
+ request; this effectively ignores the
2897
+ authentication in the spec for a single request.
2898
+ :type _request_auth: dict, optional
2899
+ :param _content_type: force content-type for the request.
2900
+ :type _content_type: str, Optional
2901
+ :param _headers: set to override the headers for a single
2902
+ request; this effectively ignores the headers
2903
+ in the spec for a single request.
2904
+ :type _headers: dict, optional
2905
+ :param _host_index: set to override the host_index for a single
2906
+ request; this effectively ignores the host_index
2907
+ in the spec for a single request.
2908
+ :type _host_index: int, optional
2909
+ :return: Returns the result object.
2910
+ """ # noqa: E501
2911
+
2912
+ _param = self._valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_serialize(
2913
+ fichier_pdf=fichier_pdf,
2914
+ _request_auth=_request_auth,
2915
+ _content_type=_content_type,
2916
+ _headers=_headers,
2917
+ _host_index=_host_index
2918
+ )
2919
+
2920
+ _response_types_map: Dict[str, Optional[str]] = {
2921
+ '200': "object",
2922
+ '400': None,
2923
+ '422': "HTTPValidationError",
2924
+ }
2925
+ response_data = self.api_client.call_api(
2926
+ *_param,
2927
+ _request_timeout=_request_timeout
2928
+ )
2929
+ response_data.read()
2930
+ return self.api_client.response_deserialize(
2931
+ response_data=response_data,
2932
+ response_types_map=_response_types_map,
2933
+ ).data
2934
+
2935
+
2936
+ @validate_call
2937
+ def valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_with_http_info(
2938
+ self,
2939
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à valider (sera analysé pour détecter et valider les signatures)")],
2940
+ _request_timeout: Union[
2941
+ None,
2942
+ Annotated[StrictFloat, Field(gt=0)],
2943
+ Tuple[
2944
+ Annotated[StrictFloat, Field(gt=0)],
2945
+ Annotated[StrictFloat, Field(gt=0)]
2946
+ ]
2947
+ ] = None,
2948
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2949
+ _content_type: Optional[StrictStr] = None,
2950
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2951
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2952
+ ) -> ApiResponse[object]:
2953
+ """Valider les signatures électroniques d'un PDF
2954
+
2955
+ Valide les signatures électroniques présentes dans un PDF uploadé. **Vérifications effectuées** : - Présence de signatures - Intégrité du document (non modifié depuis signature) - Validité des certificats - Chaîne de confiance (si disponible) - Présence d'horodatage (PAdES-B-T) - Données de validation (PAdES-B-LT) **Standards supportés** : PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note** : Cette validation est technique (intégrité cryptographique). La validité juridique dépend du niveau eIDAS du certificat (SES/AdES/QES) et du contexte d'utilisation.
2956
+
2957
+ :param fichier_pdf: Fichier PDF à valider (sera analysé pour détecter et valider les signatures) (required)
2958
+ :type fichier_pdf: bytearray
2959
+ :param _request_timeout: timeout setting for this request. If one
2960
+ number provided, it will be total request
2961
+ timeout. It can also be a pair (tuple) of
2962
+ (connection, read) timeouts.
2963
+ :type _request_timeout: int, tuple(int, int), optional
2964
+ :param _request_auth: set to override the auth_settings for an a single
2965
+ request; this effectively ignores the
2966
+ authentication in the spec for a single request.
2967
+ :type _request_auth: dict, optional
2968
+ :param _content_type: force content-type for the request.
2969
+ :type _content_type: str, Optional
2970
+ :param _headers: set to override the headers for a single
2971
+ request; this effectively ignores the headers
2972
+ in the spec for a single request.
2973
+ :type _headers: dict, optional
2974
+ :param _host_index: set to override the host_index for a single
2975
+ request; this effectively ignores the host_index
2976
+ in the spec for a single request.
2977
+ :type _host_index: int, optional
2978
+ :return: Returns the result object.
2979
+ """ # noqa: E501
2980
+
2981
+ _param = self._valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_serialize(
2982
+ fichier_pdf=fichier_pdf,
2983
+ _request_auth=_request_auth,
2984
+ _content_type=_content_type,
2985
+ _headers=_headers,
2986
+ _host_index=_host_index
2987
+ )
2988
+
2989
+ _response_types_map: Dict[str, Optional[str]] = {
2990
+ '200': "object",
2991
+ '400': None,
2992
+ '422': "HTTPValidationError",
2993
+ }
2994
+ response_data = self.api_client.call_api(
2995
+ *_param,
2996
+ _request_timeout=_request_timeout
2997
+ )
2998
+ response_data.read()
2999
+ return self.api_client.response_deserialize(
3000
+ response_data=response_data,
3001
+ response_types_map=_response_types_map,
3002
+ )
3003
+
3004
+
3005
+ @validate_call
3006
+ def valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_without_preload_content(
3007
+ self,
3008
+ fichier_pdf: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier PDF à valider (sera analysé pour détecter et valider les signatures)")],
3009
+ _request_timeout: Union[
3010
+ None,
3011
+ Annotated[StrictFloat, Field(gt=0)],
3012
+ Tuple[
3013
+ Annotated[StrictFloat, Field(gt=0)],
3014
+ Annotated[StrictFloat, Field(gt=0)]
3015
+ ]
3016
+ ] = None,
3017
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3018
+ _content_type: Optional[StrictStr] = None,
3019
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3020
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3021
+ ) -> RESTResponseType:
3022
+ """Valider les signatures électroniques d'un PDF
3023
+
3024
+ Valide les signatures électroniques présentes dans un PDF uploadé. **Vérifications effectuées** : - Présence de signatures - Intégrité du document (non modifié depuis signature) - Validité des certificats - Chaîne de confiance (si disponible) - Présence d'horodatage (PAdES-B-T) - Données de validation (PAdES-B-LT) **Standards supportés** : PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note** : Cette validation est technique (intégrité cryptographique). La validité juridique dépend du niveau eIDAS du certificat (SES/AdES/QES) et du contexte d'utilisation.
3025
+
3026
+ :param fichier_pdf: Fichier PDF à valider (sera analysé pour détecter et valider les signatures) (required)
3027
+ :type fichier_pdf: bytearray
3028
+ :param _request_timeout: timeout setting for this request. If one
3029
+ number provided, it will be total request
3030
+ timeout. It can also be a pair (tuple) of
3031
+ (connection, read) timeouts.
3032
+ :type _request_timeout: int, tuple(int, int), optional
3033
+ :param _request_auth: set to override the auth_settings for an a single
3034
+ request; this effectively ignores the
3035
+ authentication in the spec for a single request.
3036
+ :type _request_auth: dict, optional
3037
+ :param _content_type: force content-type for the request.
3038
+ :type _content_type: str, Optional
3039
+ :param _headers: set to override the headers for a single
3040
+ request; this effectively ignores the headers
3041
+ in the spec for a single request.
3042
+ :type _headers: dict, optional
3043
+ :param _host_index: set to override the host_index for a single
3044
+ request; this effectively ignores the host_index
3045
+ in the spec for a single request.
3046
+ :type _host_index: int, optional
3047
+ :return: Returns the result object.
3048
+ """ # noqa: E501
3049
+
3050
+ _param = self._valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_serialize(
3051
+ fichier_pdf=fichier_pdf,
3052
+ _request_auth=_request_auth,
3053
+ _content_type=_content_type,
3054
+ _headers=_headers,
3055
+ _host_index=_host_index
3056
+ )
3057
+
3058
+ _response_types_map: Dict[str, Optional[str]] = {
3059
+ '200': "object",
3060
+ '400': None,
3061
+ '422': "HTTPValidationError",
3062
+ }
3063
+ response_data = self.api_client.call_api(
3064
+ *_param,
3065
+ _request_timeout=_request_timeout
3066
+ )
3067
+ return response_data.response
3068
+
3069
+
3070
+ def _valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_serialize(
3071
+ self,
3072
+ fichier_pdf,
3073
+ _request_auth,
3074
+ _content_type,
3075
+ _headers,
3076
+ _host_index,
3077
+ ) -> RequestSerialized:
3078
+
3079
+ _host = None
3080
+
3081
+ _collection_formats: Dict[str, str] = {
3082
+ }
3083
+
3084
+ _path_params: Dict[str, str] = {}
3085
+ _query_params: List[Tuple[str, str]] = []
3086
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3087
+ _form_params: List[Tuple[str, str]] = []
3088
+ _files: Dict[
3089
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3090
+ ] = {}
3091
+ _body_params: Optional[bytes] = None
3092
+
3093
+ # process the path parameters
3094
+ # process the query parameters
3095
+ # process the header parameters
3096
+ # process the form parameters
3097
+ if fichier_pdf is not None:
3098
+ _files['fichier_pdf'] = fichier_pdf
3099
+ # process the body parameter
3100
+
3101
+
3102
+ # set the HTTP header `Accept`
3103
+ if 'Accept' not in _header_params:
3104
+ _header_params['Accept'] = self.api_client.select_header_accept(
3105
+ [
3106
+ 'application/json'
3107
+ ]
3108
+ )
3109
+
3110
+ # set the HTTP header `Content-Type`
3111
+ if _content_type:
3112
+ _header_params['Content-Type'] = _content_type
3113
+ else:
3114
+ _default_content_type = (
3115
+ self.api_client.select_header_content_type(
3116
+ [
3117
+ 'multipart/form-data'
3118
+ ]
3119
+ )
3120
+ )
3121
+ if _default_content_type is not None:
3122
+ _header_params['Content-Type'] = _default_content_type
3123
+
3124
+ # authentication setting
3125
+ _auth_settings: List[str] = [
3126
+ 'HTTPBearer'
3127
+ ]
3128
+
3129
+ return self.api_client.param_serialize(
3130
+ method='POST',
3131
+ resource_path='/api/v1/traitement/valider-signature-pdf',
3132
+ path_params=_path_params,
3133
+ query_params=_query_params,
3134
+ header_params=_header_params,
3135
+ body=_body_params,
3136
+ post_params=_form_params,
3137
+ files=_files,
3138
+ auth_settings=_auth_settings,
3139
+ collection_formats=_collection_formats,
3140
+ _host=_host,
3141
+ _request_auth=_request_auth
3142
+ )
3143
+
3144
+
3145
+
3146
+
3147
+ @validate_call
3148
+ def valider_xml_api_v1_traitement_valider_xml_post(
3149
+ self,
3150
+ fichier_xml: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier XML Factur-X à valider (format .xml).")],
3151
+ profil: Annotated[Optional[ProfilAPI], Field(description="Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
3152
+ _request_timeout: Union[
3153
+ None,
3154
+ Annotated[StrictFloat, Field(gt=0)],
3155
+ Tuple[
3156
+ Annotated[StrictFloat, Field(gt=0)],
3157
+ Annotated[StrictFloat, Field(gt=0)]
3158
+ ]
3159
+ ] = None,
3160
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3161
+ _content_type: Optional[StrictStr] = None,
3162
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3163
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3164
+ ) -> ReponseValidationSucces:
3165
+ """Valider un XML Factur-X existant
3166
+
3167
+ Valide un fichier XML Factur-X contre les règles métier Schematron selon la norme EN 16931. ## Norme appliquée **Schematron ISO/IEC 19757-3** : Langage de validation de règles métier pour XML - Validation sémantique (au-delà de la syntaxe XSD) - Règles métier européennes EN 16931 - Règles françaises spécifiques Factur-X - Calculs arithmétiques et cohérence des données ## Profils et règles validées ### MINIMUM (45 règles) - Identifiant de facture unique - Dates (émission, échéance) - Identifiants parties (SIRET/SIREN) - Montant total TTC ### BASIC (102 règles) - Toutes les règles MINIMUM - Lignes de facture détaillées - Calculs de TVA basiques - Modes de paiement - Références (commande, contrat) ### EN16931 (178 règles) - Toutes les règles BASIC - **Règles européennes (BR-xx)** : 81 règles business - **Règles françaises (FR-xx)** : 12 règles spécifiques France - **Calculs avancés (CR-xx)** : 32 règles de calcul - **Codes normalisés (CL-xx)** : 52 listes de codes ### EXTENDED (210+ règles) - Toutes les règles EN16931 - Informations logistiques - Données comptables avancées - Références externes multiples ## Contrôles effectués ### 1. Validation syntaxique - Parsing XML correct (UTF-8, bien formé) - Namespaces UN/CEFACT présents - Structure hiérarchique respectée ### 2. Règles business (BR-xx) Exemples : - `BR-1` : Le total de la facture doit être égal à la somme des totaux de lignes + montants au niveau document - `BR-CO-10` : La somme des montants de base de TVA doit être égale au total net de la facture - `BR-16` : Le code de devise de la facture doit figurer dans la liste ISO 4217 ### 3. Règles françaises (FR-xx) Exemples : - `FR-1` : Le SIRET fournisseur doit avoir 14 chiffres - `FR-2` : Le SIRET client doit avoir 14 chiffres (si présent) - `FR-5` : Le numéro de TVA intracommunautaire doit être au format FRxx999999999 ### 4. Règles de calcul (CR-xx) - Montants HT + TVA = TTC - Somme des lignes = Total document - Remises et majorations correctement appliquées - Arrondis conformes (2 décimales pour les montants) ### 5. Codes normalisés (CL-xx) - Codes pays ISO 3166-1 alpha-2 - Codes devises ISO 4217 - Unités de mesure UN/ECE Rec 20 - Codes TVA (types, catégories, exonérations) - SchemeID pour identifiants (0002=SIREN, 0009=SIRET, etc.) ## Processus de validation 1. **Chargement XSLT** : Fichier Schematron converti en XSLT (Saxon-HE) 2. **Transformation** : Application des règles sur le XML 3. **Analyse résultats** : Extraction des erreurs (`failed-assert`) et avertissements (`successful-report`) 4. **Rapport** : Liste structurée des non-conformités ## Réponses **200 OK** : XML conforme ```json { \"message\": \"Le XML est conforme au profil EN16931\" } ``` **400 Bad Request** : XML non conforme ```json { \"detail\": [ \"[BR-1] Le total de la facture (120.00) ne correspond pas à la somme calculée (100.00 + 20.00)\", \"[FR-1] Le SIRET fournisseur doit contenir exactement 14 chiffres\" ] } ``` ## Cas d'usage - **Pré-validation** : Vérifier un XML avant intégration dans un PDF/A - **Debugging** : Identifier précisément les erreurs de génération - **Tests** : Valider des XMLs de test ou d'exemple - **Conformité** : S'assurer du respect des règles européennes et françaises - **Développement** : Tester rapidement sans générer de PDF ## Temps de traitement - Profil MINIMUM : ~0.5 seconde - Profil EN16931 : ~1-2 secondes - Profil EXTENDED : ~2-3 secondes
3168
+
3169
+ :param fichier_xml: Fichier XML Factur-X à valider (format .xml). (required)
3170
+ :type fichier_xml: bytearray
3171
+ :param profil: Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED).
3172
+ :type profil: ProfilAPI
3173
+ :param _request_timeout: timeout setting for this request. If one
3174
+ number provided, it will be total request
3175
+ timeout. It can also be a pair (tuple) of
3176
+ (connection, read) timeouts.
3177
+ :type _request_timeout: int, tuple(int, int), optional
3178
+ :param _request_auth: set to override the auth_settings for an a single
3179
+ request; this effectively ignores the
3180
+ authentication in the spec for a single request.
3181
+ :type _request_auth: dict, optional
3182
+ :param _content_type: force content-type for the request.
3183
+ :type _content_type: str, Optional
3184
+ :param _headers: set to override the headers for a single
3185
+ request; this effectively ignores the headers
3186
+ in the spec for a single request.
3187
+ :type _headers: dict, optional
3188
+ :param _host_index: set to override the host_index for a single
3189
+ request; this effectively ignores the host_index
3190
+ in the spec for a single request.
3191
+ :type _host_index: int, optional
3192
+ :return: Returns the result object.
3193
+ """ # noqa: E501
3194
+
3195
+ _param = self._valider_xml_api_v1_traitement_valider_xml_post_serialize(
3196
+ fichier_xml=fichier_xml,
3197
+ profil=profil,
3198
+ _request_auth=_request_auth,
3199
+ _content_type=_content_type,
3200
+ _headers=_headers,
3201
+ _host_index=_host_index
3202
+ )
3203
+
3204
+ _response_types_map: Dict[str, Optional[str]] = {
3205
+ '200': "ReponseValidationSucces",
3206
+ '400': "ReponseValidationErreur",
3207
+ '422': "HTTPValidationError",
3208
+ }
3209
+ response_data = self.api_client.call_api(
3210
+ *_param,
3211
+ _request_timeout=_request_timeout
3212
+ )
3213
+ response_data.read()
3214
+ return self.api_client.response_deserialize(
3215
+ response_data=response_data,
3216
+ response_types_map=_response_types_map,
3217
+ ).data
3218
+
3219
+
3220
+ @validate_call
3221
+ def valider_xml_api_v1_traitement_valider_xml_post_with_http_info(
3222
+ self,
3223
+ fichier_xml: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier XML Factur-X à valider (format .xml).")],
3224
+ profil: Annotated[Optional[ProfilAPI], Field(description="Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
3225
+ _request_timeout: Union[
3226
+ None,
3227
+ Annotated[StrictFloat, Field(gt=0)],
3228
+ Tuple[
3229
+ Annotated[StrictFloat, Field(gt=0)],
3230
+ Annotated[StrictFloat, Field(gt=0)]
3231
+ ]
3232
+ ] = None,
3233
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3234
+ _content_type: Optional[StrictStr] = None,
3235
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3236
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3237
+ ) -> ApiResponse[ReponseValidationSucces]:
3238
+ """Valider un XML Factur-X existant
3239
+
3240
+ Valide un fichier XML Factur-X contre les règles métier Schematron selon la norme EN 16931. ## Norme appliquée **Schematron ISO/IEC 19757-3** : Langage de validation de règles métier pour XML - Validation sémantique (au-delà de la syntaxe XSD) - Règles métier européennes EN 16931 - Règles françaises spécifiques Factur-X - Calculs arithmétiques et cohérence des données ## Profils et règles validées ### MINIMUM (45 règles) - Identifiant de facture unique - Dates (émission, échéance) - Identifiants parties (SIRET/SIREN) - Montant total TTC ### BASIC (102 règles) - Toutes les règles MINIMUM - Lignes de facture détaillées - Calculs de TVA basiques - Modes de paiement - Références (commande, contrat) ### EN16931 (178 règles) - Toutes les règles BASIC - **Règles européennes (BR-xx)** : 81 règles business - **Règles françaises (FR-xx)** : 12 règles spécifiques France - **Calculs avancés (CR-xx)** : 32 règles de calcul - **Codes normalisés (CL-xx)** : 52 listes de codes ### EXTENDED (210+ règles) - Toutes les règles EN16931 - Informations logistiques - Données comptables avancées - Références externes multiples ## Contrôles effectués ### 1. Validation syntaxique - Parsing XML correct (UTF-8, bien formé) - Namespaces UN/CEFACT présents - Structure hiérarchique respectée ### 2. Règles business (BR-xx) Exemples : - `BR-1` : Le total de la facture doit être égal à la somme des totaux de lignes + montants au niveau document - `BR-CO-10` : La somme des montants de base de TVA doit être égale au total net de la facture - `BR-16` : Le code de devise de la facture doit figurer dans la liste ISO 4217 ### 3. Règles françaises (FR-xx) Exemples : - `FR-1` : Le SIRET fournisseur doit avoir 14 chiffres - `FR-2` : Le SIRET client doit avoir 14 chiffres (si présent) - `FR-5` : Le numéro de TVA intracommunautaire doit être au format FRxx999999999 ### 4. Règles de calcul (CR-xx) - Montants HT + TVA = TTC - Somme des lignes = Total document - Remises et majorations correctement appliquées - Arrondis conformes (2 décimales pour les montants) ### 5. Codes normalisés (CL-xx) - Codes pays ISO 3166-1 alpha-2 - Codes devises ISO 4217 - Unités de mesure UN/ECE Rec 20 - Codes TVA (types, catégories, exonérations) - SchemeID pour identifiants (0002=SIREN, 0009=SIRET, etc.) ## Processus de validation 1. **Chargement XSLT** : Fichier Schematron converti en XSLT (Saxon-HE) 2. **Transformation** : Application des règles sur le XML 3. **Analyse résultats** : Extraction des erreurs (`failed-assert`) et avertissements (`successful-report`) 4. **Rapport** : Liste structurée des non-conformités ## Réponses **200 OK** : XML conforme ```json { \"message\": \"Le XML est conforme au profil EN16931\" } ``` **400 Bad Request** : XML non conforme ```json { \"detail\": [ \"[BR-1] Le total de la facture (120.00) ne correspond pas à la somme calculée (100.00 + 20.00)\", \"[FR-1] Le SIRET fournisseur doit contenir exactement 14 chiffres\" ] } ``` ## Cas d'usage - **Pré-validation** : Vérifier un XML avant intégration dans un PDF/A - **Debugging** : Identifier précisément les erreurs de génération - **Tests** : Valider des XMLs de test ou d'exemple - **Conformité** : S'assurer du respect des règles européennes et françaises - **Développement** : Tester rapidement sans générer de PDF ## Temps de traitement - Profil MINIMUM : ~0.5 seconde - Profil EN16931 : ~1-2 secondes - Profil EXTENDED : ~2-3 secondes
3241
+
3242
+ :param fichier_xml: Fichier XML Factur-X à valider (format .xml). (required)
3243
+ :type fichier_xml: bytearray
3244
+ :param profil: Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED).
3245
+ :type profil: ProfilAPI
3246
+ :param _request_timeout: timeout setting for this request. If one
3247
+ number provided, it will be total request
3248
+ timeout. It can also be a pair (tuple) of
3249
+ (connection, read) timeouts.
3250
+ :type _request_timeout: int, tuple(int, int), optional
3251
+ :param _request_auth: set to override the auth_settings for an a single
3252
+ request; this effectively ignores the
3253
+ authentication in the spec for a single request.
3254
+ :type _request_auth: dict, optional
3255
+ :param _content_type: force content-type for the request.
3256
+ :type _content_type: str, Optional
3257
+ :param _headers: set to override the headers for a single
3258
+ request; this effectively ignores the headers
3259
+ in the spec for a single request.
3260
+ :type _headers: dict, optional
3261
+ :param _host_index: set to override the host_index for a single
3262
+ request; this effectively ignores the host_index
3263
+ in the spec for a single request.
3264
+ :type _host_index: int, optional
3265
+ :return: Returns the result object.
3266
+ """ # noqa: E501
3267
+
3268
+ _param = self._valider_xml_api_v1_traitement_valider_xml_post_serialize(
3269
+ fichier_xml=fichier_xml,
3270
+ profil=profil,
3271
+ _request_auth=_request_auth,
3272
+ _content_type=_content_type,
3273
+ _headers=_headers,
3274
+ _host_index=_host_index
3275
+ )
3276
+
3277
+ _response_types_map: Dict[str, Optional[str]] = {
3278
+ '200': "ReponseValidationSucces",
3279
+ '400': "ReponseValidationErreur",
3280
+ '422': "HTTPValidationError",
3281
+ }
3282
+ response_data = self.api_client.call_api(
3283
+ *_param,
3284
+ _request_timeout=_request_timeout
3285
+ )
3286
+ response_data.read()
3287
+ return self.api_client.response_deserialize(
3288
+ response_data=response_data,
3289
+ response_types_map=_response_types_map,
3290
+ )
3291
+
3292
+
3293
+ @validate_call
3294
+ def valider_xml_api_v1_traitement_valider_xml_post_without_preload_content(
3295
+ self,
3296
+ fichier_xml: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Fichier XML Factur-X à valider (format .xml).")],
3297
+ profil: Annotated[Optional[ProfilAPI], Field(description="Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
3298
+ _request_timeout: Union[
3299
+ None,
3300
+ Annotated[StrictFloat, Field(gt=0)],
3301
+ Tuple[
3302
+ Annotated[StrictFloat, Field(gt=0)],
3303
+ Annotated[StrictFloat, Field(gt=0)]
3304
+ ]
3305
+ ] = None,
3306
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3307
+ _content_type: Optional[StrictStr] = None,
3308
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3309
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3310
+ ) -> RESTResponseType:
3311
+ """Valider un XML Factur-X existant
3312
+
3313
+ Valide un fichier XML Factur-X contre les règles métier Schematron selon la norme EN 16931. ## Norme appliquée **Schematron ISO/IEC 19757-3** : Langage de validation de règles métier pour XML - Validation sémantique (au-delà de la syntaxe XSD) - Règles métier européennes EN 16931 - Règles françaises spécifiques Factur-X - Calculs arithmétiques et cohérence des données ## Profils et règles validées ### MINIMUM (45 règles) - Identifiant de facture unique - Dates (émission, échéance) - Identifiants parties (SIRET/SIREN) - Montant total TTC ### BASIC (102 règles) - Toutes les règles MINIMUM - Lignes de facture détaillées - Calculs de TVA basiques - Modes de paiement - Références (commande, contrat) ### EN16931 (178 règles) - Toutes les règles BASIC - **Règles européennes (BR-xx)** : 81 règles business - **Règles françaises (FR-xx)** : 12 règles spécifiques France - **Calculs avancés (CR-xx)** : 32 règles de calcul - **Codes normalisés (CL-xx)** : 52 listes de codes ### EXTENDED (210+ règles) - Toutes les règles EN16931 - Informations logistiques - Données comptables avancées - Références externes multiples ## Contrôles effectués ### 1. Validation syntaxique - Parsing XML correct (UTF-8, bien formé) - Namespaces UN/CEFACT présents - Structure hiérarchique respectée ### 2. Règles business (BR-xx) Exemples : - `BR-1` : Le total de la facture doit être égal à la somme des totaux de lignes + montants au niveau document - `BR-CO-10` : La somme des montants de base de TVA doit être égale au total net de la facture - `BR-16` : Le code de devise de la facture doit figurer dans la liste ISO 4217 ### 3. Règles françaises (FR-xx) Exemples : - `FR-1` : Le SIRET fournisseur doit avoir 14 chiffres - `FR-2` : Le SIRET client doit avoir 14 chiffres (si présent) - `FR-5` : Le numéro de TVA intracommunautaire doit être au format FRxx999999999 ### 4. Règles de calcul (CR-xx) - Montants HT + TVA = TTC - Somme des lignes = Total document - Remises et majorations correctement appliquées - Arrondis conformes (2 décimales pour les montants) ### 5. Codes normalisés (CL-xx) - Codes pays ISO 3166-1 alpha-2 - Codes devises ISO 4217 - Unités de mesure UN/ECE Rec 20 - Codes TVA (types, catégories, exonérations) - SchemeID pour identifiants (0002=SIREN, 0009=SIRET, etc.) ## Processus de validation 1. **Chargement XSLT** : Fichier Schematron converti en XSLT (Saxon-HE) 2. **Transformation** : Application des règles sur le XML 3. **Analyse résultats** : Extraction des erreurs (`failed-assert`) et avertissements (`successful-report`) 4. **Rapport** : Liste structurée des non-conformités ## Réponses **200 OK** : XML conforme ```json { \"message\": \"Le XML est conforme au profil EN16931\" } ``` **400 Bad Request** : XML non conforme ```json { \"detail\": [ \"[BR-1] Le total de la facture (120.00) ne correspond pas à la somme calculée (100.00 + 20.00)\", \"[FR-1] Le SIRET fournisseur doit contenir exactement 14 chiffres\" ] } ``` ## Cas d'usage - **Pré-validation** : Vérifier un XML avant intégration dans un PDF/A - **Debugging** : Identifier précisément les erreurs de génération - **Tests** : Valider des XMLs de test ou d'exemple - **Conformité** : S'assurer du respect des règles européennes et françaises - **Développement** : Tester rapidement sans générer de PDF ## Temps de traitement - Profil MINIMUM : ~0.5 seconde - Profil EN16931 : ~1-2 secondes - Profil EXTENDED : ~2-3 secondes
3314
+
3315
+ :param fichier_xml: Fichier XML Factur-X à valider (format .xml). (required)
3316
+ :type fichier_xml: bytearray
3317
+ :param profil: Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED).
3318
+ :type profil: ProfilAPI
3319
+ :param _request_timeout: timeout setting for this request. If one
3320
+ number provided, it will be total request
3321
+ timeout. It can also be a pair (tuple) of
3322
+ (connection, read) timeouts.
3323
+ :type _request_timeout: int, tuple(int, int), optional
3324
+ :param _request_auth: set to override the auth_settings for an a single
3325
+ request; this effectively ignores the
3326
+ authentication in the spec for a single request.
3327
+ :type _request_auth: dict, optional
3328
+ :param _content_type: force content-type for the request.
3329
+ :type _content_type: str, Optional
3330
+ :param _headers: set to override the headers for a single
3331
+ request; this effectively ignores the headers
3332
+ in the spec for a single request.
3333
+ :type _headers: dict, optional
3334
+ :param _host_index: set to override the host_index for a single
3335
+ request; this effectively ignores the host_index
3336
+ in the spec for a single request.
3337
+ :type _host_index: int, optional
3338
+ :return: Returns the result object.
3339
+ """ # noqa: E501
3340
+
3341
+ _param = self._valider_xml_api_v1_traitement_valider_xml_post_serialize(
3342
+ fichier_xml=fichier_xml,
3343
+ profil=profil,
3344
+ _request_auth=_request_auth,
3345
+ _content_type=_content_type,
3346
+ _headers=_headers,
3347
+ _host_index=_host_index
3348
+ )
3349
+
3350
+ _response_types_map: Dict[str, Optional[str]] = {
3351
+ '200': "ReponseValidationSucces",
3352
+ '400': "ReponseValidationErreur",
3353
+ '422': "HTTPValidationError",
3354
+ }
3355
+ response_data = self.api_client.call_api(
3356
+ *_param,
3357
+ _request_timeout=_request_timeout
3358
+ )
3359
+ return response_data.response
3360
+
3361
+
3362
+ def _valider_xml_api_v1_traitement_valider_xml_post_serialize(
3363
+ self,
3364
+ fichier_xml,
3365
+ profil,
3366
+ _request_auth,
3367
+ _content_type,
3368
+ _headers,
3369
+ _host_index,
3370
+ ) -> RequestSerialized:
3371
+
3372
+ _host = None
3373
+
3374
+ _collection_formats: Dict[str, str] = {
3375
+ }
3376
+
3377
+ _path_params: Dict[str, str] = {}
3378
+ _query_params: List[Tuple[str, str]] = []
3379
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3380
+ _form_params: List[Tuple[str, str]] = []
3381
+ _files: Dict[
3382
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3383
+ ] = {}
3384
+ _body_params: Optional[bytes] = None
3385
+
3386
+ # process the path parameters
3387
+ # process the query parameters
3388
+ # process the header parameters
3389
+ # process the form parameters
3390
+ if fichier_xml is not None:
3391
+ _files['fichier_xml'] = fichier_xml
3392
+ if profil is not None:
3393
+ _form_params.append(('profil', profil))
3394
+ # process the body parameter
3395
+
3396
+
3397
+ # set the HTTP header `Accept`
3398
+ if 'Accept' not in _header_params:
3399
+ _header_params['Accept'] = self.api_client.select_header_accept(
3400
+ [
3401
+ 'application/json'
3402
+ ]
3403
+ )
3404
+
3405
+ # set the HTTP header `Content-Type`
3406
+ if _content_type:
3407
+ _header_params['Content-Type'] = _content_type
3408
+ else:
3409
+ _default_content_type = (
3410
+ self.api_client.select_header_content_type(
3411
+ [
3412
+ 'multipart/form-data'
3413
+ ]
3414
+ )
3415
+ )
3416
+ if _default_content_type is not None:
3417
+ _header_params['Content-Type'] = _default_content_type
3418
+
3419
+ # authentication setting
3420
+ _auth_settings: List[str] = [
3421
+ 'HTTPBearer'
3422
+ ]
3423
+
3424
+ return self.api_client.param_serialize(
3425
+ method='POST',
3426
+ resource_path='/api/v1/traitement/valider-xml',
3427
+ path_params=_path_params,
3428
+ query_params=_query_params,
3429
+ header_params=_header_params,
3430
+ body=_body_params,
3431
+ post_params=_form_params,
3432
+ files=_files,
3433
+ auth_settings=_auth_settings,
3434
+ collection_formats=_collection_formats,
3435
+ _host=_host,
3436
+ _request_auth=_request_auth
3437
+ )
3438
+
3439
+