factpulse 1.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of factpulse might be problematic. Click here for more details.
- factpulse/__init__.py +280 -0
- factpulse/api/__init__.py +13 -0
- factpulse/api/afnorpdppa_api.py +284 -0
- factpulse/api/afnorpdppa_directory_service_api.py +799 -0
- factpulse/api/afnorpdppa_flow_service_api.py +1075 -0
- factpulse/api/chorus_pro_api.py +4506 -0
- factpulse/api/processing_endpoints_unifis_api.py +592 -0
- factpulse/api/sant_api.py +281 -0
- factpulse/api/signature_lectronique_api.py +1358 -0
- factpulse/api/traitement_facture_api.py +3439 -0
- factpulse/api/utilisateur_api.py +282 -0
- factpulse/api_client.py +804 -0
- factpulse/api_response.py +21 -0
- factpulse/configuration.py +585 -0
- factpulse/exceptions.py +216 -0
- factpulse/models/__init__.py +124 -0
- factpulse/models/adresse_electronique.py +90 -0
- factpulse/models/adresse_postale.py +120 -0
- factpulse/models/body_ajouter_fichier_api_v1_chorus_pro_transverses_ajouter_fichier_post.py +104 -0
- factpulse/models/body_completer_facture_api_v1_chorus_pro_factures_completer_post.py +104 -0
- factpulse/models/body_lister_services_structure_api_v1_chorus_pro_structures_id_structure_cpp_services_get.py +102 -0
- factpulse/models/body_rechercher_factures_destinataire_api_v1_chorus_pro_factures_rechercher_destinataire_post.py +104 -0
- factpulse/models/body_rechercher_factures_fournisseur_api_v1_chorus_pro_factures_rechercher_fournisseur_post.py +104 -0
- factpulse/models/body_recycler_facture_api_v1_chorus_pro_factures_recycler_post.py +104 -0
- factpulse/models/body_telecharger_groupe_factures_api_v1_chorus_pro_factures_telecharger_groupe_post.py +104 -0
- factpulse/models/body_traiter_facture_recue_api_v1_chorus_pro_factures_traiter_facture_recue_post.py +104 -0
- factpulse/models/body_valideur_consulter_facture_api_v1_chorus_pro_factures_valideur_consulter_post.py +104 -0
- factpulse/models/body_valideur_rechercher_factures_api_v1_chorus_pro_factures_valideur_rechercher_post.py +104 -0
- factpulse/models/body_valideur_traiter_facture_api_v1_chorus_pro_factures_valideur_traiter_post.py +104 -0
- factpulse/models/cadre_de_facturation.py +102 -0
- factpulse/models/categorie_tva.py +44 -0
- factpulse/models/certificate_info_response.py +114 -0
- factpulse/models/chorus_pro_credentials.py +95 -0
- factpulse/models/code_cadre_facturation.py +39 -0
- factpulse/models/code_raison_reduction.py +42 -0
- factpulse/models/consulter_facture_request.py +98 -0
- factpulse/models/consulter_facture_response.py +142 -0
- factpulse/models/consulter_structure_request.py +100 -0
- factpulse/models/consulter_structure_response.py +142 -0
- factpulse/models/credentials_afnor.py +106 -0
- factpulse/models/credentials_chorus_pro.py +115 -0
- factpulse/models/destinataire.py +116 -0
- factpulse/models/destination.py +140 -0
- factpulse/models/destination_afnor.py +127 -0
- factpulse/models/destination_chorus_pro.py +108 -0
- factpulse/models/direction_flux.py +37 -0
- factpulse/models/donnees_facture_simplifiees.py +124 -0
- factpulse/models/facture_enrichie_info_input.py +123 -0
- factpulse/models/facture_enrichie_info_output.py +133 -0
- factpulse/models/facture_factur_x.py +173 -0
- factpulse/models/flux_resume.py +131 -0
- factpulse/models/format_sortie.py +37 -0
- factpulse/models/fournisseur.py +146 -0
- factpulse/models/generate_certificate_request.py +118 -0
- factpulse/models/generate_certificate_response.py +106 -0
- factpulse/models/http_validation_error.py +95 -0
- factpulse/models/information_signature_api.py +122 -0
- factpulse/models/ligne_de_poste.py +188 -0
- factpulse/models/ligne_de_poste_montant_remise_ht.py +145 -0
- factpulse/models/ligne_de_poste_montant_total_ligne_ht.py +145 -0
- factpulse/models/ligne_de_poste_taux_tva_manuel.py +145 -0
- factpulse/models/ligne_de_tva.py +118 -0
- factpulse/models/mode_depot.py +38 -0
- factpulse/models/mode_paiement.py +41 -0
- factpulse/models/montant_ht_total.py +139 -0
- factpulse/models/montant_total.py +138 -0
- factpulse/models/montant_total_acompte.py +145 -0
- factpulse/models/montant_total_montant_remise_globale_ttc.py +145 -0
- factpulse/models/montant_ttc_total.py +139 -0
- factpulse/models/montant_tva.py +139 -0
- factpulse/models/montantapayer.py +139 -0
- factpulse/models/montantbaseht.py +139 -0
- factpulse/models/montanthttotal.py +139 -0
- factpulse/models/montantttctotal.py +139 -0
- factpulse/models/montanttva.py +139 -0
- factpulse/models/montanttva1.py +139 -0
- factpulse/models/montantunitaireht.py +139 -0
- factpulse/models/obtenir_id_chorus_pro_request.py +100 -0
- factpulse/models/obtenir_id_chorus_pro_response.py +98 -0
- factpulse/models/options_processing.py +103 -0
- factpulse/models/parametres_signature.py +133 -0
- factpulse/models/parametres_structure.py +91 -0
- factpulse/models/pdf_factur_x_info.py +91 -0
- factpulse/models/pdp_credentials.py +93 -0
- factpulse/models/piece_jointe_complementaire.py +95 -0
- factpulse/models/profil_api.py +39 -0
- factpulse/models/profil_flux.py +38 -0
- factpulse/models/quantite.py +139 -0
- factpulse/models/quota_info.py +95 -0
- factpulse/models/rechercher_services_response.py +101 -0
- factpulse/models/rechercher_structure_request.py +119 -0
- factpulse/models/rechercher_structure_response.py +101 -0
- factpulse/models/references.py +124 -0
- factpulse/models/reponse_healthcheck_afnor.py +91 -0
- factpulse/models/reponse_recherche_flux.py +101 -0
- factpulse/models/reponse_soumission_flux.py +109 -0
- factpulse/models/reponse_tache.py +87 -0
- factpulse/models/reponse_validation_erreur.py +87 -0
- factpulse/models/reponse_validation_succes.py +87 -0
- factpulse/models/requete_recherche_flux.py +143 -0
- factpulse/models/requete_soumission_flux.py +123 -0
- factpulse/models/resultat_afnor.py +105 -0
- factpulse/models/resultat_chorus_pro.py +101 -0
- factpulse/models/resultat_validation_pdfapi.py +169 -0
- factpulse/models/scheme_id.py +40 -0
- factpulse/models/service_structure.py +93 -0
- factpulse/models/signature_info.py +101 -0
- factpulse/models/soumettre_facture_complete_request.py +116 -0
- factpulse/models/soumettre_facture_complete_response.py +145 -0
- factpulse/models/soumettre_facture_request.py +164 -0
- factpulse/models/soumettre_facture_response.py +103 -0
- factpulse/models/statut_acquittement.py +38 -0
- factpulse/models/statut_facture.py +96 -0
- factpulse/models/statut_tache.py +99 -0
- factpulse/models/structure_info.py +95 -0
- factpulse/models/syntaxe_flux.py +40 -0
- factpulse/models/tauxmanuel.py +139 -0
- factpulse/models/type_facture.py +37 -0
- factpulse/models/type_flux.py +40 -0
- factpulse/models/type_tva.py +39 -0
- factpulse/models/unite.py +41 -0
- factpulse/models/utilisateur.py +128 -0
- factpulse/models/validation_error.py +99 -0
- factpulse/models/validation_error_loc_inner.py +138 -0
- factpulse/py.typed +0 -0
- factpulse/rest.py +258 -0
- factpulse-1.0.3.dist-info/METADATA +164 -0
- factpulse-1.0.3.dist-info/RECORD +131 -0
- factpulse-1.0.3.dist-info/WHEEL +5 -0
- factpulse-1.0.3.dist-info/licenses/LICENSE +21 -0
- factpulse-1.0.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from factpulse.models.information_signature_api import InformationSignatureAPI
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ResultatValidationPDFAPI(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Résultat complet de la validation d'un PDF Factur-X.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
est_conforme: StrictBool = Field(description="True si le PDF est conforme à tous les critères (XML, PDF/A, XMP)")
|
|
31
|
+
xml_present: StrictBool = Field(description="True si un XML Factur-X est embarqué dans le PDF")
|
|
32
|
+
xml_conforme: StrictBool = Field(description="True si le XML Factur-X est conforme aux règles Schematron")
|
|
33
|
+
profil_detecte: Optional[StrictStr] = None
|
|
34
|
+
erreurs_xml: Optional[List[StrictStr]] = Field(default=None, description="Liste des erreurs de validation XML")
|
|
35
|
+
pdfa_conforme: StrictBool = Field(description="True si le PDF est conforme PDF/A")
|
|
36
|
+
version_pdfa: Optional[StrictStr] = None
|
|
37
|
+
methode_validation_pdfa: Optional[StrictStr] = Field(default='metadata', description="Méthode utilisée pour la validation PDF/A (metadata ou verapdf)")
|
|
38
|
+
regles_validees: Optional[StrictInt] = None
|
|
39
|
+
regles_echouees: Optional[StrictInt] = None
|
|
40
|
+
erreurs_pdfa: Optional[List[StrictStr]] = Field(default=None, description="Liste des erreurs de conformité PDF/A")
|
|
41
|
+
avertissements_pdfa: Optional[List[StrictStr]] = Field(default=None, description="Liste des avertissements PDF/A")
|
|
42
|
+
xmp_present: StrictBool = Field(description="True si des métadonnées XMP sont présentes")
|
|
43
|
+
xmp_conforme_facturx: StrictBool = Field(description="True si les métadonnées XMP contiennent des informations Factur-X")
|
|
44
|
+
profil_xmp: Optional[StrictStr] = None
|
|
45
|
+
version_xmp: Optional[StrictStr] = None
|
|
46
|
+
erreurs_xmp: Optional[List[StrictStr]] = Field(default=None, description="Liste des erreurs de métadonnées XMP")
|
|
47
|
+
metadonnees_xmp: Optional[Dict[str, Any]] = Field(default=None, description="Métadonnées XMP extraites du PDF")
|
|
48
|
+
est_signe: StrictBool = Field(description="True si le PDF contient au moins une signature")
|
|
49
|
+
nombre_signatures: Optional[StrictInt] = Field(default=0, description="Nombre de signatures électroniques trouvées")
|
|
50
|
+
signatures: Optional[List[InformationSignatureAPI]] = Field(default=None, description="Liste des signatures trouvées avec leurs informations")
|
|
51
|
+
erreurs_signatures: Optional[List[StrictStr]] = Field(default=None, description="Liste des erreurs lors de l'analyse des signatures")
|
|
52
|
+
message_resume: StrictStr = Field(description="Message résumant le résultat de la validation")
|
|
53
|
+
__properties: ClassVar[List[str]] = ["est_conforme", "xml_present", "xml_conforme", "profil_detecte", "erreurs_xml", "pdfa_conforme", "version_pdfa", "methode_validation_pdfa", "regles_validees", "regles_echouees", "erreurs_pdfa", "avertissements_pdfa", "xmp_present", "xmp_conforme_facturx", "profil_xmp", "version_xmp", "erreurs_xmp", "metadonnees_xmp", "est_signe", "nombre_signatures", "signatures", "erreurs_signatures", "message_resume"]
|
|
54
|
+
|
|
55
|
+
model_config = ConfigDict(
|
|
56
|
+
populate_by_name=True,
|
|
57
|
+
validate_assignment=True,
|
|
58
|
+
protected_namespaces=(),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def to_str(self) -> str:
|
|
63
|
+
"""Returns the string representation of the model using alias"""
|
|
64
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
65
|
+
|
|
66
|
+
def to_json(self) -> str:
|
|
67
|
+
"""Returns the JSON representation of the model using alias"""
|
|
68
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
69
|
+
return json.dumps(self.to_dict())
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
73
|
+
"""Create an instance of ResultatValidationPDFAPI from a JSON string"""
|
|
74
|
+
return cls.from_dict(json.loads(json_str))
|
|
75
|
+
|
|
76
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
77
|
+
"""Return the dictionary representation of the model using alias.
|
|
78
|
+
|
|
79
|
+
This has the following differences from calling pydantic's
|
|
80
|
+
`self.model_dump(by_alias=True)`:
|
|
81
|
+
|
|
82
|
+
* `None` is only added to the output dict for nullable fields that
|
|
83
|
+
were set at model initialization. Other fields with value `None`
|
|
84
|
+
are ignored.
|
|
85
|
+
"""
|
|
86
|
+
excluded_fields: Set[str] = set([
|
|
87
|
+
])
|
|
88
|
+
|
|
89
|
+
_dict = self.model_dump(
|
|
90
|
+
by_alias=True,
|
|
91
|
+
exclude=excluded_fields,
|
|
92
|
+
exclude_none=True,
|
|
93
|
+
)
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of each item in signatures (list)
|
|
95
|
+
_items = []
|
|
96
|
+
if self.signatures:
|
|
97
|
+
for _item_signatures in self.signatures:
|
|
98
|
+
if _item_signatures:
|
|
99
|
+
_items.append(_item_signatures.to_dict())
|
|
100
|
+
_dict['signatures'] = _items
|
|
101
|
+
# set to None if profil_detecte (nullable) is None
|
|
102
|
+
# and model_fields_set contains the field
|
|
103
|
+
if self.profil_detecte is None and "profil_detecte" in self.model_fields_set:
|
|
104
|
+
_dict['profil_detecte'] = None
|
|
105
|
+
|
|
106
|
+
# set to None if version_pdfa (nullable) is None
|
|
107
|
+
# and model_fields_set contains the field
|
|
108
|
+
if self.version_pdfa is None and "version_pdfa" in self.model_fields_set:
|
|
109
|
+
_dict['version_pdfa'] = None
|
|
110
|
+
|
|
111
|
+
# set to None if regles_validees (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.regles_validees is None and "regles_validees" in self.model_fields_set:
|
|
114
|
+
_dict['regles_validees'] = None
|
|
115
|
+
|
|
116
|
+
# set to None if regles_echouees (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.regles_echouees is None and "regles_echouees" in self.model_fields_set:
|
|
119
|
+
_dict['regles_echouees'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if profil_xmp (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.profil_xmp is None and "profil_xmp" in self.model_fields_set:
|
|
124
|
+
_dict['profil_xmp'] = None
|
|
125
|
+
|
|
126
|
+
# set to None if version_xmp (nullable) is None
|
|
127
|
+
# and model_fields_set contains the field
|
|
128
|
+
if self.version_xmp is None and "version_xmp" in self.model_fields_set:
|
|
129
|
+
_dict['version_xmp'] = None
|
|
130
|
+
|
|
131
|
+
return _dict
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
135
|
+
"""Create an instance of ResultatValidationPDFAPI from a dict"""
|
|
136
|
+
if obj is None:
|
|
137
|
+
return None
|
|
138
|
+
|
|
139
|
+
if not isinstance(obj, dict):
|
|
140
|
+
return cls.model_validate(obj)
|
|
141
|
+
|
|
142
|
+
_obj = cls.model_validate({
|
|
143
|
+
"est_conforme": obj.get("est_conforme"),
|
|
144
|
+
"xml_present": obj.get("xml_present"),
|
|
145
|
+
"xml_conforme": obj.get("xml_conforme"),
|
|
146
|
+
"profil_detecte": obj.get("profil_detecte"),
|
|
147
|
+
"erreurs_xml": obj.get("erreurs_xml"),
|
|
148
|
+
"pdfa_conforme": obj.get("pdfa_conforme"),
|
|
149
|
+
"version_pdfa": obj.get("version_pdfa"),
|
|
150
|
+
"methode_validation_pdfa": obj.get("methode_validation_pdfa") if obj.get("methode_validation_pdfa") is not None else 'metadata',
|
|
151
|
+
"regles_validees": obj.get("regles_validees"),
|
|
152
|
+
"regles_echouees": obj.get("regles_echouees"),
|
|
153
|
+
"erreurs_pdfa": obj.get("erreurs_pdfa"),
|
|
154
|
+
"avertissements_pdfa": obj.get("avertissements_pdfa"),
|
|
155
|
+
"xmp_present": obj.get("xmp_present"),
|
|
156
|
+
"xmp_conforme_facturx": obj.get("xmp_conforme_facturx"),
|
|
157
|
+
"profil_xmp": obj.get("profil_xmp"),
|
|
158
|
+
"version_xmp": obj.get("version_xmp"),
|
|
159
|
+
"erreurs_xmp": obj.get("erreurs_xmp"),
|
|
160
|
+
"metadonnees_xmp": obj.get("metadonnees_xmp"),
|
|
161
|
+
"est_signe": obj.get("est_signe"),
|
|
162
|
+
"nombre_signatures": obj.get("nombre_signatures") if obj.get("nombre_signatures") is not None else 0,
|
|
163
|
+
"signatures": [InformationSignatureAPI.from_dict(_item) for _item in obj["signatures"]] if obj.get("signatures") is not None else None,
|
|
164
|
+
"erreurs_signatures": obj.get("erreurs_signatures"),
|
|
165
|
+
"message_resume": obj.get("message_resume")
|
|
166
|
+
})
|
|
167
|
+
return _obj
|
|
168
|
+
|
|
169
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
from typing_extensions import Self
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SchemeID(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
Codes de schémas d'identification (Electronic Address Scheme - EAS), principalement pour l'adressage des factures électroniques.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
ENUM_0225 = '0225'
|
|
30
|
+
ENUM_0088 = '0088'
|
|
31
|
+
ENUM_0060 = '0060'
|
|
32
|
+
ENUM_9957 = '9957'
|
|
33
|
+
ENUM_0199 = '0199'
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
|
37
|
+
"""Create an instance of SchemeID from a JSON string"""
|
|
38
|
+
return cls(json.loads(json_str))
|
|
39
|
+
|
|
40
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ServiceStructure(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Service d'une structure.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
id_service: StrictInt = Field(description="ID du service")
|
|
30
|
+
code_service: StrictStr = Field(description="Code du service")
|
|
31
|
+
libelle_service: StrictStr = Field(description="Libellé du service")
|
|
32
|
+
est_actif: StrictBool = Field(description="Service actif")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["id_service", "code_service", "libelle_service", "est_actif"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ServiceStructure from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of ServiceStructure from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"id_service": obj.get("id_service"),
|
|
87
|
+
"code_service": obj.get("code_service"),
|
|
88
|
+
"libelle_service": obj.get("libelle_service"),
|
|
89
|
+
"est_actif": obj.get("est_actif")
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class SignatureInfo(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Informations sur la signature électronique.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
signe: StrictBool = Field(description="Le PDF a été signé")
|
|
30
|
+
cn: Optional[StrictStr] = None
|
|
31
|
+
expiration: Optional[StrictStr] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["signe", "cn", "expiration"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of SignatureInfo from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# set to None if cn (nullable) is None
|
|
74
|
+
# and model_fields_set contains the field
|
|
75
|
+
if self.cn is None and "cn" in self.model_fields_set:
|
|
76
|
+
_dict['cn'] = None
|
|
77
|
+
|
|
78
|
+
# set to None if expiration (nullable) is None
|
|
79
|
+
# and model_fields_set contains the field
|
|
80
|
+
if self.expiration is None and "expiration" in self.model_fields_set:
|
|
81
|
+
_dict['expiration'] = None
|
|
82
|
+
|
|
83
|
+
return _dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of SignatureInfo from a dict"""
|
|
88
|
+
if obj is None:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
if not isinstance(obj, dict):
|
|
92
|
+
return cls.model_validate(obj)
|
|
93
|
+
|
|
94
|
+
_obj = cls.model_validate({
|
|
95
|
+
"signe": obj.get("signe"),
|
|
96
|
+
"cn": obj.get("cn"),
|
|
97
|
+
"expiration": obj.get("expiration")
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from factpulse.models.destination import Destination
|
|
23
|
+
from factpulse.models.donnees_facture_simplifiees import DonneesFactureSimplifiees
|
|
24
|
+
from factpulse.models.options_processing import OptionsProcessing
|
|
25
|
+
from factpulse.models.parametres_signature import ParametresSignature
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
|
|
29
|
+
class SoumettreFactureCompleteRequest(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
Requête pour soumettre une facture complète (génération + soumission). Workflow : 1. Auto-enrichissement (optionnel) 2. Génération PDF Factur-X 3. Signature (optionnelle) 4. Soumission vers la destination
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
donnees_facture: DonneesFactureSimplifiees = Field(description="Données de la facture au format simplifié (voir exemples)")
|
|
34
|
+
pdf_source: StrictStr = Field(description="PDF source encodé en base64 (sera transformé en Factur-X)")
|
|
35
|
+
destination: Destination
|
|
36
|
+
signature: Optional[ParametresSignature] = None
|
|
37
|
+
options: Optional[OptionsProcessing] = Field(default=None, description="Options de traitement")
|
|
38
|
+
__properties: ClassVar[List[str]] = ["donnees_facture", "pdf_source", "destination", "signature", "options"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of SoumettreFactureCompleteRequest from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of donnees_facture
|
|
80
|
+
if self.donnees_facture:
|
|
81
|
+
_dict['donnees_facture'] = self.donnees_facture.to_dict()
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of destination
|
|
83
|
+
if self.destination:
|
|
84
|
+
_dict['destination'] = self.destination.to_dict()
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of signature
|
|
86
|
+
if self.signature:
|
|
87
|
+
_dict['signature'] = self.signature.to_dict()
|
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of options
|
|
89
|
+
if self.options:
|
|
90
|
+
_dict['options'] = self.options.to_dict()
|
|
91
|
+
# set to None if signature (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.signature is None and "signature" in self.model_fields_set:
|
|
94
|
+
_dict['signature'] = None
|
|
95
|
+
|
|
96
|
+
return _dict
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
|
+
"""Create an instance of SoumettreFactureCompleteRequest from a dict"""
|
|
101
|
+
if obj is None:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
if not isinstance(obj, dict):
|
|
105
|
+
return cls.model_validate(obj)
|
|
106
|
+
|
|
107
|
+
_obj = cls.model_validate({
|
|
108
|
+
"donnees_facture": DonneesFactureSimplifiees.from_dict(obj["donnees_facture"]) if obj.get("donnees_facture") is not None else None,
|
|
109
|
+
"pdf_source": obj.get("pdf_source"),
|
|
110
|
+
"destination": Destination.from_dict(obj["destination"]) if obj.get("destination") is not None else None,
|
|
111
|
+
"signature": ParametresSignature.from_dict(obj["signature"]) if obj.get("signature") is not None else None,
|
|
112
|
+
"options": OptionsProcessing.from_dict(obj["options"]) if obj.get("options") is not None else None
|
|
113
|
+
})
|
|
114
|
+
return _obj
|
|
115
|
+
|
|
116
|
+
|