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.
- 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.6.dist-info/METADATA +182 -0
- factpulse-1.0.6.dist-info/RECORD +131 -0
- factpulse-1.0.6.dist-info/WHEEL +5 -0
- factpulse-1.0.6.dist-info/licenses/LICENSE +21 -0
- factpulse-1.0.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,95 @@
|
|
|
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, 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 QuotaInfo(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Informations détaillées sur le quota.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
limit: StrictInt
|
|
30
|
+
usage: StrictInt
|
|
31
|
+
remaining: StrictInt
|
|
32
|
+
reset_date: StrictStr
|
|
33
|
+
plan: StrictStr
|
|
34
|
+
__properties: ClassVar[List[str]] = ["limit", "usage", "remaining", "reset_date", "plan"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of QuotaInfo from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of QuotaInfo from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({
|
|
87
|
+
"limit": obj.get("limit"),
|
|
88
|
+
"usage": obj.get("usage"),
|
|
89
|
+
"remaining": obj.get("remaining"),
|
|
90
|
+
"reset_date": obj.get("reset_date"),
|
|
91
|
+
"plan": obj.get("plan")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -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, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from factpulse.models.service_structure import ServiceStructure
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class RechercherServicesResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Liste des services d'une structure.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
code_retour: StrictInt
|
|
31
|
+
libelle: StrictStr
|
|
32
|
+
liste_services: Optional[List[ServiceStructure]] = None
|
|
33
|
+
total: Optional[StrictInt] = Field(default=0, description="Nombre de services")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["code_retour", "libelle", "liste_services", "total"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of RechercherServicesResponse from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in liste_services (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.liste_services:
|
|
78
|
+
for _item_liste_services in self.liste_services:
|
|
79
|
+
if _item_liste_services:
|
|
80
|
+
_items.append(_item_liste_services.to_dict())
|
|
81
|
+
_dict['liste_services'] = _items
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of RechercherServicesResponse from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"code_retour": obj.get("code_retour"),
|
|
95
|
+
"libelle": obj.get("libelle"),
|
|
96
|
+
"liste_services": [ServiceStructure.from_dict(_item) for _item in obj["liste_services"]] if obj.get("liste_services") is not None else None,
|
|
97
|
+
"total": obj.get("total") if obj.get("total") is not None else 0
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
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 factpulse.models.chorus_pro_credentials import ChorusProCredentials
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class RechercherStructureRequest(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Recherche de structures par critères.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
credentials: Optional[ChorusProCredentials] = None
|
|
31
|
+
identifiant_structure: Optional[StrictStr] = None
|
|
32
|
+
type_identifiant_structure: Optional[StrictStr] = None
|
|
33
|
+
raison_sociale_structure: Optional[StrictStr] = None
|
|
34
|
+
restreindre_structures_privees: Optional[StrictBool] = Field(default=False, description="Limiter la recherche aux structures privées uniquement")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["credentials", "identifiant_structure", "type_identifiant_structure", "raison_sociale_structure", "restreindre_structures_privees"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
51
|
+
return json.dumps(self.to_dict())
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of RechercherStructureRequest from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of credentials
|
|
77
|
+
if self.credentials:
|
|
78
|
+
_dict['credentials'] = self.credentials.to_dict()
|
|
79
|
+
# set to None if credentials (nullable) is None
|
|
80
|
+
# and model_fields_set contains the field
|
|
81
|
+
if self.credentials is None and "credentials" in self.model_fields_set:
|
|
82
|
+
_dict['credentials'] = None
|
|
83
|
+
|
|
84
|
+
# set to None if identifiant_structure (nullable) is None
|
|
85
|
+
# and model_fields_set contains the field
|
|
86
|
+
if self.identifiant_structure is None and "identifiant_structure" in self.model_fields_set:
|
|
87
|
+
_dict['identifiant_structure'] = None
|
|
88
|
+
|
|
89
|
+
# set to None if type_identifiant_structure (nullable) is None
|
|
90
|
+
# and model_fields_set contains the field
|
|
91
|
+
if self.type_identifiant_structure is None and "type_identifiant_structure" in self.model_fields_set:
|
|
92
|
+
_dict['type_identifiant_structure'] = None
|
|
93
|
+
|
|
94
|
+
# set to None if raison_sociale_structure (nullable) is None
|
|
95
|
+
# and model_fields_set contains the field
|
|
96
|
+
if self.raison_sociale_structure is None and "raison_sociale_structure" in self.model_fields_set:
|
|
97
|
+
_dict['raison_sociale_structure'] = None
|
|
98
|
+
|
|
99
|
+
return _dict
|
|
100
|
+
|
|
101
|
+
@classmethod
|
|
102
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
103
|
+
"""Create an instance of RechercherStructureRequest from a dict"""
|
|
104
|
+
if obj is None:
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
if not isinstance(obj, dict):
|
|
108
|
+
return cls.model_validate(obj)
|
|
109
|
+
|
|
110
|
+
_obj = cls.model_validate({
|
|
111
|
+
"credentials": ChorusProCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None,
|
|
112
|
+
"identifiant_structure": obj.get("identifiant_structure"),
|
|
113
|
+
"type_identifiant_structure": obj.get("type_identifiant_structure"),
|
|
114
|
+
"raison_sociale_structure": obj.get("raison_sociale_structure"),
|
|
115
|
+
"restreindre_structures_privees": obj.get("restreindre_structures_privees") if obj.get("restreindre_structures_privees") is not None else False
|
|
116
|
+
})
|
|
117
|
+
return _obj
|
|
118
|
+
|
|
119
|
+
|
|
@@ -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, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from factpulse.models.structure_info import StructureInfo
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class RechercherStructureResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Réponse de recherche de structures.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
code_retour: StrictInt = Field(description="Code retour (0 = succès)")
|
|
31
|
+
libelle: StrictStr = Field(description="Message de retour")
|
|
32
|
+
liste_structures: Optional[List[StructureInfo]] = None
|
|
33
|
+
total: Optional[StrictInt] = Field(default=0, description="Nombre total de résultats")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["code_retour", "libelle", "liste_structures", "total"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of RechercherStructureResponse from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in liste_structures (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.liste_structures:
|
|
78
|
+
for _item_liste_structures in self.liste_structures:
|
|
79
|
+
if _item_liste_structures:
|
|
80
|
+
_items.append(_item_liste_structures.to_dict())
|
|
81
|
+
_dict['liste_structures'] = _items
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of RechercherStructureResponse from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"code_retour": obj.get("code_retour"),
|
|
95
|
+
"libelle": obj.get("libelle"),
|
|
96
|
+
"liste_structures": [StructureInfo.from_dict(_item) for _item in obj["liste_structures"]] if obj.get("liste_structures") is not None else None,
|
|
97
|
+
"total": obj.get("total") if obj.get("total") is not None else 0
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
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.mode_paiement import ModePaiement
|
|
23
|
+
from factpulse.models.type_facture import TypeFacture
|
|
24
|
+
from factpulse.models.type_tva import TypeTVA
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class References(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Contient les références diverses de la facture (devise, type, etc.).
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
devise_facture: Optional[StrictStr] = Field(default='EUR', alias="deviseFacture")
|
|
33
|
+
mode_paiement: ModePaiement = Field(alias="modePaiement")
|
|
34
|
+
type_facture: TypeFacture = Field(alias="typeFacture")
|
|
35
|
+
type_tva: TypeTVA = Field(alias="typeTva")
|
|
36
|
+
numero_marche: Optional[StrictStr] = Field(default=None, alias="numeroMarche")
|
|
37
|
+
motif_exoneration_tva: Optional[StrictStr] = Field(default=None, alias="motifExonerationTva")
|
|
38
|
+
numero_bon_commande: Optional[StrictStr] = Field(default=None, alias="numeroBonCommande")
|
|
39
|
+
numero_facture_origine: Optional[StrictStr] = Field(default=None, alias="numeroFactureOrigine")
|
|
40
|
+
__properties: ClassVar[List[str]] = ["deviseFacture", "modePaiement", "typeFacture", "typeTva", "numeroMarche", "motifExonerationTva", "numeroBonCommande", "numeroFactureOrigine"]
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of References from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
# set to None if numero_marche (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.numero_marche is None and "numero_marche" in self.model_fields_set:
|
|
84
|
+
_dict['numeroMarche'] = None
|
|
85
|
+
|
|
86
|
+
# set to None if motif_exoneration_tva (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.motif_exoneration_tva is None and "motif_exoneration_tva" in self.model_fields_set:
|
|
89
|
+
_dict['motifExonerationTva'] = None
|
|
90
|
+
|
|
91
|
+
# set to None if numero_bon_commande (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.numero_bon_commande is None and "numero_bon_commande" in self.model_fields_set:
|
|
94
|
+
_dict['numeroBonCommande'] = None
|
|
95
|
+
|
|
96
|
+
# set to None if numero_facture_origine (nullable) is None
|
|
97
|
+
# and model_fields_set contains the field
|
|
98
|
+
if self.numero_facture_origine is None and "numero_facture_origine" in self.model_fields_set:
|
|
99
|
+
_dict['numeroFactureOrigine'] = None
|
|
100
|
+
|
|
101
|
+
return _dict
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
105
|
+
"""Create an instance of References from a dict"""
|
|
106
|
+
if obj is None:
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
if not isinstance(obj, dict):
|
|
110
|
+
return cls.model_validate(obj)
|
|
111
|
+
|
|
112
|
+
_obj = cls.model_validate({
|
|
113
|
+
"deviseFacture": obj.get("deviseFacture") if obj.get("deviseFacture") is not None else 'EUR',
|
|
114
|
+
"modePaiement": obj.get("modePaiement"),
|
|
115
|
+
"typeFacture": obj.get("typeFacture"),
|
|
116
|
+
"typeTva": obj.get("typeTva"),
|
|
117
|
+
"numeroMarche": obj.get("numeroMarche"),
|
|
118
|
+
"motifExonerationTva": obj.get("motifExonerationTva"),
|
|
119
|
+
"numeroBonCommande": obj.get("numeroBonCommande"),
|
|
120
|
+
"numeroFactureOrigine": obj.get("numeroFactureOrigine")
|
|
121
|
+
})
|
|
122
|
+
return _obj
|
|
123
|
+
|
|
124
|
+
|