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,104 @@
|
|
|
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 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
# Taux de TVA avec valeur manuelle.
|
|
18
|
+
module LigneDePosteTauxTvaManuel
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
+
def openapi_any_of
|
|
22
|
+
[
|
|
23
|
+
:'Float',
|
|
24
|
+
:'String'
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the object
|
|
29
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
30
|
+
# @return [Object] Returns the model or the data itself
|
|
31
|
+
def build(data)
|
|
32
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
33
|
+
# Note:
|
|
34
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
35
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
36
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
37
|
+
# - TODO: logging when debugging is set.
|
|
38
|
+
openapi_any_of.each do |klass|
|
|
39
|
+
begin
|
|
40
|
+
next if klass == :AnyType # "nullable: true"
|
|
41
|
+
return find_and_cast_into_type(klass, data)
|
|
42
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
52
|
+
|
|
53
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
54
|
+
def find_and_cast_into_type(klass, data)
|
|
55
|
+
return if data.nil?
|
|
56
|
+
|
|
57
|
+
case klass.to_s
|
|
58
|
+
when 'Boolean'
|
|
59
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
60
|
+
when 'Float'
|
|
61
|
+
return data if data.instance_of?(Float)
|
|
62
|
+
when 'Integer'
|
|
63
|
+
return data if data.instance_of?(Integer)
|
|
64
|
+
when 'Time'
|
|
65
|
+
return Time.parse(data)
|
|
66
|
+
when 'Date'
|
|
67
|
+
return Date.iso8601(data)
|
|
68
|
+
when 'String'
|
|
69
|
+
return data if data.instance_of?(String)
|
|
70
|
+
when 'Object' # "type: object"
|
|
71
|
+
return data if data.instance_of?(Hash)
|
|
72
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
73
|
+
if data.instance_of?(Array)
|
|
74
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
75
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
76
|
+
end
|
|
77
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
78
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
79
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
80
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
81
|
+
end
|
|
82
|
+
else # model
|
|
83
|
+
const = FactPulse.const_get(klass)
|
|
84
|
+
if const
|
|
85
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
86
|
+
model = const.build(data)
|
|
87
|
+
return model if model
|
|
88
|
+
else
|
|
89
|
+
# raise if data contains keys that are not known to the model
|
|
90
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
91
|
+
model = const.build_from_hash(data)
|
|
92
|
+
return model if model
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
raise # if no match by now, raise
|
|
98
|
+
rescue
|
|
99
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
end
|
|
@@ -0,0 +1,242 @@
|
|
|
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 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
# Représente une ligne de totalisation par taux de TVA.
|
|
18
|
+
class LigneDeTVA < ApiModelBase
|
|
19
|
+
attr_accessor :montant_base_ht
|
|
20
|
+
|
|
21
|
+
attr_accessor :montant_tva
|
|
22
|
+
|
|
23
|
+
attr_accessor :taux
|
|
24
|
+
|
|
25
|
+
attr_accessor :taux_manuel
|
|
26
|
+
|
|
27
|
+
attr_accessor :categorie
|
|
28
|
+
|
|
29
|
+
class EnumAttributeValidator
|
|
30
|
+
attr_reader :datatype
|
|
31
|
+
attr_reader :allowable_values
|
|
32
|
+
|
|
33
|
+
def initialize(datatype, allowable_values)
|
|
34
|
+
@allowable_values = allowable_values.map do |value|
|
|
35
|
+
case datatype.to_s
|
|
36
|
+
when /Integer/i
|
|
37
|
+
value.to_i
|
|
38
|
+
when /Float/i
|
|
39
|
+
value.to_f
|
|
40
|
+
else
|
|
41
|
+
value
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def valid?(value)
|
|
47
|
+
!value || allowable_values.include?(value)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
52
|
+
def self.attribute_map
|
|
53
|
+
{
|
|
54
|
+
:'montant_base_ht' => :'montantBaseHt',
|
|
55
|
+
:'montant_tva' => :'montantTva',
|
|
56
|
+
:'taux' => :'taux',
|
|
57
|
+
:'taux_manuel' => :'tauxManuel',
|
|
58
|
+
:'categorie' => :'categorie'
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Returns attribute mapping this model knows about
|
|
63
|
+
def self.acceptable_attribute_map
|
|
64
|
+
attribute_map
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Returns all the JSON keys this model knows about
|
|
68
|
+
def self.acceptable_attributes
|
|
69
|
+
acceptable_attribute_map.values
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Attribute type mapping.
|
|
73
|
+
def self.openapi_types
|
|
74
|
+
{
|
|
75
|
+
:'montant_base_ht' => :'Montantbaseht',
|
|
76
|
+
:'montant_tva' => :'Montanttva',
|
|
77
|
+
:'taux' => :'String',
|
|
78
|
+
:'taux_manuel' => :'Tauxmanuel',
|
|
79
|
+
:'categorie' => :'CategorieTVA'
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# List of attributes with nullable: true
|
|
84
|
+
def self.openapi_nullable
|
|
85
|
+
Set.new([
|
|
86
|
+
:'taux',
|
|
87
|
+
:'categorie'
|
|
88
|
+
])
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Initializes the object
|
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
93
|
+
def initialize(attributes = {})
|
|
94
|
+
if (!attributes.is_a?(Hash))
|
|
95
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::LigneDeTVA` initialize method"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
99
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
100
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
101
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
102
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::LigneDeTVA`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
103
|
+
end
|
|
104
|
+
h[k.to_sym] = v
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'montant_base_ht')
|
|
108
|
+
self.montant_base_ht = attributes[:'montant_base_ht']
|
|
109
|
+
else
|
|
110
|
+
self.montant_base_ht = nil
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'montant_tva')
|
|
114
|
+
self.montant_tva = attributes[:'montant_tva']
|
|
115
|
+
else
|
|
116
|
+
self.montant_tva = nil
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'taux')
|
|
120
|
+
self.taux = attributes[:'taux']
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'taux_manuel')
|
|
124
|
+
self.taux_manuel = attributes[:'taux_manuel']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'categorie')
|
|
128
|
+
self.categorie = attributes[:'categorie']
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
133
|
+
# @return Array for valid properties with the reasons
|
|
134
|
+
def list_invalid_properties
|
|
135
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
136
|
+
invalid_properties = Array.new
|
|
137
|
+
if @montant_base_ht.nil?
|
|
138
|
+
invalid_properties.push('invalid value for "montant_base_ht", montant_base_ht cannot be nil.')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if @montant_tva.nil?
|
|
142
|
+
invalid_properties.push('invalid value for "montant_tva", montant_tva cannot be nil.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
invalid_properties
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Check to see if the all the properties in the model are valid
|
|
149
|
+
# @return true if the model is valid
|
|
150
|
+
def valid?
|
|
151
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
152
|
+
return false if @montant_base_ht.nil?
|
|
153
|
+
return false if @montant_tva.nil?
|
|
154
|
+
true
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Custom attribute writer method with validation
|
|
158
|
+
# @param [Object] montant_base_ht Value to be assigned
|
|
159
|
+
def montant_base_ht=(montant_base_ht)
|
|
160
|
+
if montant_base_ht.nil?
|
|
161
|
+
fail ArgumentError, 'montant_base_ht cannot be nil'
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
@montant_base_ht = montant_base_ht
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Custom attribute writer method with validation
|
|
168
|
+
# @param [Object] montant_tva Value to be assigned
|
|
169
|
+
def montant_tva=(montant_tva)
|
|
170
|
+
if montant_tva.nil?
|
|
171
|
+
fail ArgumentError, 'montant_tva cannot be nil'
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
@montant_tva = montant_tva
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Checks equality by comparing each attribute.
|
|
178
|
+
# @param [Object] Object to be compared
|
|
179
|
+
def ==(o)
|
|
180
|
+
return true if self.equal?(o)
|
|
181
|
+
self.class == o.class &&
|
|
182
|
+
montant_base_ht == o.montant_base_ht &&
|
|
183
|
+
montant_tva == o.montant_tva &&
|
|
184
|
+
taux == o.taux &&
|
|
185
|
+
taux_manuel == o.taux_manuel &&
|
|
186
|
+
categorie == o.categorie
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# @see the `==` method
|
|
190
|
+
# @param [Object] Object to be compared
|
|
191
|
+
def eql?(o)
|
|
192
|
+
self == o
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Calculates hash code according to all attributes.
|
|
196
|
+
# @return [Integer] Hash code
|
|
197
|
+
def hash
|
|
198
|
+
[montant_base_ht, montant_tva, taux, taux_manuel, categorie].hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Builds the object from hash
|
|
202
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
203
|
+
# @return [Object] Returns the model itself
|
|
204
|
+
def self.build_from_hash(attributes)
|
|
205
|
+
return nil unless attributes.is_a?(Hash)
|
|
206
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
207
|
+
transformed_hash = {}
|
|
208
|
+
openapi_types.each_pair do |key, type|
|
|
209
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
210
|
+
transformed_hash["#{key}"] = nil
|
|
211
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
212
|
+
# check to ensure the input is an array given that the attribute
|
|
213
|
+
# is documented as an array but the input is not
|
|
214
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
215
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
216
|
+
end
|
|
217
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
218
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
new(transformed_hash)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Returns the object in the form of hash
|
|
225
|
+
# @return [Hash] Returns the object in the form of hash
|
|
226
|
+
def to_hash
|
|
227
|
+
hash = {}
|
|
228
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
229
|
+
value = self.send(attr)
|
|
230
|
+
if value.nil?
|
|
231
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
232
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
hash[param] = _to_hash(value)
|
|
236
|
+
end
|
|
237
|
+
hash
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
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 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
class ModeDepot
|
|
18
|
+
SAISIE_API = "SAISIE_API".freeze
|
|
19
|
+
DEPOT_PDF_API = "DEPOT_PDF_API".freeze
|
|
20
|
+
DEPOT_PDF_SIGNE_API = "DEPOT_PDF_SIGNE_API".freeze
|
|
21
|
+
|
|
22
|
+
def self.all_vars
|
|
23
|
+
@all_vars ||= [SAISIE_API, DEPOT_PDF_API, DEPOT_PDF_SIGNE_API].freeze
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Builds the enum from string
|
|
27
|
+
# @param [String] The enum value in the form of the string
|
|
28
|
+
# @return [String] The enum value
|
|
29
|
+
def self.build_from_hash(value)
|
|
30
|
+
new.build_from_hash(value)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Builds the enum from string
|
|
34
|
+
# @param [String] The enum value in the form of the string
|
|
35
|
+
# @return [String] The enum value
|
|
36
|
+
def build_from_hash(value)
|
|
37
|
+
return value if ModeDepot.all_vars.include?(value)
|
|
38
|
+
raise "Invalid ENUM value #{value} for class #ModeDepot"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
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 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
class ModePaiement
|
|
18
|
+
CHEQUE = "CHEQUE".freeze
|
|
19
|
+
PRELEVEMENT = "PRELEVEMENT".freeze
|
|
20
|
+
VIREMENT = "VIREMENT".freeze
|
|
21
|
+
ESPECE = "ESPECE".freeze
|
|
22
|
+
AUTRE = "AUTRE".freeze
|
|
23
|
+
REPORT = "REPORT".freeze
|
|
24
|
+
|
|
25
|
+
def self.all_vars
|
|
26
|
+
@all_vars ||= [CHEQUE, PRELEVEMENT, VIREMENT, ESPECE, AUTRE, REPORT].freeze
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Builds the enum from string
|
|
30
|
+
# @param [String] The enum value in the form of the string
|
|
31
|
+
# @return [String] The enum value
|
|
32
|
+
def self.build_from_hash(value)
|
|
33
|
+
new.build_from_hash(value)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Builds the enum from string
|
|
37
|
+
# @param [String] The enum value in the form of the string
|
|
38
|
+
# @return [String] The enum value
|
|
39
|
+
def build_from_hash(value)
|
|
40
|
+
return value if ModePaiement.all_vars.include?(value)
|
|
41
|
+
raise "Invalid ENUM value #{value} for class #ModePaiement"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
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 'time'
|
|
15
|
+
|
|
16
|
+
module FactPulse
|
|
17
|
+
module MontantHtTotal
|
|
18
|
+
class << self
|
|
19
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
20
|
+
def openapi_any_of
|
|
21
|
+
[
|
|
22
|
+
:'Float',
|
|
23
|
+
:'String'
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Builds the object
|
|
28
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
29
|
+
# @return [Object] Returns the model or the data itself
|
|
30
|
+
def build(data)
|
|
31
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
32
|
+
# Note:
|
|
33
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
34
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
35
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
36
|
+
# - TODO: logging when debugging is set.
|
|
37
|
+
openapi_any_of.each do |klass|
|
|
38
|
+
begin
|
|
39
|
+
next if klass == :AnyType # "nullable: true"
|
|
40
|
+
return find_and_cast_into_type(klass, data)
|
|
41
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
51
|
+
|
|
52
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
53
|
+
def find_and_cast_into_type(klass, data)
|
|
54
|
+
return if data.nil?
|
|
55
|
+
|
|
56
|
+
case klass.to_s
|
|
57
|
+
when 'Boolean'
|
|
58
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
59
|
+
when 'Float'
|
|
60
|
+
return data if data.instance_of?(Float)
|
|
61
|
+
when 'Integer'
|
|
62
|
+
return data if data.instance_of?(Integer)
|
|
63
|
+
when 'Time'
|
|
64
|
+
return Time.parse(data)
|
|
65
|
+
when 'Date'
|
|
66
|
+
return Date.iso8601(data)
|
|
67
|
+
when 'String'
|
|
68
|
+
return data if data.instance_of?(String)
|
|
69
|
+
when 'Object' # "type: object"
|
|
70
|
+
return data if data.instance_of?(Hash)
|
|
71
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
72
|
+
if data.instance_of?(Array)
|
|
73
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
74
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
75
|
+
end
|
|
76
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
77
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
78
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
79
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
80
|
+
end
|
|
81
|
+
else # model
|
|
82
|
+
const = FactPulse.const_get(klass)
|
|
83
|
+
if const
|
|
84
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
85
|
+
model = const.build(data)
|
|
86
|
+
return model if model
|
|
87
|
+
else
|
|
88
|
+
# raise if data contains keys that are not known to the model
|
|
89
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
90
|
+
model = const.build_from_hash(data)
|
|
91
|
+
return model if model
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
raise # if no match by now, raise
|
|
97
|
+
rescue
|
|
98
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|