factpulse 1.0.8
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +28 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +74 -0
- data/LICENSE +21 -0
- data/README.md +161 -0
- data/Rakefile +10 -0
- data/docs/AFNORPDPPAApi.md +69 -0
- data/docs/AFNORPDPPADirectoryServiceApi.md +196 -0
- data/docs/AFNORPDPPAFlowServiceApi.md +258 -0
- data/docs/AdresseElectronique.md +20 -0
- data/docs/AdressePostale.md +26 -0
- data/docs/BodyAjouterFichierApiV1ChorusProTransversesAjouterFichierPost.md +22 -0
- data/docs/BodyCompleterFactureApiV1ChorusProFacturesCompleterPost.md +22 -0
- data/docs/BodyListerServicesStructureApiV1ChorusProStructuresIdStructureCppServicesGet.md +20 -0
- data/docs/BodyRechercherFacturesDestinataireApiV1ChorusProFacturesRechercherDestinatairePost.md +22 -0
- data/docs/BodyRechercherFacturesFournisseurApiV1ChorusProFacturesRechercherFournisseurPost.md +22 -0
- data/docs/BodyRecyclerFactureApiV1ChorusProFacturesRecyclerPost.md +22 -0
- data/docs/BodyTelechargerGroupeFacturesApiV1ChorusProFacturesTelechargerGroupePost.md +22 -0
- data/docs/BodyTraiterFactureRecueApiV1ChorusProFacturesTraiterFactureRecuePost.md +22 -0
- data/docs/BodyValideurConsulterFactureApiV1ChorusProFacturesValideurConsulterPost.md +22 -0
- data/docs/BodyValideurRechercherFacturesApiV1ChorusProFacturesValideurRechercherPost.md +22 -0
- data/docs/BodyValideurTraiterFactureApiV1ChorusProFacturesValideurTraiterPost.md +22 -0
- data/docs/CadreDeFacturation.md +22 -0
- data/docs/CategorieTVA.md +15 -0
- data/docs/CertificateInfoResponse.md +40 -0
- data/docs/ChorusProApi.md +1129 -0
- data/docs/ChorusProCredentials.md +26 -0
- data/docs/CodeCadreFacturation.md +15 -0
- data/docs/CodeRaisonReduction.md +15 -0
- data/docs/ConsulterFactureRequest.md +20 -0
- data/docs/ConsulterFactureResponse.md +34 -0
- data/docs/ConsulterStructureRequest.md +22 -0
- data/docs/ConsulterStructureResponse.md +34 -0
- data/docs/CredentialsAFNOR.md +22 -0
- data/docs/CredentialsChorusPro.md +26 -0
- data/docs/Destinataire.md +24 -0
- data/docs/Destination.md +79 -0
- data/docs/DestinationAFNOR.md +24 -0
- data/docs/DestinationChorusPro.md +20 -0
- data/docs/DirectionFlux.md +15 -0
- data/docs/DonneesFactureSimplifiees.md +34 -0
- data/docs/FactureEnrichieInfoInput.md +32 -0
- data/docs/FactureEnrichieInfoOutput.md +32 -0
- data/docs/FactureFacturX.md +44 -0
- data/docs/FluxResume.md +32 -0
- data/docs/FormatSortie.md +15 -0
- data/docs/Fournisseur.md +34 -0
- data/docs/GenerateCertificateRequest.md +38 -0
- data/docs/GenerateCertificateResponse.md +32 -0
- data/docs/HTTPValidationError.md +18 -0
- data/docs/InformationSignatureAPI.md +28 -0
- data/docs/LigneDePoste.md +46 -0
- data/docs/LigneDePosteMontantRemiseHt.md +15 -0
- data/docs/LigneDePosteMontantTotalLigneHt.md +15 -0
- data/docs/LigneDePosteTauxTvaManuel.md +15 -0
- data/docs/LigneDeTVA.md +26 -0
- data/docs/ModeDepot.md +15 -0
- data/docs/ModePaiement.md +15 -0
- data/docs/MontantHtTotal.md +15 -0
- data/docs/MontantTotal.md +30 -0
- data/docs/MontantTotalAcompte.md +15 -0
- data/docs/MontantTotalMontantRemiseGlobaleTtc.md +15 -0
- data/docs/MontantTtcTotal.md +15 -0
- data/docs/MontantTva.md +15 -0
- data/docs/Montantapayer.md +15 -0
- data/docs/Montantbaseht.md +15 -0
- data/docs/Montanthttotal.md +15 -0
- data/docs/Montantttctotal.md +15 -0
- data/docs/Montanttva.md +15 -0
- data/docs/Montanttva1.md +15 -0
- data/docs/Montantunitaireht.md +15 -0
- data/docs/ObtenirIdChorusProRequest.md +22 -0
- data/docs/ObtenirIdChorusProResponse.md +24 -0
- data/docs/OptionsProcessing.md +24 -0
- data/docs/PDFFacturXInfo.md +22 -0
- data/docs/PDPCredentials.md +24 -0
- data/docs/ParametresSignature.md +34 -0
- data/docs/ParametresStructure.md +22 -0
- data/docs/PieceJointeComplementaire.md +26 -0
- data/docs/ProcessingEndpointsUnifisApi.md +147 -0
- data/docs/ProfilAPI.md +15 -0
- data/docs/ProfilFlux.md +15 -0
- data/docs/Quantite.md +15 -0
- data/docs/QuotaInfo.md +26 -0
- data/docs/RechercherServicesResponse.md +24 -0
- data/docs/RechercherStructureRequest.md +26 -0
- data/docs/RechercherStructureResponse.md +24 -0
- data/docs/References.md +32 -0
- data/docs/ReponseHealthcheckAFNOR.md +22 -0
- data/docs/ReponseRechercheFlux.md +24 -0
- data/docs/ReponseSoumissionFlux.md +30 -0
- data/docs/ReponseTache.md +18 -0
- data/docs/ReponseValidationErreur.md +18 -0
- data/docs/ReponseValidationSucces.md +18 -0
- data/docs/RequeteRechercheFlux.md +34 -0
- data/docs/RequeteSoumissionFlux.md +28 -0
- data/docs/ResultatAFNOR.md +26 -0
- data/docs/ResultatChorusPro.md +22 -0
- data/docs/ResultatValidationPDFAPI.md +62 -0
- data/docs/SantApi.md +69 -0
- data/docs/SchemeID.md +15 -0
- data/docs/ServiceStructure.md +24 -0
- data/docs/SignatureInfo.md +22 -0
- data/docs/SignatureLectroniqueApi.md +315 -0
- data/docs/SoumettreFactureCompleteRequest.md +26 -0
- data/docs/SoumettreFactureCompleteResponse.md +34 -0
- data/docs/SoumettreFactureRequest.md +46 -0
- data/docs/SoumettreFactureResponse.md +24 -0
- data/docs/StatutAcquittement.md +15 -0
- data/docs/StatutFacture.md +22 -0
- data/docs/StatutTache.md +22 -0
- data/docs/StructureInfo.md +26 -0
- data/docs/SyntaxeFlux.md +15 -0
- data/docs/Tauxmanuel.md +15 -0
- data/docs/TraitementFactureApi.md +831 -0
- data/docs/TypeFacture.md +15 -0
- data/docs/TypeFlux.md +15 -0
- data/docs/TypeTVA.md +15 -0
- data/docs/Unite.md +15 -0
- data/docs/Utilisateur.md +40 -0
- data/docs/UtilisateurApi.md +74 -0
- data/docs/ValidationError.md +22 -0
- data/docs/ValidationErrorLocInner.md +15 -0
- data/factpulse.gemspec +39 -0
- data/git_push.sh +57 -0
- data/lib/factpulse/api/afnorpdppa_api.rb +79 -0
- data/lib/factpulse/api/afnorpdppa_directory_service_api.rb +199 -0
- data/lib/factpulse/api/afnorpdppa_flow_service_api.rb +256 -0
- data/lib/factpulse/api/chorus_pro_api.rb +1116 -0
- data/lib/factpulse/api/processing_endpoints_unifis_api.rb +158 -0
- data/lib/factpulse/api/sant_api.rb +79 -0
- data/lib/factpulse/api/signature_lectronique_api.rb +333 -0
- data/lib/factpulse/api/traitement_facture_api.rb +835 -0
- data/lib/factpulse/api/utilisateur_api.rb +79 -0
- data/lib/factpulse/api_client.rb +393 -0
- data/lib/factpulse/api_error.rb +58 -0
- data/lib/factpulse/api_model_base.rb +88 -0
- data/lib/factpulse/configuration.rb +308 -0
- data/lib/factpulse/models/adresse_electronique.rb +196 -0
- data/lib/factpulse/models/adresse_postale.rb +189 -0
- data/lib/factpulse/models/body_ajouter_fichier_api_v1_chorus_pro_transverses_ajouter_fichier_post.rb +202 -0
- data/lib/factpulse/models/body_completer_facture_api_v1_chorus_pro_factures_completer_post.rb +202 -0
- data/lib/factpulse/models/body_lister_services_structure_api_v1_chorus_pro_structures_id_structure_cpp_services_get.rb +174 -0
- data/lib/factpulse/models/body_rechercher_factures_destinataire_api_v1_chorus_pro_factures_rechercher_destinataire_post.rb +202 -0
- data/lib/factpulse/models/body_rechercher_factures_fournisseur_api_v1_chorus_pro_factures_rechercher_fournisseur_post.rb +202 -0
- data/lib/factpulse/models/body_recycler_facture_api_v1_chorus_pro_factures_recycler_post.rb +202 -0
- data/lib/factpulse/models/body_telecharger_groupe_factures_api_v1_chorus_pro_factures_telecharger_groupe_post.rb +202 -0
- data/lib/factpulse/models/body_traiter_facture_recue_api_v1_chorus_pro_factures_traiter_facture_recue_post.rb +202 -0
- data/lib/factpulse/models/body_valideur_consulter_facture_api_v1_chorus_pro_factures_valideur_consulter_post.rb +202 -0
- data/lib/factpulse/models/body_valideur_rechercher_factures_api_v1_chorus_pro_factures_valideur_rechercher_post.rb +202 -0
- data/lib/factpulse/models/body_valideur_traiter_facture_api_v1_chorus_pro_factures_valideur_traiter_post.rb +202 -0
- data/lib/factpulse/models/cadre_de_facturation.rb +207 -0
- data/lib/factpulse/models/categorie_tva.rb +47 -0
- data/lib/factpulse/models/certificate_info_response.rb +446 -0
- data/lib/factpulse/models/chorus_pro_credentials.rb +259 -0
- data/lib/factpulse/models/code_cadre_facturation.rb +42 -0
- data/lib/factpulse/models/code_raison_reduction.rb +45 -0
- data/lib/factpulse/models/consulter_facture_request.rb +176 -0
- data/lib/factpulse/models/consulter_facture_response.rb +261 -0
- data/lib/factpulse/models/consulter_structure_request.rb +188 -0
- data/lib/factpulse/models/consulter_structure_response.rb +261 -0
- data/lib/factpulse/models/credentials_afnor.rb +169 -0
- data/lib/factpulse/models/credentials_chorus_pro.rb +191 -0
- data/lib/factpulse/models/destinataire.rb +195 -0
- data/lib/factpulse/models/destination.rb +56 -0
- data/lib/factpulse/models/destination_afnor.rb +228 -0
- data/lib/factpulse/models/destination_chorus_pro.rb +194 -0
- data/lib/factpulse/models/direction_flux.rb +40 -0
- data/lib/factpulse/models/donnees_facture_simplifiees.rb +342 -0
- data/lib/factpulse/models/facture_enrichie_info_input.rb +315 -0
- data/lib/factpulse/models/facture_enrichie_info_output.rb +348 -0
- data/lib/factpulse/models/facture_factur_x.rb +432 -0
- data/lib/factpulse/models/flux_resume.rb +251 -0
- data/lib/factpulse/models/format_sortie.rb +40 -0
- data/lib/factpulse/models/fournisseur.rb +261 -0
- data/lib/factpulse/models/generate_certificate_request.rb +323 -0
- data/lib/factpulse/models/generate_certificate_response.rb +254 -0
- data/lib/factpulse/models/http_validation_error.rb +149 -0
- data/lib/factpulse/models/information_signature_api.rb +216 -0
- data/lib/factpulse/models/ligne_de_poste.rb +391 -0
- data/lib/factpulse/models/ligne_de_poste_montant_remise_ht.rb +104 -0
- data/lib/factpulse/models/ligne_de_poste_montant_total_ligne_ht.rb +104 -0
- data/lib/factpulse/models/ligne_de_poste_taux_tva_manuel.rb +104 -0
- data/lib/factpulse/models/ligne_de_tva.rb +242 -0
- data/lib/factpulse/models/mode_depot.rb +41 -0
- data/lib/factpulse/models/mode_paiement.rb +44 -0
- data/lib/factpulse/models/montant_ht_total.rb +103 -0
- data/lib/factpulse/models/montant_total.rb +273 -0
- data/lib/factpulse/models/montant_total_acompte.rb +104 -0
- data/lib/factpulse/models/montant_total_montant_remise_globale_ttc.rb +104 -0
- data/lib/factpulse/models/montant_ttc_total.rb +103 -0
- data/lib/factpulse/models/montant_tva.rb +103 -0
- data/lib/factpulse/models/montantapayer.rb +104 -0
- data/lib/factpulse/models/montantbaseht.rb +104 -0
- data/lib/factpulse/models/montanthttotal.rb +104 -0
- data/lib/factpulse/models/montantttctotal.rb +104 -0
- data/lib/factpulse/models/montanttva.rb +104 -0
- data/lib/factpulse/models/montanttva1.rb +104 -0
- data/lib/factpulse/models/montantunitaireht.rb +104 -0
- data/lib/factpulse/models/obtenir_id_chorus_pro_request.rb +188 -0
- data/lib/factpulse/models/obtenir_id_chorus_pro_response.rb +230 -0
- data/lib/factpulse/models/options_processing.rb +221 -0
- data/lib/factpulse/models/parametres_signature.rb +235 -0
- data/lib/factpulse/models/parametres_structure.rb +175 -0
- data/lib/factpulse/models/pdf_factur_x_info.rb +205 -0
- data/lib/factpulse/models/pdp_credentials.rb +247 -0
- data/lib/factpulse/models/piece_jointe_complementaire.rb +269 -0
- data/lib/factpulse/models/profil_api.rb +42 -0
- data/lib/factpulse/models/profil_flux.rb +41 -0
- data/lib/factpulse/models/quantite.rb +104 -0
- data/lib/factpulse/models/quota_info.rb +269 -0
- data/lib/factpulse/models/rechercher_services_response.rb +214 -0
- data/lib/factpulse/models/rechercher_structure_request.rb +191 -0
- data/lib/factpulse/models/rechercher_structure_response.rb +216 -0
- data/lib/factpulse/models/references.rb +290 -0
- data/lib/factpulse/models/reponse_healthcheck_afnor.rb +220 -0
- data/lib/factpulse/models/reponse_recherche_flux.rb +249 -0
- data/lib/factpulse/models/reponse_soumission_flux.rb +294 -0
- data/lib/factpulse/models/reponse_tache.rb +165 -0
- data/lib/factpulse/models/reponse_validation_erreur.rb +167 -0
- data/lib/factpulse/models/reponse_validation_succes.rb +165 -0
- data/lib/factpulse/models/requete_recherche_flux.rb +306 -0
- data/lib/factpulse/models/requete_soumission_flux.rb +238 -0
- data/lib/factpulse/models/resultat_afnor.rb +240 -0
- data/lib/factpulse/models/resultat_chorus_pro.rb +186 -0
- data/lib/factpulse/models/resultat_validation_pdfapi.rb +523 -0
- data/lib/factpulse/models/scheme_id.rb +43 -0
- data/lib/factpulse/models/service_structure.rb +247 -0
- data/lib/factpulse/models/signature_info.rb +186 -0
- data/lib/factpulse/models/soumettre_facture_complete_request.rb +239 -0
- data/lib/factpulse/models/soumettre_facture_complete_response.rb +355 -0
- data/lib/factpulse/models/soumettre_facture_request.rb +391 -0
- data/lib/factpulse/models/soumettre_facture_response.rb +213 -0
- data/lib/factpulse/models/statut_acquittement.rb +41 -0
- data/lib/factpulse/models/statut_facture.rb +203 -0
- data/lib/factpulse/models/statut_tache.rb +201 -0
- data/lib/factpulse/models/structure_info.rb +274 -0
- data/lib/factpulse/models/syntaxe_flux.rb +43 -0
- data/lib/factpulse/models/tauxmanuel.rb +104 -0
- data/lib/factpulse/models/type_facture.rb +40 -0
- data/lib/factpulse/models/type_flux.rb +43 -0
- data/lib/factpulse/models/type_tva.rb +42 -0
- data/lib/factpulse/models/unite.rb +44 -0
- data/lib/factpulse/models/utilisateur.rb +328 -0
- data/lib/factpulse/models/validation_error.rb +218 -0
- data/lib/factpulse/models/validation_error_loc_inner.rb +103 -0
- data/lib/factpulse/version.rb +15 -0
- data/lib/factpulse.rb +157 -0
- metadata +382 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#API REST FactPulse
|
|
3
|
+
|
|
4
|
+
# 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/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module FactPulse
|
|
16
|
+
class UtilisateurApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Obtenir les informations de l'utilisateur connecté
|
|
23
|
+
# Retourne les informations de l'utilisateur authentifié. Cet endpoint permet de : - Vérifier que l'authentification fonctionne - Obtenir les détails du compte connecté - Tester la validité du token JWT - Consulter son quota de consommation **Nécessite une authentification valide.**
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @return [Object]
|
|
26
|
+
def obtenir_infos_utilisateur_api_v1_moi_get(opts = {})
|
|
27
|
+
data, _status_code, _headers = obtenir_infos_utilisateur_api_v1_moi_get_with_http_info(opts)
|
|
28
|
+
data
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Obtenir les informations de l'utilisateur connecté
|
|
32
|
+
# Retourne les informations de l'utilisateur authentifié. Cet endpoint permet de : - Vérifier que l'authentification fonctionne - Obtenir les détails du compte connecté - Tester la validité du token JWT - Consulter son quota de consommation **Nécessite une authentification valide.**
|
|
33
|
+
# @param [Hash] opts the optional parameters
|
|
34
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
|
35
|
+
def obtenir_infos_utilisateur_api_v1_moi_get_with_http_info(opts = {})
|
|
36
|
+
if @api_client.config.debugging
|
|
37
|
+
@api_client.config.logger.debug 'Calling API: UtilisateurApi.obtenir_infos_utilisateur_api_v1_moi_get ...'
|
|
38
|
+
end
|
|
39
|
+
# resource path
|
|
40
|
+
local_var_path = '/api/v1/moi'
|
|
41
|
+
|
|
42
|
+
# query parameters
|
|
43
|
+
query_params = opts[:query_params] || {}
|
|
44
|
+
|
|
45
|
+
# header parameters
|
|
46
|
+
header_params = opts[:header_params] || {}
|
|
47
|
+
# HTTP header 'Accept' (if needed)
|
|
48
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
49
|
+
|
|
50
|
+
# form parameters
|
|
51
|
+
form_params = opts[:form_params] || {}
|
|
52
|
+
|
|
53
|
+
# http body (model)
|
|
54
|
+
post_body = opts[:debug_body]
|
|
55
|
+
|
|
56
|
+
# return_type
|
|
57
|
+
return_type = opts[:debug_return_type] || 'Object'
|
|
58
|
+
|
|
59
|
+
# auth_names
|
|
60
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
61
|
+
|
|
62
|
+
new_options = opts.merge(
|
|
63
|
+
:operation => :"UtilisateurApi.obtenir_infos_utilisateur_api_v1_moi_get",
|
|
64
|
+
:header_params => header_params,
|
|
65
|
+
:query_params => query_params,
|
|
66
|
+
:form_params => form_params,
|
|
67
|
+
:body => post_body,
|
|
68
|
+
:auth_names => auth_names,
|
|
69
|
+
:return_type => return_type
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
73
|
+
if @api_client.config.debugging
|
|
74
|
+
@api_client.config.logger.debug "API called: UtilisateurApi#obtenir_infos_utilisateur_api_v1_moi_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
75
|
+
end
|
|
76
|
+
return data, status_code, headers
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#API REST FactPulse
|
|
3
|
+
|
|
4
|
+
# 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/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'logger'
|
|
16
|
+
require 'tempfile'
|
|
17
|
+
require 'time'
|
|
18
|
+
require 'typhoeus'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
module FactPulse
|
|
22
|
+
class ApiClient
|
|
23
|
+
# The Configuration object holding settings to be used in the API client.
|
|
24
|
+
attr_accessor :config
|
|
25
|
+
|
|
26
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
|
27
|
+
#
|
|
28
|
+
# @return [Hash]
|
|
29
|
+
attr_accessor :default_headers
|
|
30
|
+
|
|
31
|
+
# Initializes the ApiClient
|
|
32
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
|
33
|
+
def initialize(config = Configuration.default)
|
|
34
|
+
@config = config
|
|
35
|
+
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
|
36
|
+
@default_headers = {
|
|
37
|
+
'Content-Type' => 'application/json',
|
|
38
|
+
'User-Agent' => @user_agent
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.default
|
|
43
|
+
@@default ||= ApiClient.new
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Call an API with given options.
|
|
47
|
+
#
|
|
48
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
|
49
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
|
50
|
+
def call_api(http_method, path, opts = {})
|
|
51
|
+
request = build_request(http_method, path, opts)
|
|
52
|
+
tempfile = nil
|
|
53
|
+
(download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
|
|
54
|
+
response = request.run
|
|
55
|
+
|
|
56
|
+
if @config.debugging
|
|
57
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
unless response.success?
|
|
61
|
+
if response.timed_out?
|
|
62
|
+
fail ApiError.new('Connection timed out')
|
|
63
|
+
elsif response.code == 0
|
|
64
|
+
# Errors from libcurl will be made visible here
|
|
65
|
+
fail ApiError.new(:code => 0,
|
|
66
|
+
:message => response.return_message)
|
|
67
|
+
else
|
|
68
|
+
fail ApiError.new(:code => response.code,
|
|
69
|
+
:response_headers => response.headers,
|
|
70
|
+
:response_body => response.body),
|
|
71
|
+
response.status_message
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if opts[:return_type] == 'File'
|
|
76
|
+
data = tempfile
|
|
77
|
+
elsif opts[:return_type]
|
|
78
|
+
data = deserialize(response, opts[:return_type])
|
|
79
|
+
else
|
|
80
|
+
data = nil
|
|
81
|
+
end
|
|
82
|
+
return data, response.code, response.headers
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Builds the HTTP request
|
|
86
|
+
#
|
|
87
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
|
88
|
+
# @param [String] path URL path (e.g. /account/new)
|
|
89
|
+
# @option opts [Hash] :header_params Header parameters
|
|
90
|
+
# @option opts [Hash] :query_params Query parameters
|
|
91
|
+
# @option opts [Hash] :form_params Query parameters
|
|
92
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
|
93
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
|
94
|
+
def build_request(http_method, path, opts = {})
|
|
95
|
+
url = build_request_url(path, opts)
|
|
96
|
+
http_method = http_method.to_sym.downcase
|
|
97
|
+
|
|
98
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
|
99
|
+
query_params = opts[:query_params] || {}
|
|
100
|
+
form_params = opts[:form_params] || {}
|
|
101
|
+
follow_location = opts[:follow_location] || true
|
|
102
|
+
|
|
103
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
|
104
|
+
|
|
105
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
|
106
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
|
107
|
+
|
|
108
|
+
req_opts = {
|
|
109
|
+
:method => http_method,
|
|
110
|
+
:headers => header_params,
|
|
111
|
+
:params => query_params,
|
|
112
|
+
:params_encoding => @config.params_encoding,
|
|
113
|
+
:timeout => @config.timeout,
|
|
114
|
+
:ssl_verifypeer => @config.verify_ssl,
|
|
115
|
+
:ssl_verifyhost => _verify_ssl_host,
|
|
116
|
+
:sslcert => @config.cert_file,
|
|
117
|
+
:sslkey => @config.key_file,
|
|
118
|
+
:verbose => @config.debugging,
|
|
119
|
+
:followlocation => follow_location
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# set custom cert, if provided
|
|
123
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
|
124
|
+
|
|
125
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
|
126
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
|
127
|
+
req_opts.update :body => req_body
|
|
128
|
+
if @config.debugging
|
|
129
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
Typhoeus::Request.new(url, req_opts)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Builds the HTTP request body
|
|
137
|
+
#
|
|
138
|
+
# @param [Hash] header_params Header parameters
|
|
139
|
+
# @param [Hash] form_params Query parameters
|
|
140
|
+
# @param [Object] body HTTP body (JSON/XML)
|
|
141
|
+
# @return [String] HTTP body data in the form of string
|
|
142
|
+
def build_request_body(header_params, form_params, body)
|
|
143
|
+
# http form
|
|
144
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
|
145
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
|
146
|
+
data = {}
|
|
147
|
+
form_params.each do |key, value|
|
|
148
|
+
case value
|
|
149
|
+
when ::File, ::Array, nil
|
|
150
|
+
# let typhoeus handle File, Array and nil parameters
|
|
151
|
+
data[key] = value
|
|
152
|
+
else
|
|
153
|
+
data[key] = value.to_s
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
elsif body
|
|
157
|
+
data = body.is_a?(String) ? body : body.to_json
|
|
158
|
+
else
|
|
159
|
+
data = nil
|
|
160
|
+
end
|
|
161
|
+
data
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
|
165
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
|
166
|
+
# The response body is written to the file in chunks in order to handle files which
|
|
167
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
|
168
|
+
# process can use.
|
|
169
|
+
#
|
|
170
|
+
# @see Configuration#temp_folder_path
|
|
171
|
+
#
|
|
172
|
+
# @return [Tempfile] the tempfile generated
|
|
173
|
+
def download_file(request)
|
|
174
|
+
tempfile = nil
|
|
175
|
+
encoding = nil
|
|
176
|
+
request.on_headers do |response|
|
|
177
|
+
content_disposition = response.headers['Content-Disposition']
|
|
178
|
+
if content_disposition && content_disposition =~ /filename=/i
|
|
179
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
180
|
+
prefix = sanitize_filename(filename)
|
|
181
|
+
else
|
|
182
|
+
prefix = 'download-'
|
|
183
|
+
end
|
|
184
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
185
|
+
encoding = response.body.encoding
|
|
186
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
187
|
+
end
|
|
188
|
+
request.on_body do |chunk|
|
|
189
|
+
chunk.force_encoding(encoding)
|
|
190
|
+
tempfile.write(chunk)
|
|
191
|
+
end
|
|
192
|
+
request.on_complete do
|
|
193
|
+
if !tempfile
|
|
194
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
|
195
|
+
end
|
|
196
|
+
tempfile.close
|
|
197
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
198
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
199
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
200
|
+
"explicitly with `tempfile.delete`"
|
|
201
|
+
yield tempfile if block_given?
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Check if the given MIME is a JSON MIME.
|
|
206
|
+
# JSON MIME examples:
|
|
207
|
+
# application/json
|
|
208
|
+
# application/json; charset=UTF8
|
|
209
|
+
# APPLICATION/JSON
|
|
210
|
+
# */*
|
|
211
|
+
# @param [String] mime MIME
|
|
212
|
+
# @return [Boolean] True if the MIME is application/json
|
|
213
|
+
def json_mime?(mime)
|
|
214
|
+
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Deserialize the response to the given return type.
|
|
218
|
+
#
|
|
219
|
+
# @param [Response] response HTTP response
|
|
220
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
|
221
|
+
def deserialize(response, return_type)
|
|
222
|
+
body = response.body
|
|
223
|
+
return nil if body.nil? || body.empty?
|
|
224
|
+
|
|
225
|
+
# return response body directly for String return type
|
|
226
|
+
return body.to_s if return_type == 'String'
|
|
227
|
+
|
|
228
|
+
# ensuring a default content type
|
|
229
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
|
230
|
+
|
|
231
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
|
232
|
+
|
|
233
|
+
begin
|
|
234
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
|
235
|
+
rescue JSON::ParserError => e
|
|
236
|
+
if %w(String Date Time).include?(return_type)
|
|
237
|
+
data = body
|
|
238
|
+
else
|
|
239
|
+
raise e
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
convert_to_type data, return_type
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Convert data to the given return type.
|
|
247
|
+
# @param [Object] data Data to be converted
|
|
248
|
+
# @param [String] return_type Return type
|
|
249
|
+
# @return [Mixed] Data in a particular type
|
|
250
|
+
def convert_to_type(data, return_type)
|
|
251
|
+
return nil if data.nil?
|
|
252
|
+
case return_type
|
|
253
|
+
when 'String'
|
|
254
|
+
data.to_s
|
|
255
|
+
when 'Integer'
|
|
256
|
+
data.to_i
|
|
257
|
+
when 'Float'
|
|
258
|
+
data.to_f
|
|
259
|
+
when 'Boolean'
|
|
260
|
+
data == true
|
|
261
|
+
when 'Time'
|
|
262
|
+
# parse date time (expecting ISO 8601 format)
|
|
263
|
+
Time.parse data
|
|
264
|
+
when 'Date'
|
|
265
|
+
# parse date time (expecting ISO 8601 format)
|
|
266
|
+
Date.parse data
|
|
267
|
+
when 'Object'
|
|
268
|
+
# generic object (usually a Hash), return directly
|
|
269
|
+
data
|
|
270
|
+
when /\AArray<(.+)>\z/
|
|
271
|
+
# e.g. Array<Pet>
|
|
272
|
+
sub_type = $1
|
|
273
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
|
274
|
+
when /\AHash\<String, (.+)\>\z/
|
|
275
|
+
# e.g. Hash<String, Integer>
|
|
276
|
+
sub_type = $1
|
|
277
|
+
{}.tap do |hash|
|
|
278
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
|
279
|
+
end
|
|
280
|
+
else
|
|
281
|
+
# models (e.g. Pet) or oneOf
|
|
282
|
+
klass = FactPulse.const_get(return_type)
|
|
283
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Sanitize filename by removing path.
|
|
288
|
+
# e.g. ../../sun.gif becomes sun.gif
|
|
289
|
+
#
|
|
290
|
+
# @param [String] filename the filename to be sanitized
|
|
291
|
+
# @return [String] the sanitized filename
|
|
292
|
+
def sanitize_filename(filename)
|
|
293
|
+
filename.split(/[\/\\]/).last
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def build_request_url(path, opts = {})
|
|
297
|
+
# Add leading and trailing slashes to path
|
|
298
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
|
299
|
+
@config.base_url(opts[:operation]) + path
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Update header and query params based on authentication settings.
|
|
303
|
+
#
|
|
304
|
+
# @param [Hash] header_params Header parameters
|
|
305
|
+
# @param [Hash] query_params Query parameters
|
|
306
|
+
# @param [String] auth_names Authentication scheme name
|
|
307
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
|
308
|
+
Array(auth_names).each do |auth_name|
|
|
309
|
+
auth_setting = @config.auth_settings[auth_name]
|
|
310
|
+
next unless auth_setting
|
|
311
|
+
case auth_setting[:in]
|
|
312
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
|
313
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
|
314
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Sets user agent in HTTP header
|
|
320
|
+
#
|
|
321
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
|
322
|
+
def user_agent=(user_agent)
|
|
323
|
+
@user_agent = user_agent
|
|
324
|
+
@default_headers['User-Agent'] = @user_agent
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
# Return Accept header based on an array of accepts provided.
|
|
328
|
+
# @param [Array] accepts array for Accept
|
|
329
|
+
# @return [String] the Accept header (e.g. application/json)
|
|
330
|
+
def select_header_accept(accepts)
|
|
331
|
+
return nil if accepts.nil? || accepts.empty?
|
|
332
|
+
# use JSON when present, otherwise use all of the provided
|
|
333
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
|
334
|
+
json_accept || accepts.join(',')
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Return Content-Type header based on an array of content types provided.
|
|
338
|
+
# @param [Array] content_types array for Content-Type
|
|
339
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
|
340
|
+
def select_header_content_type(content_types)
|
|
341
|
+
# return nil by default
|
|
342
|
+
return if content_types.nil? || content_types.empty?
|
|
343
|
+
# use JSON when present, otherwise use the first one
|
|
344
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
|
345
|
+
json_content_type || content_types.first
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
|
349
|
+
# @param [Object] model object to be converted into JSON string
|
|
350
|
+
# @return [String] JSON string representation of the object
|
|
351
|
+
def object_to_http_body(model)
|
|
352
|
+
return model if model.nil? || model.is_a?(String)
|
|
353
|
+
local_body = nil
|
|
354
|
+
if model.is_a?(Array)
|
|
355
|
+
local_body = model.map { |m| object_to_hash(m) }
|
|
356
|
+
else
|
|
357
|
+
local_body = object_to_hash(model)
|
|
358
|
+
end
|
|
359
|
+
local_body.to_json
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Convert object(non-array) to hash.
|
|
363
|
+
# @param [Object] obj object to be converted into JSON string
|
|
364
|
+
# @return [String] JSON string representation of the object
|
|
365
|
+
def object_to_hash(obj)
|
|
366
|
+
if obj.respond_to?(:to_hash)
|
|
367
|
+
obj.to_hash
|
|
368
|
+
else
|
|
369
|
+
obj
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# Build parameter value according to the given collection format.
|
|
374
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
|
375
|
+
def build_collection_param(param, collection_format)
|
|
376
|
+
case collection_format
|
|
377
|
+
when :csv
|
|
378
|
+
param.join(',')
|
|
379
|
+
when :ssv
|
|
380
|
+
param.join(' ')
|
|
381
|
+
when :tsv
|
|
382
|
+
param.join("\t")
|
|
383
|
+
when :pipes
|
|
384
|
+
param.join('|')
|
|
385
|
+
when :multi
|
|
386
|
+
# return the array directly as typhoeus will handle it as expected
|
|
387
|
+
param
|
|
388
|
+
else
|
|
389
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#API REST FactPulse
|
|
3
|
+
|
|
4
|
+
# 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/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module FactPulse
|
|
14
|
+
class ApiError < StandardError
|
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
|
16
|
+
|
|
17
|
+
# Usage examples:
|
|
18
|
+
# ApiError.new
|
|
19
|
+
# ApiError.new("message")
|
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
|
22
|
+
def initialize(arg = nil)
|
|
23
|
+
if arg.is_a? Hash
|
|
24
|
+
if arg.key?(:message) || arg.key?('message')
|
|
25
|
+
super(arg[:message] || arg['message'])
|
|
26
|
+
else
|
|
27
|
+
super arg
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
arg.each do |k, v|
|
|
31
|
+
instance_variable_set "@#{k}", v
|
|
32
|
+
end
|
|
33
|
+
else
|
|
34
|
+
super arg
|
|
35
|
+
@message = arg
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Override to_s to display a friendly error message
|
|
40
|
+
def to_s
|
|
41
|
+
message
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def message
|
|
45
|
+
if @message.nil?
|
|
46
|
+
msg = "Error message: the server returns an error"
|
|
47
|
+
else
|
|
48
|
+
msg = @message
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
msg += "\nHTTP status code: #{code}" if code
|
|
52
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
|
53
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
|
54
|
+
|
|
55
|
+
msg
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#API REST FactPulse
|
|
3
|
+
|
|
4
|
+
# 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/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module FactPulse
|
|
14
|
+
class ApiModelBase
|
|
15
|
+
# Deserializes the data based on type
|
|
16
|
+
# @param string type Data type
|
|
17
|
+
# @param string value Value to be deserialized
|
|
18
|
+
# @return [Object] Deserialized data
|
|
19
|
+
def self._deserialize(type, value)
|
|
20
|
+
case type.to_sym
|
|
21
|
+
when :Time
|
|
22
|
+
Time.parse(value)
|
|
23
|
+
when :Date
|
|
24
|
+
Date.parse(value)
|
|
25
|
+
when :String
|
|
26
|
+
value.to_s
|
|
27
|
+
when :Integer
|
|
28
|
+
value.to_i
|
|
29
|
+
when :Float
|
|
30
|
+
value.to_f
|
|
31
|
+
when :Boolean
|
|
32
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
33
|
+
true
|
|
34
|
+
else
|
|
35
|
+
false
|
|
36
|
+
end
|
|
37
|
+
when :Object
|
|
38
|
+
# generic object (usually a Hash), return directly
|
|
39
|
+
value
|
|
40
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
41
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
42
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
43
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
44
|
+
k_type = Regexp.last_match[:k_type]
|
|
45
|
+
v_type = Regexp.last_match[:v_type]
|
|
46
|
+
{}.tap do |hash|
|
|
47
|
+
value.each do |k, v|
|
|
48
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
else # model
|
|
52
|
+
# models (e.g. Pet) or oneOf
|
|
53
|
+
klass = FactPulse.const_get(type)
|
|
54
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns the string representation of the object
|
|
59
|
+
# @return [String] String presentation of the object
|
|
60
|
+
def to_s
|
|
61
|
+
to_hash.to_s
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
65
|
+
# @return [Hash] Returns the object in the form of hash
|
|
66
|
+
def to_body
|
|
67
|
+
to_hash
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Outputs non-array value in the form of hash
|
|
71
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
72
|
+
# @param [Object] value Any valid value
|
|
73
|
+
# @return [Hash] Returns the value in the form of hash
|
|
74
|
+
def _to_hash(value)
|
|
75
|
+
if value.is_a?(Array)
|
|
76
|
+
value.compact.map { |v| _to_hash(v) }
|
|
77
|
+
elsif value.is_a?(Hash)
|
|
78
|
+
{}.tap do |hash|
|
|
79
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
80
|
+
end
|
|
81
|
+
elsif value.respond_to? :to_hash
|
|
82
|
+
value.to_hash
|
|
83
|
+
else
|
|
84
|
+
value
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|