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,831 @@
|
|
|
1
|
+
# FactPulse::TraitementFactureApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *http://localhost*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**generer_certificat_test_api_v1_traitement_generer_certificat_test_post**](TraitementFactureApi.md#generer_certificat_test_api_v1_traitement_generer_certificat_test_post) | **POST** /api/v1/traitement/generer-certificat-test | Générer un certificat X.509 auto-signé de test |
|
|
8
|
+
| [**generer_facture_api_v1_traitement_generer_facture_post**](TraitementFactureApi.md#generer_facture_api_v1_traitement_generer_facture_post) | **POST** /api/v1/traitement/generer-facture | Générer une facture Factur-X |
|
|
9
|
+
| [**obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get**](TraitementFactureApi.md#obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get) | **GET** /api/v1/traitement/taches/{id_tache}/statut | Obtenir le statut d'une tâche de génération |
|
|
10
|
+
| [**signer_pdf_api_v1_traitement_signer_pdf_post**](TraitementFactureApi.md#signer_pdf_api_v1_traitement_signer_pdf_post) | **POST** /api/v1/traitement/signer-pdf | Signer un PDF avec le certificat du client (PAdES-B-LT) |
|
|
11
|
+
| [**signer_pdf_async_api_v1_traitement_signer_pdf_async_post**](TraitementFactureApi.md#signer_pdf_async_api_v1_traitement_signer_pdf_async_post) | **POST** /api/v1/traitement/signer-pdf-async | Signer un PDF de manière asynchrone (Celery) |
|
|
12
|
+
| [**soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post**](TraitementFactureApi.md#soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post) | **POST** /api/v1/traitement/factures/soumettre-complete | Soumettre une facture complète (génération + signature + soumission) |
|
|
13
|
+
| [**soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post**](TraitementFactureApi.md#soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post) | **POST** /api/v1/traitement/factures/soumettre-complete-async | Soumettre une facture complète (asynchrone avec Celery) |
|
|
14
|
+
| [**valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post**](TraitementFactureApi.md#valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post) | **POST** /api/v1/traitement/valider-pdf-facturx | Valider un PDF Factur-X complet |
|
|
15
|
+
| [**valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post**](TraitementFactureApi.md#valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post) | **POST** /api/v1/traitement/valider-facturx-async | Valider un PDF Factur-X (asynchrone avec polling) |
|
|
16
|
+
| [**valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post**](TraitementFactureApi.md#valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post) | **POST** /api/v1/traitement/valider-signature-pdf | Valider les signatures électroniques d'un PDF |
|
|
17
|
+
| [**valider_xml_api_v1_traitement_valider_xml_post**](TraitementFactureApi.md#valider_xml_api_v1_traitement_valider_xml_post) | **POST** /api/v1/traitement/valider-xml | Valider un XML Factur-X existant |
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## generer_certificat_test_api_v1_traitement_generer_certificat_test_post
|
|
21
|
+
|
|
22
|
+
> <GenerateCertificateResponse> generer_certificat_test_api_v1_traitement_generer_certificat_test_post(generate_certificate_request)
|
|
23
|
+
|
|
24
|
+
Générer un certificat X.509 auto-signé de test
|
|
25
|
+
|
|
26
|
+
Génère un certificat X.509 auto-signé pour les tests de signature électronique PDF. **⚠️ ATTENTION : Certificat de TEST uniquement !** Ce certificat est : - ✅ Adapté pour tests et développement - ✅ Compatible signature PDF (PAdES) - ✅ Conforme eIDAS niveau **SES** (Simple Electronic Signature) - ❌ **JAMAIS utilisable en production** - ❌ **Non reconnu** par les navigateurs et lecteurs PDF - ❌ **Aucune valeur juridique** ## Niveaux eIDAS - **SES** (Simple) : Certificat auto-signé ← Généré par cet endpoint - **AdES** (Advanced) : Certificat CA commerciale (Let's Encrypt, etc.) - **QES** (Qualified) : Certificat qualifié PSCO (CertEurope, Universign, etc.) ## Utilisation Une fois généré, le certificat peut être : 1. **Enregistré dans Django** (recommandé) : - Django Admin > Certificats de signature - Upload `certificat_pem` et `cle_privee_pem` 2. **Utilisé directement** : - Signer un PDF avec `/signer-pdf` - Le certificat sera automatiquement utilisé ## Exemple d'appel ```bash curl -X POST \"https://www.factpulse.fr/api/facturation/generer-certificat-test\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organisation\": \"Client XYZ SARL\", \"email\": \"contact@xyz.fr\", \"duree_jours\": 365 }' ``` ## Cas d'usage - Tests de signature PDF en développement - POC de signature électronique - Formation et démos - Tests d'intégration automatisés ## Conformité technique Certificat généré avec : - Clé RSA 2048 ou 4096 bits - Algorithme SHA-256 - Extensions Key Usage : `digitalSignature`, `contentCommitment` (non-repudiation) - Extensions Extended Key Usage : `codeSigning`, `emailProtection` - Validité : 1 jour à 10 ans (configurable) - Format : PEM (certificat et clé) - Optionnel : PKCS#12 (.p12)
|
|
27
|
+
|
|
28
|
+
### Examples
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
require 'time'
|
|
32
|
+
require 'factpulse'
|
|
33
|
+
# setup authorization
|
|
34
|
+
FactPulse.configure do |config|
|
|
35
|
+
# Configure Bearer authorization: HTTPBearer
|
|
36
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
40
|
+
generate_certificate_request = FactPulse::GenerateCertificateRequest.new # GenerateCertificateRequest |
|
|
41
|
+
|
|
42
|
+
begin
|
|
43
|
+
# Générer un certificat X.509 auto-signé de test
|
|
44
|
+
result = api_instance.generer_certificat_test_api_v1_traitement_generer_certificat_test_post(generate_certificate_request)
|
|
45
|
+
p result
|
|
46
|
+
rescue FactPulse::ApiError => e
|
|
47
|
+
puts "Error when calling TraitementFactureApi->generer_certificat_test_api_v1_traitement_generer_certificat_test_post: #{e}"
|
|
48
|
+
end
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Using the generer_certificat_test_api_v1_traitement_generer_certificat_test_post_with_http_info variant
|
|
52
|
+
|
|
53
|
+
This returns an Array which contains the response data, status code and headers.
|
|
54
|
+
|
|
55
|
+
> <Array(<GenerateCertificateResponse>, Integer, Hash)> generer_certificat_test_api_v1_traitement_generer_certificat_test_post_with_http_info(generate_certificate_request)
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
begin
|
|
59
|
+
# Générer un certificat X.509 auto-signé de test
|
|
60
|
+
data, status_code, headers = api_instance.generer_certificat_test_api_v1_traitement_generer_certificat_test_post_with_http_info(generate_certificate_request)
|
|
61
|
+
p status_code # => 2xx
|
|
62
|
+
p headers # => { ... }
|
|
63
|
+
p data # => <GenerateCertificateResponse>
|
|
64
|
+
rescue FactPulse::ApiError => e
|
|
65
|
+
puts "Error when calling TraitementFactureApi->generer_certificat_test_api_v1_traitement_generer_certificat_test_post_with_http_info: #{e}"
|
|
66
|
+
end
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Parameters
|
|
70
|
+
|
|
71
|
+
| Name | Type | Description | Notes |
|
|
72
|
+
| ---- | ---- | ----------- | ----- |
|
|
73
|
+
| **generate_certificate_request** | [**GenerateCertificateRequest**](GenerateCertificateRequest.md) | | |
|
|
74
|
+
|
|
75
|
+
### Return type
|
|
76
|
+
|
|
77
|
+
[**GenerateCertificateResponse**](GenerateCertificateResponse.md)
|
|
78
|
+
|
|
79
|
+
### Authorization
|
|
80
|
+
|
|
81
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
82
|
+
|
|
83
|
+
### HTTP request headers
|
|
84
|
+
|
|
85
|
+
- **Content-Type**: application/json
|
|
86
|
+
- **Accept**: application/json
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## generer_facture_api_v1_traitement_generer_facture_post
|
|
90
|
+
|
|
91
|
+
> <ReponseTache> generer_facture_api_v1_traitement_generer_facture_post(donnees_facture, opts)
|
|
92
|
+
|
|
93
|
+
Générer une facture Factur-X
|
|
94
|
+
|
|
95
|
+
Génère une facture électronique au format Factur-X conforme aux normes européennes. ## Normes appliquées - **Factur-X** (France) : Norme FNFE-MPE (Forum National de la Facture Électronique) - **ZUGFeRD** (Allemagne) : Format allemand compatible Factur-X - **EN 16931** : Norme sémantique européenne pour la facturation électronique - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Cross Industry Invoice (CII)** : Syntaxe XML UN/CEFACT ## 🆕 Nouveau : Format simplifié avec auto-enrichissement (P0.1) Vous pouvez désormais créer une facture en fournissant uniquement : - Un numéro de facture - Un SIRET émetteur + **IBAN** (obligatoire) - Un SIRET destinataire - Les lignes de facture (description, quantité, prix HT) **Exemple format simplifié** : ```json { \"numero\": \"FACT-2025-001\", \"emetteur\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"destinataire\": {\"siret\": \"35600000000048\"}, \"lignes\": [ {\"description\": \"Prestation\", \"quantite\": 10, \"prix_ht\": 100.00, \"tva\": 20.0} ] } ``` **⚠️ Champs obligatoires (format simplifié)** : - `numero` : Numéro de facture unique - `emetteur.siret` : SIRET de l'émetteur (14 chiffres) - `emetteur.iban` : IBAN du compte bancaire (pas d'API publique pour le récupérer) - `destinataire.siret` : SIRET du destinataire - `lignes[]` : Au moins une ligne de facture **Ce qui se passe automatiquement avec `auto_enrichir=True`** : - ✅ Enrichissement des noms depuis API Chorus Pro - ✅ Enrichissement des adresses depuis API Recherche Entreprises (gratuite, publique) - ✅ Calcul automatique de la TVA intracommunautaire (FR + clé + SIREN) - ✅ Récupération de l'ID Chorus Pro pour la facturation électronique - ✅ Calcul des totaux HT/TVA/TTC - ✅ Génération des dates (aujourd'hui + échéance 30j) - ✅ Gestion multi-taux de TVA **Identifiants supportés** : - SIRET (14 chiffres) : Établissement précis ⭐ Recommandé - SIREN (9 chiffres) : Entreprise (sélection auto du siège) - Types spéciaux : UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Contrôles effectués lors de la génération ### 1. Validation des données (Pydantic) - Types de données (montants en Decimal, dates ISO 8601) - Formats (SIRET 14 chiffres, SIREN 9 chiffres, IBAN) - Champs obligatoires selon le profil - Cohérence des montants (HT + TVA = TTC) ### 2. Génération XML conforme CII - Sérialisation selon schéma XSD Cross Industry Invoice - Namespaces UN/CEFACT corrects - Structure hiérarchique respectée - Encodage UTF-8 sans BOM ### 3. Validation Schematron - Règles métier du profil sélectionné (MINIMUM, BASIC, EN16931, EXTENDED) - Cardinalité des éléments (obligatoire, optionnel, répétable) - Règles de calcul (totaux, TVA, remises) - Conformité européenne EN 16931 ### 4. Conversion PDF/A-3 (si format_sortie='pdf') - Conversion du PDF source en PDF/A-3 via Ghostscript - Embarquement du XML Factur-X dans le PDF - Métadonnées XMP conformes - Profil ICC sRGB pour les couleurs - Suppression des éléments interdits (JavaScript, formulaires) ## Fonctionnement 1. **Soumission** : La facture est mise en file d'attente Celery pour traitement asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202 Accepted) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Formats de sortie - **xml** : Génère uniquement le XML Factur-X (recommandé pour les tests) - **pdf** : Génère un PDF/A-3 avec XML embarqué (nécessite `source_pdf`) ## Profils Factur-X - **MINIMUM** : Données minimales (facture simplifiée) - **BASIC** : Informations de base (PME) - **EN16931** : Standard européen (recommandé, conforme directive 2014/55/UE) - **EXTENDED** : Toutes les données disponibles (grands comptes) ## Ce que vous obtenez Après traitement réussi (statut `completed`) : - **XML seul** : Fichier XML encodé base64 conforme Factur-X - **PDF/A-3** : PDF avec XML embarqué, prêt pour envoi/archivage - **Métadonnées** : Profil, version Factur-X, taille fichier - **Validation** : Confirmation de conformité Schematron ## Validation Les données sont validées automatiquement selon le format détecté. En cas d'erreur, un statut 422 est retourné avec les détails des champs invalides.
|
|
96
|
+
|
|
97
|
+
### Examples
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
require 'time'
|
|
101
|
+
require 'factpulse'
|
|
102
|
+
# setup authorization
|
|
103
|
+
FactPulse.configure do |config|
|
|
104
|
+
# Configure Bearer authorization: HTTPBearer
|
|
105
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
109
|
+
donnees_facture = 'donnees_facture_example' # String | Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement !
|
|
110
|
+
opts = {
|
|
111
|
+
profil: FactPulse::ProfilAPI::MINIMUM, # ProfilAPI | Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED.
|
|
112
|
+
format_sortie: FactPulse::FormatSortie::XML, # FormatSortie | Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué).
|
|
113
|
+
auto_enrichir: true, # Boolean | 🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement)
|
|
114
|
+
source_pdf: File.new('/path/to/some/file') # File |
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
begin
|
|
118
|
+
# Générer une facture Factur-X
|
|
119
|
+
result = api_instance.generer_facture_api_v1_traitement_generer_facture_post(donnees_facture, opts)
|
|
120
|
+
p result
|
|
121
|
+
rescue FactPulse::ApiError => e
|
|
122
|
+
puts "Error when calling TraitementFactureApi->generer_facture_api_v1_traitement_generer_facture_post: #{e}"
|
|
123
|
+
end
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Using the generer_facture_api_v1_traitement_generer_facture_post_with_http_info variant
|
|
127
|
+
|
|
128
|
+
This returns an Array which contains the response data, status code and headers.
|
|
129
|
+
|
|
130
|
+
> <Array(<ReponseTache>, Integer, Hash)> generer_facture_api_v1_traitement_generer_facture_post_with_http_info(donnees_facture, opts)
|
|
131
|
+
|
|
132
|
+
```ruby
|
|
133
|
+
begin
|
|
134
|
+
# Générer une facture Factur-X
|
|
135
|
+
data, status_code, headers = api_instance.generer_facture_api_v1_traitement_generer_facture_post_with_http_info(donnees_facture, opts)
|
|
136
|
+
p status_code # => 2xx
|
|
137
|
+
p headers # => { ... }
|
|
138
|
+
p data # => <ReponseTache>
|
|
139
|
+
rescue FactPulse::ApiError => e
|
|
140
|
+
puts "Error when calling TraitementFactureApi->generer_facture_api_v1_traitement_generer_facture_post_with_http_info: #{e}"
|
|
141
|
+
end
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Parameters
|
|
145
|
+
|
|
146
|
+
| Name | Type | Description | Notes |
|
|
147
|
+
| ---- | ---- | ----------- | ----- |
|
|
148
|
+
| **donnees_facture** | **String** | Données de la facture au format JSON. Deux formats acceptés : 1. **Format classique** : Structure complète FactureFacturX (tous les champs) 2. **Format simplifié** (🆕 P0.1) : Structure minimale avec auto-enrichissement Le format est détecté automatiquement ! | |
|
|
149
|
+
| **profil** | [**ProfilAPI**](ProfilAPI.md) | Profil Factur-X : MINIMUM, BASIC, EN16931 ou EXTENDED. | [optional] |
|
|
150
|
+
| **format_sortie** | [**FormatSortie**](FormatSortie.md) | Format de sortie : 'xml' (XML seul) ou 'pdf' (PDF Factur-X avec XML embarqué). | [optional] |
|
|
151
|
+
| **auto_enrichir** | **Boolean** | 🆕 Activer l'auto-enrichissement depuis SIRET/SIREN (format simplifié uniquement) | [optional][default to true] |
|
|
152
|
+
| **source_pdf** | **File** | | [optional] |
|
|
153
|
+
|
|
154
|
+
### Return type
|
|
155
|
+
|
|
156
|
+
[**ReponseTache**](ReponseTache.md)
|
|
157
|
+
|
|
158
|
+
### Authorization
|
|
159
|
+
|
|
160
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
161
|
+
|
|
162
|
+
### HTTP request headers
|
|
163
|
+
|
|
164
|
+
- **Content-Type**: multipart/form-data
|
|
165
|
+
- **Accept**: application/json
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
## obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get
|
|
169
|
+
|
|
170
|
+
> <StatutTache> obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get(id_tache)
|
|
171
|
+
|
|
172
|
+
Obtenir le statut d'une tâche de génération
|
|
173
|
+
|
|
174
|
+
Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles - **PENDING** : Tâche en attente de traitement - **STARTED** : Tâche en cours d'exécution - **SUCCESS** : Tâche terminée (vérifier `resultat.statut` pour le résultat réel) - **FAILURE** : Erreur système lors de l'exécution - **RETRY** : Tentative de ré-exécution en cours ## Champ resultat Quand la tâche est terminée (SUCCESS), le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" - `chemin_fichier` : Chemin du fichier généré (si succès) - `message_erreur` : Détails de l'erreur (si échec) ## Usage Appelez cet endpoint en boucle (polling) toutes les 2-3 secondes jusqu'à ce que le statut soit SUCCESS ou FAILURE.
|
|
175
|
+
|
|
176
|
+
### Examples
|
|
177
|
+
|
|
178
|
+
```ruby
|
|
179
|
+
require 'time'
|
|
180
|
+
require 'factpulse'
|
|
181
|
+
# setup authorization
|
|
182
|
+
FactPulse.configure do |config|
|
|
183
|
+
# Configure Bearer authorization: HTTPBearer
|
|
184
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
188
|
+
id_tache = 'id_tache_example' # String |
|
|
189
|
+
|
|
190
|
+
begin
|
|
191
|
+
# Obtenir le statut d'une tâche de génération
|
|
192
|
+
result = api_instance.obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get(id_tache)
|
|
193
|
+
p result
|
|
194
|
+
rescue FactPulse::ApiError => e
|
|
195
|
+
puts "Error when calling TraitementFactureApi->obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get: #{e}"
|
|
196
|
+
end
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### Using the obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_with_http_info variant
|
|
200
|
+
|
|
201
|
+
This returns an Array which contains the response data, status code and headers.
|
|
202
|
+
|
|
203
|
+
> <Array(<StatutTache>, Integer, Hash)> obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_with_http_info(id_tache)
|
|
204
|
+
|
|
205
|
+
```ruby
|
|
206
|
+
begin
|
|
207
|
+
# Obtenir le statut d'une tâche de génération
|
|
208
|
+
data, status_code, headers = api_instance.obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_with_http_info(id_tache)
|
|
209
|
+
p status_code # => 2xx
|
|
210
|
+
p headers # => { ... }
|
|
211
|
+
p data # => <StatutTache>
|
|
212
|
+
rescue FactPulse::ApiError => e
|
|
213
|
+
puts "Error when calling TraitementFactureApi->obtenir_statut_tache_api_v1_traitement_taches_id_tache_statut_get_with_http_info: #{e}"
|
|
214
|
+
end
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Parameters
|
|
218
|
+
|
|
219
|
+
| Name | Type | Description | Notes |
|
|
220
|
+
| ---- | ---- | ----------- | ----- |
|
|
221
|
+
| **id_tache** | **String** | | |
|
|
222
|
+
|
|
223
|
+
### Return type
|
|
224
|
+
|
|
225
|
+
[**StatutTache**](StatutTache.md)
|
|
226
|
+
|
|
227
|
+
### Authorization
|
|
228
|
+
|
|
229
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
230
|
+
|
|
231
|
+
### HTTP request headers
|
|
232
|
+
|
|
233
|
+
- **Content-Type**: Not defined
|
|
234
|
+
- **Accept**: application/json
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
## signer_pdf_api_v1_traitement_signer_pdf_post
|
|
238
|
+
|
|
239
|
+
> Object signer_pdf_api_v1_traitement_signer_pdf_post(fichier_pdf, opts)
|
|
240
|
+
|
|
241
|
+
Signer un PDF avec le certificat du client (PAdES-B-LT)
|
|
242
|
+
|
|
243
|
+
Signe un PDF uploadé avec le certificat électronique configuré pour le client (via client_uid du JWT). **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO - hors scope). **⚠️ Disclaimer légal** : Les signatures générées sont des cachets électroniques au sens du règlement eIDAS. Le niveau de validité juridique dépend du certificat utilisé (SES/AdES/QES). FactPulse ne fournit pas de certificats qualifiés QES - vous devez obtenir un certificat auprès d'un PSCO (Prestataire de Services de Confiance qualifié) pour une validité juridique maximale.
|
|
244
|
+
|
|
245
|
+
### Examples
|
|
246
|
+
|
|
247
|
+
```ruby
|
|
248
|
+
require 'time'
|
|
249
|
+
require 'factpulse'
|
|
250
|
+
# setup authorization
|
|
251
|
+
FactPulse.configure do |config|
|
|
252
|
+
# Configure Bearer authorization: HTTPBearer
|
|
253
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
257
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF à signer (sera traité puis retourné signé en base64)
|
|
258
|
+
opts = {
|
|
259
|
+
raison: 'raison_example', # String |
|
|
260
|
+
localisation: 'localisation_example', # String |
|
|
261
|
+
contact: 'contact_example', # String |
|
|
262
|
+
field_name: 'field_name_example', # String | Nom du champ de signature PDF
|
|
263
|
+
use_pades_lt: true, # Boolean | Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
|
|
264
|
+
use_timestamp: true # Boolean | Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
begin
|
|
268
|
+
# Signer un PDF avec le certificat du client (PAdES-B-LT)
|
|
269
|
+
result = api_instance.signer_pdf_api_v1_traitement_signer_pdf_post(fichier_pdf, opts)
|
|
270
|
+
p result
|
|
271
|
+
rescue FactPulse::ApiError => e
|
|
272
|
+
puts "Error when calling TraitementFactureApi->signer_pdf_api_v1_traitement_signer_pdf_post: #{e}"
|
|
273
|
+
end
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
#### Using the signer_pdf_api_v1_traitement_signer_pdf_post_with_http_info variant
|
|
277
|
+
|
|
278
|
+
This returns an Array which contains the response data, status code and headers.
|
|
279
|
+
|
|
280
|
+
> <Array(Object, Integer, Hash)> signer_pdf_api_v1_traitement_signer_pdf_post_with_http_info(fichier_pdf, opts)
|
|
281
|
+
|
|
282
|
+
```ruby
|
|
283
|
+
begin
|
|
284
|
+
# Signer un PDF avec le certificat du client (PAdES-B-LT)
|
|
285
|
+
data, status_code, headers = api_instance.signer_pdf_api_v1_traitement_signer_pdf_post_with_http_info(fichier_pdf, opts)
|
|
286
|
+
p status_code # => 2xx
|
|
287
|
+
p headers # => { ... }
|
|
288
|
+
p data # => Object
|
|
289
|
+
rescue FactPulse::ApiError => e
|
|
290
|
+
puts "Error when calling TraitementFactureApi->signer_pdf_api_v1_traitement_signer_pdf_post_with_http_info: #{e}"
|
|
291
|
+
end
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Parameters
|
|
295
|
+
|
|
296
|
+
| Name | Type | Description | Notes |
|
|
297
|
+
| ---- | ---- | ----------- | ----- |
|
|
298
|
+
| **fichier_pdf** | **File** | Fichier PDF à signer (sera traité puis retourné signé en base64) | |
|
|
299
|
+
| **raison** | **String** | | [optional] |
|
|
300
|
+
| **localisation** | **String** | | [optional] |
|
|
301
|
+
| **contact** | **String** | | [optional] |
|
|
302
|
+
| **field_name** | **String** | Nom du champ de signature PDF | [optional][default to 'FactPulseSignature'] |
|
|
303
|
+
| **use_pades_lt** | **Boolean** | Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL. | [optional][default to false] |
|
|
304
|
+
| **use_timestamp** | **Boolean** | Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T) | [optional][default to true] |
|
|
305
|
+
|
|
306
|
+
### Return type
|
|
307
|
+
|
|
308
|
+
**Object**
|
|
309
|
+
|
|
310
|
+
### Authorization
|
|
311
|
+
|
|
312
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
313
|
+
|
|
314
|
+
### HTTP request headers
|
|
315
|
+
|
|
316
|
+
- **Content-Type**: multipart/form-data
|
|
317
|
+
- **Accept**: application/json
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
## signer_pdf_async_api_v1_traitement_signer_pdf_async_post
|
|
321
|
+
|
|
322
|
+
> Object signer_pdf_async_api_v1_traitement_signer_pdf_async_post(fichier_pdf, opts)
|
|
323
|
+
|
|
324
|
+
Signer un PDF de manière asynchrone (Celery)
|
|
325
|
+
|
|
326
|
+
Signe un PDF uploadé de manière asynchrone via une tâche Celery. **Différence avec /signer-pdf** : - `/signer-pdf` : Signature synchrone (blocage jusqu'à la fin) - `/signer-pdf-async` : Signature asynchrone (retourne immédiatement un task_id) **Avantages de l'async** : - Pas de timeout pour les gros fichiers - Pas de blocage du worker FastAPI - Possibilité de suivre la progression via le task_id - Idéal pour les traitements par lot **Standards supportés** : PAdES-B-B, PAdES-B-T (horodatage), PAdES-B-LT (archivage long terme). **⚠️ Disclaimer légal** : Identique à /signer-pdf (voir documentation de cet endpoint).
|
|
327
|
+
|
|
328
|
+
### Examples
|
|
329
|
+
|
|
330
|
+
```ruby
|
|
331
|
+
require 'time'
|
|
332
|
+
require 'factpulse'
|
|
333
|
+
# setup authorization
|
|
334
|
+
FactPulse.configure do |config|
|
|
335
|
+
# Configure Bearer authorization: HTTPBearer
|
|
336
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
340
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF à signer (traité de manière asynchrone)
|
|
341
|
+
opts = {
|
|
342
|
+
raison: 'raison_example', # String |
|
|
343
|
+
localisation: 'localisation_example', # String |
|
|
344
|
+
contact: 'contact_example', # String |
|
|
345
|
+
field_name: 'field_name_example', # String | Nom du champ de signature PDF
|
|
346
|
+
use_pades_lt: true, # Boolean | Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL.
|
|
347
|
+
use_timestamp: true # Boolean | Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
begin
|
|
351
|
+
# Signer un PDF de manière asynchrone (Celery)
|
|
352
|
+
result = api_instance.signer_pdf_async_api_v1_traitement_signer_pdf_async_post(fichier_pdf, opts)
|
|
353
|
+
p result
|
|
354
|
+
rescue FactPulse::ApiError => e
|
|
355
|
+
puts "Error when calling TraitementFactureApi->signer_pdf_async_api_v1_traitement_signer_pdf_async_post: #{e}"
|
|
356
|
+
end
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### Using the signer_pdf_async_api_v1_traitement_signer_pdf_async_post_with_http_info variant
|
|
360
|
+
|
|
361
|
+
This returns an Array which contains the response data, status code and headers.
|
|
362
|
+
|
|
363
|
+
> <Array(Object, Integer, Hash)> signer_pdf_async_api_v1_traitement_signer_pdf_async_post_with_http_info(fichier_pdf, opts)
|
|
364
|
+
|
|
365
|
+
```ruby
|
|
366
|
+
begin
|
|
367
|
+
# Signer un PDF de manière asynchrone (Celery)
|
|
368
|
+
data, status_code, headers = api_instance.signer_pdf_async_api_v1_traitement_signer_pdf_async_post_with_http_info(fichier_pdf, opts)
|
|
369
|
+
p status_code # => 2xx
|
|
370
|
+
p headers # => { ... }
|
|
371
|
+
p data # => Object
|
|
372
|
+
rescue FactPulse::ApiError => e
|
|
373
|
+
puts "Error when calling TraitementFactureApi->signer_pdf_async_api_v1_traitement_signer_pdf_async_post_with_http_info: #{e}"
|
|
374
|
+
end
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Parameters
|
|
378
|
+
|
|
379
|
+
| Name | Type | Description | Notes |
|
|
380
|
+
| ---- | ---- | ----------- | ----- |
|
|
381
|
+
| **fichier_pdf** | **File** | Fichier PDF à signer (traité de manière asynchrone) | |
|
|
382
|
+
| **raison** | **String** | | [optional] |
|
|
383
|
+
| **localisation** | **String** | | [optional] |
|
|
384
|
+
| **contact** | **String** | | [optional] |
|
|
385
|
+
| **field_name** | **String** | Nom du champ de signature PDF | [optional][default to 'FactPulseSignature'] |
|
|
386
|
+
| **use_pades_lt** | **Boolean** | Activer PAdES-B-LT (archivage long terme avec données de validation embarquées). NÉCESSITE un certificat avec accès OCSP/CRL. | [optional][default to false] |
|
|
387
|
+
| **use_timestamp** | **Boolean** | Activer l'horodatage RFC 3161 avec FreeTSA (PAdES-B-T) | [optional][default to true] |
|
|
388
|
+
|
|
389
|
+
### Return type
|
|
390
|
+
|
|
391
|
+
**Object**
|
|
392
|
+
|
|
393
|
+
### Authorization
|
|
394
|
+
|
|
395
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
396
|
+
|
|
397
|
+
### HTTP request headers
|
|
398
|
+
|
|
399
|
+
- **Content-Type**: multipart/form-data
|
|
400
|
+
- **Accept**: application/json
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
## soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post
|
|
404
|
+
|
|
405
|
+
> <SoumettreFactureCompleteResponse> soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post(soumettre_facture_complete_request)
|
|
406
|
+
|
|
407
|
+
Soumettre une facture complète (génération + signature + soumission)
|
|
408
|
+
|
|
409
|
+
Endpoint unifié pour soumettre une facture complète vers différentes destinations. **Workflow automatisé :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Credentials de destination - 2 modes disponibles :** **Mode 1 - Récupération via JWT (recommandé) :** - Les credentials sont récupérés automatiquement via le `client_uid` du JWT - Ne pas fournir le champ `credentials` dans `destination` - Architecture 0-trust : aucun secret dans le payload - Exemple : `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials dans le payload :** - Fournir les credentials directement dans le payload - Utile pour tests ou intégrations tierces - Exemple : `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Signature électronique (optionnelle) - 2 modes disponibles :** **Mode 1 - Certificat stocké (recommandé) :** - Le certificat est récupéré automatiquement via le `client_uid` du JWT - Aucune clé à fournir dans le payload - Signature PAdES-B-LT avec horodatage (conforme eIDAS) - Exemple : `\"signature\": {\"raison\": \"Conformité Factur-X\"}` **Mode 2 - Clés dans le payload (pour tests) :** - Fournir `key_pem` et `cert_pem` directement - Format PEM accepté : brut ou base64 - Utile pour tests ou cas spéciaux sans certificat stocké - Exemple : `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` Si `key_pem` et `cert_pem` sont fournis → Mode 2 Sinon → Mode 1 (certificat récupéré via `client_uid`)
|
|
410
|
+
|
|
411
|
+
### Examples
|
|
412
|
+
|
|
413
|
+
```ruby
|
|
414
|
+
require 'time'
|
|
415
|
+
require 'factpulse'
|
|
416
|
+
# setup authorization
|
|
417
|
+
FactPulse.configure do |config|
|
|
418
|
+
# Configure Bearer authorization: HTTPBearer
|
|
419
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
423
|
+
soumettre_facture_complete_request = FactPulse::SoumettreFactureCompleteRequest.new({donnees_facture: FactPulse::DonneesFactureSimplifiees.new({numero: 'numero_example', emetteur: { key: 3.56}, destinataire: { key: 3.56}, lignes: [{ key: 3.56}]}), pdf_source: 'pdf_source_example', destination: FactPulse::DestinationAFNOR.new}) # SoumettreFactureCompleteRequest |
|
|
424
|
+
|
|
425
|
+
begin
|
|
426
|
+
# Soumettre une facture complète (génération + signature + soumission)
|
|
427
|
+
result = api_instance.soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post(soumettre_facture_complete_request)
|
|
428
|
+
p result
|
|
429
|
+
rescue FactPulse::ApiError => e
|
|
430
|
+
puts "Error when calling TraitementFactureApi->soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post: #{e}"
|
|
431
|
+
end
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
#### Using the soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_with_http_info variant
|
|
435
|
+
|
|
436
|
+
This returns an Array which contains the response data, status code and headers.
|
|
437
|
+
|
|
438
|
+
> <Array(<SoumettreFactureCompleteResponse>, Integer, Hash)> soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_with_http_info(soumettre_facture_complete_request)
|
|
439
|
+
|
|
440
|
+
```ruby
|
|
441
|
+
begin
|
|
442
|
+
# Soumettre une facture complète (génération + signature + soumission)
|
|
443
|
+
data, status_code, headers = api_instance.soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_with_http_info(soumettre_facture_complete_request)
|
|
444
|
+
p status_code # => 2xx
|
|
445
|
+
p headers # => { ... }
|
|
446
|
+
p data # => <SoumettreFactureCompleteResponse>
|
|
447
|
+
rescue FactPulse::ApiError => e
|
|
448
|
+
puts "Error when calling TraitementFactureApi->soumettre_facture_complete_api_v1_traitement_factures_soumettre_complete_post_with_http_info: #{e}"
|
|
449
|
+
end
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Parameters
|
|
453
|
+
|
|
454
|
+
| Name | Type | Description | Notes |
|
|
455
|
+
| ---- | ---- | ----------- | ----- |
|
|
456
|
+
| **soumettre_facture_complete_request** | [**SoumettreFactureCompleteRequest**](SoumettreFactureCompleteRequest.md) | | |
|
|
457
|
+
|
|
458
|
+
### Return type
|
|
459
|
+
|
|
460
|
+
[**SoumettreFactureCompleteResponse**](SoumettreFactureCompleteResponse.md)
|
|
461
|
+
|
|
462
|
+
### Authorization
|
|
463
|
+
|
|
464
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
465
|
+
|
|
466
|
+
### HTTP request headers
|
|
467
|
+
|
|
468
|
+
- **Content-Type**: application/json
|
|
469
|
+
- **Accept**: application/json
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
## soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post
|
|
473
|
+
|
|
474
|
+
> <ReponseTache> soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post(soumettre_facture_complete_request)
|
|
475
|
+
|
|
476
|
+
Soumettre une facture complète (asynchrone avec Celery)
|
|
477
|
+
|
|
478
|
+
Version asynchrone de l'endpoint `/factures/soumettre-complete` utilisant Celery pour le traitement en arrière-plan. **Workflow automatisé (identique à la version synchrone) :** 1. **Auto-enrichissement** (optionnel) : récupère les données via APIs publiques et Chorus Pro/AFNOR 2. **Génération PDF Factur-X** : crée un PDF/A-3 avec XML embarqué 3. **Signature électronique** (optionnelle) : signe le PDF avec un certificat 4. **Soumission** : envoie vers la destination choisie (Chorus Pro ou AFNOR PDP) **Destinations supportées :** - **Chorus Pro** : plateforme B2G française (factures vers secteur public) - **AFNOR PDP** : Plateformes de Dématérialisation Partenaires **Différences avec la version synchrone :** - ✅ **Non-bloquant** : Retourne immédiatement un `id_tache` (HTTP 202 Accepted) - ✅ **Traitement en arrière-plan** : La facture est traitée par un worker Celery - ✅ **Suivi d'avancement** : Utilisez `/taches/{id_tache}/statut` pour suivre le statut - ✅ **Idéal pour gros volumes** : Permet de traiter de nombreuses factures en parallèle **Comment utiliser :** 1. **Soumission** : Appelez cet endpoint avec vos données de facture 2. **Retour immédiat** : Vous recevez un `id_tache` (ex: \"abc123-def456\") 3. **Suivi** : Appelez `/taches/{id_tache}/statut` pour vérifier l'avancement 4. **Résultat** : Quand `statut = \"SUCCESS\"`, le champ `resultat` contient la réponse complète **Credentials et signature** : Mêmes modes que la version synchrone (JWT ou payload).
|
|
479
|
+
|
|
480
|
+
### Examples
|
|
481
|
+
|
|
482
|
+
```ruby
|
|
483
|
+
require 'time'
|
|
484
|
+
require 'factpulse'
|
|
485
|
+
# setup authorization
|
|
486
|
+
FactPulse.configure do |config|
|
|
487
|
+
# Configure Bearer authorization: HTTPBearer
|
|
488
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
492
|
+
soumettre_facture_complete_request = FactPulse::SoumettreFactureCompleteRequest.new({donnees_facture: FactPulse::DonneesFactureSimplifiees.new({numero: 'numero_example', emetteur: { key: 3.56}, destinataire: { key: 3.56}, lignes: [{ key: 3.56}]}), pdf_source: 'pdf_source_example', destination: FactPulse::DestinationAFNOR.new}) # SoumettreFactureCompleteRequest |
|
|
493
|
+
|
|
494
|
+
begin
|
|
495
|
+
# Soumettre une facture complète (asynchrone avec Celery)
|
|
496
|
+
result = api_instance.soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post(soumettre_facture_complete_request)
|
|
497
|
+
p result
|
|
498
|
+
rescue FactPulse::ApiError => e
|
|
499
|
+
puts "Error when calling TraitementFactureApi->soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post: #{e}"
|
|
500
|
+
end
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### Using the soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_with_http_info variant
|
|
504
|
+
|
|
505
|
+
This returns an Array which contains the response data, status code and headers.
|
|
506
|
+
|
|
507
|
+
> <Array(<ReponseTache>, Integer, Hash)> soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_with_http_info(soumettre_facture_complete_request)
|
|
508
|
+
|
|
509
|
+
```ruby
|
|
510
|
+
begin
|
|
511
|
+
# Soumettre une facture complète (asynchrone avec Celery)
|
|
512
|
+
data, status_code, headers = api_instance.soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_with_http_info(soumettre_facture_complete_request)
|
|
513
|
+
p status_code # => 2xx
|
|
514
|
+
p headers # => { ... }
|
|
515
|
+
p data # => <ReponseTache>
|
|
516
|
+
rescue FactPulse::ApiError => e
|
|
517
|
+
puts "Error when calling TraitementFactureApi->soumettre_facture_complete_async_api_v1_traitement_factures_soumettre_complete_async_post_with_http_info: #{e}"
|
|
518
|
+
end
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Parameters
|
|
522
|
+
|
|
523
|
+
| Name | Type | Description | Notes |
|
|
524
|
+
| ---- | ---- | ----------- | ----- |
|
|
525
|
+
| **soumettre_facture_complete_request** | [**SoumettreFactureCompleteRequest**](SoumettreFactureCompleteRequest.md) | | |
|
|
526
|
+
|
|
527
|
+
### Return type
|
|
528
|
+
|
|
529
|
+
[**ReponseTache**](ReponseTache.md)
|
|
530
|
+
|
|
531
|
+
### Authorization
|
|
532
|
+
|
|
533
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
534
|
+
|
|
535
|
+
### HTTP request headers
|
|
536
|
+
|
|
537
|
+
- **Content-Type**: application/json
|
|
538
|
+
- **Accept**: application/json
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
## valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post
|
|
542
|
+
|
|
543
|
+
> <ResultatValidationPDFAPI> valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post(fichier_pdf, opts)
|
|
544
|
+
|
|
545
|
+
Valider un PDF Factur-X complet
|
|
546
|
+
|
|
547
|
+
Valide un PDF Factur-X complet selon les normes européennes et françaises. ## Normes de validation appliquées - **EN 16931** : Norme sémantique européenne (directive 2014/55/UE) - **ISO 19005-3** (PDF/A-3) : Archivage électronique à long terme - **Factur-X / ZUGFeRD** : Spécification franco-allemande - **Schematron** : Validation des règles métier XML - **eIDAS** : Règlement européen sur l'identification électronique (signatures) ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X **Contrôles réalisés :** - Présence d'un fichier XML embarqué (`factur-x.xml` ou `zugferd-invoice.xml`) - Détection automatique du profil (MINIMUM, BASIC, EN16931, EXTENDED) - Parsing XML avec validation UTF-8 - Extraction du GuidelineSpecifiedDocumentContextParameter/ID **Validation Schematron :** - Règles métier du profil détecté (MINIMUM : 45 règles, EN16931 : 178 règles) - Cardinalité des éléments obligatoires - Cohérence des calculs (montants HT, TVA, TTC, remises) - Formats des identifiants (SIRET, TVA intracommunautaire, IBAN) - Codes normalisés (codes pays ISO, unités UN/ECE, codes TVA) **Ce qui est vérifié :** - ✅ Structure XML conforme XSD Cross Industry Invoice - ✅ Namespace UN/CEFACT correct - ✅ Règles de gestion européennes (BR-xx) - ✅ Règles françaises spécifiques (FR-xx) ### 2. Conformité PDF/A-3 **Validation de base (métadonnées) :** - Présence du champ `/Type` à `Catalog` - Métadonnée `pdfaid:part` = 3 (PDF/A-3) - Métadonnée `pdfaid:conformance` = B ou U - Version PDF >= 1.4 **Validation stricte VeraPDF (si use_verapdf=True) :** - 146+ règles ISO 19005-3 (PDF/A-3B) - Absence de contenu interdit (JavaScript, multimedia, formulaires dynamiques) - Polices embarquées et sous-ensembles corrects - Espaces colorimétriques conformes (sRGB, DeviceGray) - Structure de fichier valide (cross-reference table) - Métadonnées XMP conformes ISO 16684-1 **Ce qui est vérifié :** - ✅ Fichier archivable à long terme (20+ ans) - ✅ Lisibilité garantie (polices embarquées) - ✅ Conformité légale (France, Allemagne, UE) ### 3. Métadonnées XMP (eXtensible Metadata Platform) **Contrôles réalisés :** - Présence du bloc `<?xpacket>` avec métadonnées XMP - Namespace `fx:` pour Factur-X : `urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#` - Champs Factur-X obligatoires : - `fx:ConformanceLevel` : Profil (MINIMUM, BASIC, EN16931, EXTENDED) - `fx:DocumentFileName` : Nom du XML embarqué - `fx:DocumentType` : \"INVOICE\" - `fx:Version` : Version Factur-X (1.0.07) **Ce qui est vérifié :** - ✅ Métadonnées conformes ISO 16684-1 - ✅ Profil Factur-X déclaré correct - ✅ Version Factur-X supportée ### 4. Signatures électroniques **Détection et analyse :** - Présence de dictionnaires `/Sig` dans le PDF - Type de signature : PAdES (PDF Advanced Electronic Signature) - Extraction des informations : - Nom du signataire (`/Name`) - Date de signature (`/M`) - Raison de la signature (`/Reason`) - Lieu de signature (`/Location`) - Type de signature (approval, certification) **Ce qui est vérifié :** - ✅ Présence de signatures ou cachets - ✅ Nombre de signatures (mono ou multi-signature) - ℹ️ Pas de vérification cryptographique (nécessite certificats) ## Paramètres - **fichier_pdf** (requis) : Le fichier PDF Factur-X à valider - **profil** (optionnel) : Profil attendu. Si absent, détection automatique depuis le XML - **use_verapdf** (optionnel, défaut=false) : Active la validation stricte PDF/A avec VeraPDF - `false` : Validation rapide par métadonnées (2-3 secondes) - `true` : Validation complète ISO 19005-3 (15-30 secondes, **recommandé en production**) ## Réponse détaillée ```json { \"est_conforme\": true, \"xml\": { \"present\": true, \"conforme\": true, \"profil\": \"EN16931\", \"erreurs\": [] }, \"pdfa\": { \"conforme\": true, \"version\": \"PDF/A-3B\", \"methode\": \"verapdf\", \"erreurs\": [] }, \"xmp\": { \"present\": true, \"conforme\": true, \"metadonnees\": {...} }, \"signatures\": { \"present\": true, \"nombre\": 1, \"details\": [...] } } ``` ## Cas d'usage - **Avant envoi** : Valider la facture générée avant transmission à un client - **À réception** : Vérifier la conformité d'une facture reçue d'un fournisseur - **Audit** : Contrôler la qualité de lots de factures - **Conformité légale** : S'assurer du respect des obligations B2B/B2G en France - **Debugging** : Identifier les problèmes dans le processus de génération - **Archivage** : Garantir la validité à long terme (PDF/A-3) ## Temps de traitement - Validation basique : 2-3 secondes - Validation VeraPDF : 15-30 secondes (dépend de la taille du PDF)
|
|
548
|
+
|
|
549
|
+
### Examples
|
|
550
|
+
|
|
551
|
+
```ruby
|
|
552
|
+
require 'time'
|
|
553
|
+
require 'factpulse'
|
|
554
|
+
# setup authorization
|
|
555
|
+
FactPulse.configure do |config|
|
|
556
|
+
# Configure Bearer authorization: HTTPBearer
|
|
557
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
561
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF Factur-X à valider (format .pdf).
|
|
562
|
+
opts = {
|
|
563
|
+
profil: FactPulse::ProfilAPI::MINIMUM, # ProfilAPI |
|
|
564
|
+
use_verapdf: true # Boolean | Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées.
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
begin
|
|
568
|
+
# Valider un PDF Factur-X complet
|
|
569
|
+
result = api_instance.valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post(fichier_pdf, opts)
|
|
570
|
+
p result
|
|
571
|
+
rescue FactPulse::ApiError => e
|
|
572
|
+
puts "Error when calling TraitementFactureApi->valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post: #{e}"
|
|
573
|
+
end
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
#### Using the valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_with_http_info variant
|
|
577
|
+
|
|
578
|
+
This returns an Array which contains the response data, status code and headers.
|
|
579
|
+
|
|
580
|
+
> <Array(<ResultatValidationPDFAPI>, Integer, Hash)> valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_with_http_info(fichier_pdf, opts)
|
|
581
|
+
|
|
582
|
+
```ruby
|
|
583
|
+
begin
|
|
584
|
+
# Valider un PDF Factur-X complet
|
|
585
|
+
data, status_code, headers = api_instance.valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_with_http_info(fichier_pdf, opts)
|
|
586
|
+
p status_code # => 2xx
|
|
587
|
+
p headers # => { ... }
|
|
588
|
+
p data # => <ResultatValidationPDFAPI>
|
|
589
|
+
rescue FactPulse::ApiError => e
|
|
590
|
+
puts "Error when calling TraitementFactureApi->valider_pdf_facturx_api_v1_traitement_valider_pdf_facturx_post_with_http_info: #{e}"
|
|
591
|
+
end
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Parameters
|
|
595
|
+
|
|
596
|
+
| Name | Type | Description | Notes |
|
|
597
|
+
| ---- | ---- | ----------- | ----- |
|
|
598
|
+
| **fichier_pdf** | **File** | Fichier PDF Factur-X à valider (format .pdf). | |
|
|
599
|
+
| **profil** | [**ProfilAPI**](ProfilAPI.md) | | [optional] |
|
|
600
|
+
| **use_verapdf** | **Boolean** | Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Si False, utilise une validation basique par métadonnées. | [optional][default to false] |
|
|
601
|
+
|
|
602
|
+
### Return type
|
|
603
|
+
|
|
604
|
+
[**ResultatValidationPDFAPI**](ResultatValidationPDFAPI.md)
|
|
605
|
+
|
|
606
|
+
### Authorization
|
|
607
|
+
|
|
608
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
609
|
+
|
|
610
|
+
### HTTP request headers
|
|
611
|
+
|
|
612
|
+
- **Content-Type**: multipart/form-data
|
|
613
|
+
- **Accept**: application/json
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
## valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post
|
|
617
|
+
|
|
618
|
+
> <ReponseTache> valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post(fichier_pdf, opts)
|
|
619
|
+
|
|
620
|
+
Valider un PDF Factur-X (asynchrone avec polling)
|
|
621
|
+
|
|
622
|
+
Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['message_erreur']}\") break time.sleep(2) # Attendre 2 secondes avant le prochain check ``` ## Cas d'usage - Valider des factures avant envoi avec VeraPDF (validation stricte) - Traiter des lots de factures en parallèle - Intégrer la validation dans un pipeline asynchrone - Valider des PDFs volumineux sans risque de timeout
|
|
623
|
+
|
|
624
|
+
### Examples
|
|
625
|
+
|
|
626
|
+
```ruby
|
|
627
|
+
require 'time'
|
|
628
|
+
require 'factpulse'
|
|
629
|
+
# setup authorization
|
|
630
|
+
FactPulse.configure do |config|
|
|
631
|
+
# Configure Bearer authorization: HTTPBearer
|
|
632
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
636
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF Factur-X à valider (format .pdf).
|
|
637
|
+
opts = {
|
|
638
|
+
profil: FactPulse::ProfilAPI::MINIMUM, # ProfilAPI |
|
|
639
|
+
use_verapdf: true # Boolean | Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes.
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
begin
|
|
643
|
+
# Valider un PDF Factur-X (asynchrone avec polling)
|
|
644
|
+
result = api_instance.valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post(fichier_pdf, opts)
|
|
645
|
+
p result
|
|
646
|
+
rescue FactPulse::ApiError => e
|
|
647
|
+
puts "Error when calling TraitementFactureApi->valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post: #{e}"
|
|
648
|
+
end
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
#### Using the valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_with_http_info variant
|
|
652
|
+
|
|
653
|
+
This returns an Array which contains the response data, status code and headers.
|
|
654
|
+
|
|
655
|
+
> <Array(<ReponseTache>, Integer, Hash)> valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_with_http_info(fichier_pdf, opts)
|
|
656
|
+
|
|
657
|
+
```ruby
|
|
658
|
+
begin
|
|
659
|
+
# Valider un PDF Factur-X (asynchrone avec polling)
|
|
660
|
+
data, status_code, headers = api_instance.valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_with_http_info(fichier_pdf, opts)
|
|
661
|
+
p status_code # => 2xx
|
|
662
|
+
p headers # => { ... }
|
|
663
|
+
p data # => <ReponseTache>
|
|
664
|
+
rescue FactPulse::ApiError => e
|
|
665
|
+
puts "Error when calling TraitementFactureApi->valider_pdf_facturx_async_api_v1_traitement_valider_facturx_async_post_with_http_info: #{e}"
|
|
666
|
+
end
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### Parameters
|
|
670
|
+
|
|
671
|
+
| Name | Type | Description | Notes |
|
|
672
|
+
| ---- | ---- | ----------- | ----- |
|
|
673
|
+
| **fichier_pdf** | **File** | Fichier PDF Factur-X à valider (format .pdf). | |
|
|
674
|
+
| **profil** | [**ProfilAPI**](ProfilAPI.md) | | [optional] |
|
|
675
|
+
| **use_verapdf** | **Boolean** | Active la validation stricte PDF/A avec VeraPDF (recommandé pour la production). Peut prendre plusieurs secondes. | [optional][default to false] |
|
|
676
|
+
|
|
677
|
+
### Return type
|
|
678
|
+
|
|
679
|
+
[**ReponseTache**](ReponseTache.md)
|
|
680
|
+
|
|
681
|
+
### Authorization
|
|
682
|
+
|
|
683
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
684
|
+
|
|
685
|
+
### HTTP request headers
|
|
686
|
+
|
|
687
|
+
- **Content-Type**: multipart/form-data
|
|
688
|
+
- **Accept**: application/json
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
## valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post
|
|
692
|
+
|
|
693
|
+
> Object valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post(fichier_pdf)
|
|
694
|
+
|
|
695
|
+
Valider les signatures électroniques d'un PDF
|
|
696
|
+
|
|
697
|
+
Valide les signatures électroniques présentes dans un PDF uploadé. **Vérifications effectuées** : - Présence de signatures - Intégrité du document (non modifié depuis signature) - Validité des certificats - Chaîne de confiance (si disponible) - Présence d'horodatage (PAdES-B-T) - Données de validation (PAdES-B-LT) **Standards supportés** : PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note** : Cette validation est technique (intégrité cryptographique). La validité juridique dépend du niveau eIDAS du certificat (SES/AdES/QES) et du contexte d'utilisation.
|
|
698
|
+
|
|
699
|
+
### Examples
|
|
700
|
+
|
|
701
|
+
```ruby
|
|
702
|
+
require 'time'
|
|
703
|
+
require 'factpulse'
|
|
704
|
+
# setup authorization
|
|
705
|
+
FactPulse.configure do |config|
|
|
706
|
+
# Configure Bearer authorization: HTTPBearer
|
|
707
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
708
|
+
end
|
|
709
|
+
|
|
710
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
711
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF à valider (sera analysé pour détecter et valider les signatures)
|
|
712
|
+
|
|
713
|
+
begin
|
|
714
|
+
# Valider les signatures électroniques d'un PDF
|
|
715
|
+
result = api_instance.valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post(fichier_pdf)
|
|
716
|
+
p result
|
|
717
|
+
rescue FactPulse::ApiError => e
|
|
718
|
+
puts "Error when calling TraitementFactureApi->valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post: #{e}"
|
|
719
|
+
end
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
#### Using the valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_with_http_info variant
|
|
723
|
+
|
|
724
|
+
This returns an Array which contains the response data, status code and headers.
|
|
725
|
+
|
|
726
|
+
> <Array(Object, Integer, Hash)> valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_with_http_info(fichier_pdf)
|
|
727
|
+
|
|
728
|
+
```ruby
|
|
729
|
+
begin
|
|
730
|
+
# Valider les signatures électroniques d'un PDF
|
|
731
|
+
data, status_code, headers = api_instance.valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_with_http_info(fichier_pdf)
|
|
732
|
+
p status_code # => 2xx
|
|
733
|
+
p headers # => { ... }
|
|
734
|
+
p data # => Object
|
|
735
|
+
rescue FactPulse::ApiError => e
|
|
736
|
+
puts "Error when calling TraitementFactureApi->valider_signature_pdf_endpoint_api_v1_traitement_valider_signature_pdf_post_with_http_info: #{e}"
|
|
737
|
+
end
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
### Parameters
|
|
741
|
+
|
|
742
|
+
| Name | Type | Description | Notes |
|
|
743
|
+
| ---- | ---- | ----------- | ----- |
|
|
744
|
+
| **fichier_pdf** | **File** | Fichier PDF à valider (sera analysé pour détecter et valider les signatures) | |
|
|
745
|
+
|
|
746
|
+
### Return type
|
|
747
|
+
|
|
748
|
+
**Object**
|
|
749
|
+
|
|
750
|
+
### Authorization
|
|
751
|
+
|
|
752
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
753
|
+
|
|
754
|
+
### HTTP request headers
|
|
755
|
+
|
|
756
|
+
- **Content-Type**: multipart/form-data
|
|
757
|
+
- **Accept**: application/json
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
## valider_xml_api_v1_traitement_valider_xml_post
|
|
761
|
+
|
|
762
|
+
> <ReponseValidationSucces> valider_xml_api_v1_traitement_valider_xml_post(fichier_xml, opts)
|
|
763
|
+
|
|
764
|
+
Valider un XML Factur-X existant
|
|
765
|
+
|
|
766
|
+
Valide un fichier XML Factur-X contre les règles métier Schematron selon la norme EN 16931. ## Norme appliquée **Schematron ISO/IEC 19757-3** : Langage de validation de règles métier pour XML - Validation sémantique (au-delà de la syntaxe XSD) - Règles métier européennes EN 16931 - Règles françaises spécifiques Factur-X - Calculs arithmétiques et cohérence des données ## Profils et règles validées ### MINIMUM (45 règles) - Identifiant de facture unique - Dates (émission, échéance) - Identifiants parties (SIRET/SIREN) - Montant total TTC ### BASIC (102 règles) - Toutes les règles MINIMUM - Lignes de facture détaillées - Calculs de TVA basiques - Modes de paiement - Références (commande, contrat) ### EN16931 (178 règles) - Toutes les règles BASIC - **Règles européennes (BR-xx)** : 81 règles business - **Règles françaises (FR-xx)** : 12 règles spécifiques France - **Calculs avancés (CR-xx)** : 32 règles de calcul - **Codes normalisés (CL-xx)** : 52 listes de codes ### EXTENDED (210+ règles) - Toutes les règles EN16931 - Informations logistiques - Données comptables avancées - Références externes multiples ## Contrôles effectués ### 1. Validation syntaxique - Parsing XML correct (UTF-8, bien formé) - Namespaces UN/CEFACT présents - Structure hiérarchique respectée ### 2. Règles business (BR-xx) Exemples : - `BR-1` : Le total de la facture doit être égal à la somme des totaux de lignes + montants au niveau document - `BR-CO-10` : La somme des montants de base de TVA doit être égale au total net de la facture - `BR-16` : Le code de devise de la facture doit figurer dans la liste ISO 4217 ### 3. Règles françaises (FR-xx) Exemples : - `FR-1` : Le SIRET fournisseur doit avoir 14 chiffres - `FR-2` : Le SIRET client doit avoir 14 chiffres (si présent) - `FR-5` : Le numéro de TVA intracommunautaire doit être au format FRxx999999999 ### 4. Règles de calcul (CR-xx) - Montants HT + TVA = TTC - Somme des lignes = Total document - Remises et majorations correctement appliquées - Arrondis conformes (2 décimales pour les montants) ### 5. Codes normalisés (CL-xx) - Codes pays ISO 3166-1 alpha-2 - Codes devises ISO 4217 - Unités de mesure UN/ECE Rec 20 - Codes TVA (types, catégories, exonérations) - SchemeID pour identifiants (0002=SIREN, 0009=SIRET, etc.) ## Processus de validation 1. **Chargement XSLT** : Fichier Schematron converti en XSLT (Saxon-HE) 2. **Transformation** : Application des règles sur le XML 3. **Analyse résultats** : Extraction des erreurs (`failed-assert`) et avertissements (`successful-report`) 4. **Rapport** : Liste structurée des non-conformités ## Réponses **200 OK** : XML conforme ```json { \"message\": \"Le XML est conforme au profil EN16931\" } ``` **400 Bad Request** : XML non conforme ```json { \"detail\": [ \"[BR-1] Le total de la facture (120.00) ne correspond pas à la somme calculée (100.00 + 20.00)\", \"[FR-1] Le SIRET fournisseur doit contenir exactement 14 chiffres\" ] } ``` ## Cas d'usage - **Pré-validation** : Vérifier un XML avant intégration dans un PDF/A - **Debugging** : Identifier précisément les erreurs de génération - **Tests** : Valider des XMLs de test ou d'exemple - **Conformité** : S'assurer du respect des règles européennes et françaises - **Développement** : Tester rapidement sans générer de PDF ## Temps de traitement - Profil MINIMUM : ~0.5 seconde - Profil EN16931 : ~1-2 secondes - Profil EXTENDED : ~2-3 secondes
|
|
767
|
+
|
|
768
|
+
### Examples
|
|
769
|
+
|
|
770
|
+
```ruby
|
|
771
|
+
require 'time'
|
|
772
|
+
require 'factpulse'
|
|
773
|
+
# setup authorization
|
|
774
|
+
FactPulse.configure do |config|
|
|
775
|
+
# Configure Bearer authorization: HTTPBearer
|
|
776
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
777
|
+
end
|
|
778
|
+
|
|
779
|
+
api_instance = FactPulse::TraitementFactureApi.new
|
|
780
|
+
fichier_xml = File.new('/path/to/some/file') # File | Fichier XML Factur-X à valider (format .xml).
|
|
781
|
+
opts = {
|
|
782
|
+
profil: FactPulse::ProfilAPI::MINIMUM # ProfilAPI | Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
begin
|
|
786
|
+
# Valider un XML Factur-X existant
|
|
787
|
+
result = api_instance.valider_xml_api_v1_traitement_valider_xml_post(fichier_xml, opts)
|
|
788
|
+
p result
|
|
789
|
+
rescue FactPulse::ApiError => e
|
|
790
|
+
puts "Error when calling TraitementFactureApi->valider_xml_api_v1_traitement_valider_xml_post: #{e}"
|
|
791
|
+
end
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
#### Using the valider_xml_api_v1_traitement_valider_xml_post_with_http_info variant
|
|
795
|
+
|
|
796
|
+
This returns an Array which contains the response data, status code and headers.
|
|
797
|
+
|
|
798
|
+
> <Array(<ReponseValidationSucces>, Integer, Hash)> valider_xml_api_v1_traitement_valider_xml_post_with_http_info(fichier_xml, opts)
|
|
799
|
+
|
|
800
|
+
```ruby
|
|
801
|
+
begin
|
|
802
|
+
# Valider un XML Factur-X existant
|
|
803
|
+
data, status_code, headers = api_instance.valider_xml_api_v1_traitement_valider_xml_post_with_http_info(fichier_xml, opts)
|
|
804
|
+
p status_code # => 2xx
|
|
805
|
+
p headers # => { ... }
|
|
806
|
+
p data # => <ReponseValidationSucces>
|
|
807
|
+
rescue FactPulse::ApiError => e
|
|
808
|
+
puts "Error when calling TraitementFactureApi->valider_xml_api_v1_traitement_valider_xml_post_with_http_info: #{e}"
|
|
809
|
+
end
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### Parameters
|
|
813
|
+
|
|
814
|
+
| Name | Type | Description | Notes |
|
|
815
|
+
| ---- | ---- | ----------- | ----- |
|
|
816
|
+
| **fichier_xml** | **File** | Fichier XML Factur-X à valider (format .xml). | |
|
|
817
|
+
| **profil** | [**ProfilAPI**](ProfilAPI.md) | Profil de validation (MINIMUM, BASIC, EN16931, EXTENDED). | [optional] |
|
|
818
|
+
|
|
819
|
+
### Return type
|
|
820
|
+
|
|
821
|
+
[**ReponseValidationSucces**](ReponseValidationSucces.md)
|
|
822
|
+
|
|
823
|
+
### Authorization
|
|
824
|
+
|
|
825
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
826
|
+
|
|
827
|
+
### HTTP request headers
|
|
828
|
+
|
|
829
|
+
- **Content-Type**: multipart/form-data
|
|
830
|
+
- **Accept**: application/json
|
|
831
|
+
|