factpulse 2.0.42 → 3.0.1
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 +4 -4
- data/CHANGELOG.md +3 -3
- data/Gemfile.lock +3 -3
- data/README.md +91 -91
- data/docs/{CredentialsAFNOR.md → AFNORCredentials.md} +2 -2
- data/docs/{DestinationAFNOR.md → AFNORDestination.md} +4 -4
- data/docs/AFNORHealthCheckResponse.md +22 -0
- data/docs/AFNORPDPPAApi.md +25 -25
- data/docs/AFNORPDPPADirectoryServiceApi.md +19 -19
- data/docs/AFNORPDPPAFlowServiceApi.md +16 -16
- data/docs/{ResultatAFNOR.md → AFNORResult.md} +5 -5
- data/docs/APIError.md +2 -2
- data/docs/{MontantTva.md → APIProfile.md} +2 -2
- data/docs/{CodeCadreFacturation.md → AcknowledgmentStatus.md} +2 -2
- data/docs/{CodeRaisonReduction.md → AllowanceReasonCode.md} +2 -2
- data/docs/{ModeDepot.md → AmountDue.md} +2 -2
- data/docs/BoundingBoxSchema.md +7 -7
- data/docs/{CategorieTVA.md → CeleryStatus.md} +2 -2
- data/docs/CertificateInfoResponse.md +20 -20
- data/docs/ChorusProApi.md +123 -123
- data/docs/ChorusProDestination.md +20 -0
- data/docs/ChorusProResult.md +22 -0
- data/docs/Destination.md +7 -7
- data/docs/{ModePaiement.md → DocumentType.md} +2 -2
- data/docs/{AdresseElectronique.md → ElectronicAddress.md} +4 -4
- data/docs/EnrichedInvoiceInfo.md +32 -0
- data/docs/FacturXPDFInfo.md +22 -0
- data/docs/FactureElectroniqueRestApiSchemasChorusProChorusProCredentials.md +26 -0
- data/docs/{CredentialsChorusPro.md → FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md} +4 -4
- data/docs/FactureFacturX.md +30 -30
- data/docs/FieldStatus.md +15 -0
- data/docs/{DirectionFlux.md → FlowDirection.md} +2 -2
- data/docs/FlowProfile.md +15 -0
- data/docs/FlowSummary.md +32 -0
- data/docs/{ProfilFlux.md → FlowSyntax.md} +2 -2
- data/docs/{TypeTVA.md → FlowType.md} +2 -2
- data/docs/GenerateCertificateRequest.md +19 -19
- data/docs/GenerateCertificateResponse.md +8 -8
- data/docs/GetChorusProIdRequest.md +22 -0
- data/docs/GetChorusProIdResponse.md +24 -0
- data/docs/GetInvoiceRequest.md +20 -0
- data/docs/GetInvoiceResponse.md +34 -0
- data/docs/GetStructureRequest.md +22 -0
- data/docs/GetStructureResponse.md +34 -0
- data/docs/GlobalAllowanceAmount.md +15 -0
- data/docs/{SantApi.md → HealthApi.md} +23 -23
- data/docs/IncomingInvoice.md +54 -0
- data/docs/IncomingSupplier.md +32 -0
- data/docs/{FormatFacture.md → InvoiceFormat.md} +2 -2
- data/docs/InvoiceLine.md +46 -0
- data/docs/InvoiceLineAllowanceAmount.md +15 -0
- data/docs/InvoiceNote.md +20 -0
- data/docs/InvoiceProcessingApi.md +831 -0
- data/docs/InvoiceReferences.md +32 -0
- data/docs/{StatutFacture.md → InvoiceStatus.md} +5 -5
- data/docs/InvoiceTotals.md +30 -0
- data/docs/InvoiceTotalsPrepayment.md +15 -0
- data/docs/InvoiceTypeCode.md +15 -0
- data/docs/InvoicingFramework.md +24 -0
- data/docs/InvoicingFrameworkCode.md +15 -0
- data/docs/LineNetAmount.md +15 -0
- data/docs/MandatoryNoteSchema.md +30 -0
- data/docs/ManualRate.md +15 -0
- data/docs/ManualVatRate.md +15 -0
- data/docs/OperationNature.md +15 -0
- data/docs/{FormatSortie.md → OutputFormat.md} +2 -2
- data/docs/PDFValidationResultAPI.md +62 -0
- data/docs/PDFXMLVerificationApi.md +435 -0
- data/docs/PDPCredentials.md +4 -4
- data/docs/PageDimensionsSchema.md +20 -0
- data/docs/{Beneficiaire.md → Payee.md} +5 -5
- data/docs/PaymentMeans.md +15 -0
- data/docs/PostalAddress.md +26 -0
- data/docs/ProcessingOptions.md +24 -0
- data/docs/{Quantite.md → Quantity.md} +2 -2
- data/docs/Recipient.md +28 -0
- data/docs/SearchFlowRequest.md +34 -0
- data/docs/SearchFlowResponse.md +24 -0
- data/docs/SearchServicesResponse.md +24 -0
- data/docs/SearchStructureRequest.md +26 -0
- data/docs/SearchStructureResponse.md +24 -0
- data/docs/SignatureInfo.md +2 -2
- data/docs/SignatureInfoAPI.md +28 -0
- data/docs/SignatureParameters.md +34 -0
- data/docs/SimplifiedInvoiceData.md +34 -0
- data/docs/StructureInfo.md +10 -10
- data/docs/StructureParameters.md +22 -0
- data/docs/StructureService.md +24 -0
- data/docs/SubmissionMode.md +15 -0
- data/docs/SubmitCompleteInvoiceRequest.md +26 -0
- data/docs/SubmitCompleteInvoiceResponse.md +34 -0
- data/docs/SubmitFlowRequest.md +28 -0
- data/docs/SubmitFlowResponse.md +30 -0
- data/docs/SubmitInvoiceRequest.md +46 -0
- data/docs/SubmitInvoiceResponse.md +24 -0
- data/docs/SupplementaryAttachment.md +26 -0
- data/docs/Supplier.md +36 -0
- data/docs/TaskResponse.md +18 -0
- data/docs/TaskStatus.md +22 -0
- data/docs/TaxableAmount.md +15 -0
- data/docs/TotalGrossAmount.md +15 -0
- data/docs/TotalNetAmount.md +15 -0
- data/docs/TotalVATAmount.md +15 -0
- data/docs/UnitNetPrice.md +15 -0
- data/docs/UnitOfMeasure.md +15 -0
- data/docs/UserApi.md +74 -0
- data/docs/VATAccountingCode.md +15 -0
- data/docs/{ProfilAPI.md → VATAmount.md} +2 -2
- data/docs/VATCategory.md +15 -0
- data/docs/VATLine.md +30 -0
- data/docs/ValidationErrorDetail.md +3 -3
- data/docs/ValidationErrorResponse.md +18 -0
- data/docs/ValidationSuccessResponse.md +18 -0
- data/docs/{TypeFlux.md → VatAmount.md} +2 -2
- data/docs/VerificationSuccessResponse.md +36 -0
- data/docs/VerifiedFieldSchema.md +34 -0
- data/factpulse.gemspec +4 -4
- data/lib/factpulse/api/afnorpdppa_api.rb +25 -25
- data/lib/factpulse/api/afnorpdppa_directory_service_api.rb +40 -40
- data/lib/factpulse/api/afnorpdppa_flow_service_api.rb +16 -16
- data/lib/factpulse/api/chorus_pro_api.rb +127 -127
- data/lib/factpulse/api/health_api.rb +136 -0
- data/lib/factpulse/api/invoice_processing_api.rb +835 -0
- data/lib/factpulse/api/pdfxml_verification_api.rb +430 -0
- data/lib/factpulse/api/user_api.rb +79 -0
- data/lib/factpulse/api_client.rb +2 -2
- data/lib/factpulse/api_error.rb +2 -2
- data/lib/factpulse/api_model_base.rb +2 -2
- data/lib/factpulse/configuration.rb +2 -2
- data/lib/factpulse/helpers/client.rb +182 -182
- data/lib/factpulse/helpers/exceptions.rb +2 -2
- data/lib/factpulse/helpers/helpers.rb +5 -5
- data/lib/factpulse/models/acknowledgment_status.rb +41 -0
- data/lib/factpulse/models/afnor_credentials.rb +169 -0
- data/lib/factpulse/models/{destination_afnor.rb → afnor_destination.rb} +10 -10
- data/lib/factpulse/models/{reponse_healthcheck_afnor.rb → afnor_health_check_response.rb} +9 -9
- data/lib/factpulse/models/{resultat_afnor.rb → afnor_result.rb} +13 -13
- data/lib/factpulse/models/allowance_reason_code.rb +45 -0
- data/lib/factpulse/models/amount_due.rb +104 -0
- data/lib/factpulse/models/api_error.rb +5 -5
- data/lib/factpulse/models/api_profile.rb +42 -0
- data/lib/factpulse/models/bounding_box_schema.rb +10 -10
- data/lib/factpulse/models/celery_status.rb +43 -0
- data/lib/factpulse/models/certificate_info_response.rb +164 -164
- data/lib/factpulse/models/{destination_chorus_pro.rb → chorus_pro_destination.rb} +7 -7
- data/lib/factpulse/models/chorus_pro_result.rb +186 -0
- data/lib/factpulse/models/destination.rb +7 -7
- data/lib/factpulse/models/document_type.rb +43 -0
- data/lib/factpulse/models/electronic_address.rb +196 -0
- data/lib/factpulse/models/enriched_invoice_info.rb +348 -0
- data/lib/factpulse/models/error_level.rb +2 -2
- data/lib/factpulse/models/error_source.rb +2 -2
- data/lib/factpulse/models/factur_xpdf_info.rb +205 -0
- data/lib/factpulse/models/{chorus_pro_credentials.rb → facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.rb} +11 -11
- data/lib/factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb +191 -0
- data/lib/factpulse/models/facture_factur_x.rb +160 -160
- data/lib/factpulse/models/field_status.rb +43 -0
- data/lib/factpulse/models/flow_direction.rb +40 -0
- data/lib/factpulse/models/flow_profile.rb +41 -0
- data/lib/factpulse/models/flow_summary.rb +251 -0
- data/lib/factpulse/models/flow_syntax.rb +43 -0
- data/lib/factpulse/models/flow_type.rb +43 -0
- data/lib/factpulse/models/generate_certificate_request.rb +106 -106
- data/lib/factpulse/models/generate_certificate_response.rb +47 -47
- data/lib/factpulse/models/get_chorus_pro_id_request.rb +188 -0
- data/lib/factpulse/models/get_chorus_pro_id_response.rb +230 -0
- data/lib/factpulse/models/get_invoice_request.rb +176 -0
- data/lib/factpulse/models/get_invoice_response.rb +261 -0
- data/lib/factpulse/models/get_structure_request.rb +188 -0
- data/lib/factpulse/models/get_structure_response.rb +261 -0
- data/lib/factpulse/models/global_allowance_amount.rb +104 -0
- data/lib/factpulse/models/http_validation_error.rb +2 -2
- data/lib/factpulse/models/incoming_invoice.rb +522 -0
- data/lib/factpulse/models/incoming_supplier.rb +236 -0
- data/lib/factpulse/models/invoice_format.rb +41 -0
- data/lib/factpulse/models/invoice_line.rb +389 -0
- data/lib/factpulse/models/invoice_line_allowance_amount.rb +104 -0
- data/lib/factpulse/models/invoice_note.rb +175 -0
- data/lib/factpulse/models/invoice_references.rb +290 -0
- data/lib/factpulse/models/invoice_status.rb +203 -0
- data/lib/factpulse/models/invoice_totals.rb +272 -0
- data/lib/factpulse/models/invoice_totals_prepayment.rb +104 -0
- data/lib/factpulse/models/invoice_type_code.rb +70 -0
- data/lib/factpulse/models/invoicing_framework.rb +217 -0
- data/lib/factpulse/models/invoicing_framework_code.rb +46 -0
- data/lib/factpulse/models/line_net_amount.rb +104 -0
- data/lib/factpulse/models/mandatory_note_schema.rb +265 -0
- data/lib/factpulse/models/manual_rate.rb +104 -0
- data/lib/factpulse/models/manual_vat_rate.rb +104 -0
- data/lib/factpulse/models/operation_nature.rb +52 -0
- data/lib/factpulse/models/output_format.rb +40 -0
- data/lib/factpulse/models/page_dimensions_schema.rb +193 -0
- data/lib/factpulse/models/{beneficiaire.rb → payee.rb} +15 -15
- data/lib/factpulse/models/payment_means.rb +50 -0
- data/lib/factpulse/models/pdf_validation_result_api.rb +523 -0
- data/lib/factpulse/models/pdp_credentials.rb +7 -7
- data/lib/factpulse/models/postal_address.rb +189 -0
- data/lib/factpulse/models/processing_options.rb +207 -0
- data/lib/factpulse/models/quantity.rb +104 -0
- data/lib/factpulse/models/recipient.rb +201 -0
- data/lib/factpulse/models/scheme_id.rb +2 -2
- data/lib/factpulse/models/search_flow_request.rb +306 -0
- data/lib/factpulse/models/search_flow_response.rb +249 -0
- data/lib/factpulse/models/search_services_response.rb +214 -0
- data/lib/factpulse/models/search_structure_request.rb +191 -0
- data/lib/factpulse/models/search_structure_response.rb +216 -0
- data/lib/factpulse/models/signature_info.rb +20 -20
- data/lib/factpulse/models/signature_info_api.rb +216 -0
- data/lib/factpulse/models/signature_parameters.rb +235 -0
- data/lib/factpulse/models/simplified_invoice_data.rb +342 -0
- data/lib/factpulse/models/structure_info.rb +84 -84
- data/lib/factpulse/models/structure_parameters.rb +175 -0
- data/lib/factpulse/models/structure_service.rb +247 -0
- data/lib/factpulse/models/submission_mode.rb +44 -0
- data/lib/factpulse/models/submit_complete_invoice_request.rb +239 -0
- data/lib/factpulse/models/submit_complete_invoice_response.rb +355 -0
- data/lib/factpulse/models/submit_flow_request.rb +238 -0
- data/lib/factpulse/models/submit_flow_response.rb +294 -0
- data/lib/factpulse/models/submit_invoice_request.rb +388 -0
- data/lib/factpulse/models/submit_invoice_response.rb +213 -0
- data/lib/factpulse/models/supplementary_attachment.rb +269 -0
- data/lib/factpulse/models/supplier.rb +257 -0
- data/lib/factpulse/models/task_response.rb +166 -0
- data/lib/factpulse/models/task_status.rb +227 -0
- data/lib/factpulse/models/taxable_amount.rb +104 -0
- data/lib/factpulse/models/total_gross_amount.rb +104 -0
- data/lib/factpulse/models/total_net_amount.rb +104 -0
- data/lib/factpulse/models/total_vat_amount.rb +104 -0
- data/lib/factpulse/models/unit_net_price.rb +104 -0
- data/lib/factpulse/models/unit_of_measure.rb +50 -0
- data/lib/factpulse/models/validation_error.rb +2 -2
- data/lib/factpulse/models/validation_error_detail.rb +6 -6
- data/lib/factpulse/models/validation_error_loc_inner.rb +2 -2
- data/lib/factpulse/models/validation_error_response.rb +168 -0
- data/lib/factpulse/models/validation_success_response.rb +166 -0
- data/lib/factpulse/models/vat_accounting_code.rb +46 -0
- data/lib/factpulse/models/vat_amount.rb +104 -0
- data/lib/factpulse/models/vat_category.rb +47 -0
- data/lib/factpulse/models/vat_line.rb +262 -0
- data/lib/factpulse/models/verification_success_response.rb +343 -0
- data/lib/factpulse/models/verified_field_schema.rb +334 -0
- data/lib/factpulse/version.rb +3 -3
- data/lib/factpulse.rb +99 -99
- metadata +250 -257
- data/docs/AdressePostale.md +0 -26
- data/docs/CadreDeFacturation.md +0 -24
- data/docs/ChampVerifieSchema.md +0 -34
- data/docs/ChorusProCredentials.md +0 -26
- data/docs/ConsulterFactureRequest.md +0 -20
- data/docs/ConsulterFactureResponse.md +0 -34
- data/docs/ConsulterStructureRequest.md +0 -22
- data/docs/ConsulterStructureResponse.md +0 -34
- data/docs/Destinataire.md +0 -28
- data/docs/DestinationChorusPro.md +0 -20
- data/docs/DimensionPageSchema.md +0 -20
- data/docs/DonneesFactureSimplifiees.md +0 -34
- data/docs/FactureEnrichieInfo.md +0 -32
- data/docs/FactureEntrante.md +0 -54
- data/docs/FluxResume.md +0 -32
- data/docs/Fournisseur.md +0 -36
- data/docs/FournisseurEntrant.md +0 -32
- data/docs/InformationSignatureAPI.md +0 -28
- data/docs/LigneDePoste.md +0 -46
- data/docs/LigneDePosteMontantRemiseHt.md +0 -15
- data/docs/LigneDePosteTauxTvaManuel.md +0 -15
- data/docs/LigneDeTVA.md +0 -30
- data/docs/MontantAPayer.md +0 -15
- data/docs/MontantBaseHt.md +0 -15
- data/docs/MontantHtTotal.md +0 -15
- data/docs/MontantRemiseGlobaleTtc.md +0 -15
- data/docs/MontantTotal.md +0 -30
- data/docs/MontantTotalAcompte.md +0 -15
- data/docs/MontantTotalLigneHt.md +0 -15
- data/docs/MontantTtcTotal.md +0 -15
- data/docs/MontantTvaLigne.md +0 -15
- data/docs/MontantTvaTotal.md +0 -15
- data/docs/MontantUnitaireHt.md +0 -15
- data/docs/NatureOperation.md +0 -15
- data/docs/Note.md +0 -20
- data/docs/NoteObligatoireSchema.md +0 -30
- data/docs/ObtenirIdChorusProRequest.md +0 -22
- data/docs/ObtenirIdChorusProResponse.md +0 -24
- data/docs/OptionsProcessing.md +0 -24
- data/docs/PDFFacturXInfo.md +0 -22
- data/docs/ParametresSignature.md +0 -34
- data/docs/ParametresStructure.md +0 -22
- data/docs/PieceJointeComplementaire.md +0 -26
- data/docs/RechercherServicesResponse.md +0 -24
- data/docs/RechercherStructureRequest.md +0 -26
- data/docs/RechercherStructureResponse.md +0 -24
- data/docs/References.md +0 -32
- data/docs/ReponseHealthcheckAFNOR.md +0 -22
- data/docs/ReponseRechercheFlux.md +0 -24
- data/docs/ReponseSoumissionFlux.md +0 -30
- data/docs/ReponseTache.md +0 -18
- data/docs/ReponseValidationErreur.md +0 -18
- data/docs/ReponseValidationSucces.md +0 -18
- data/docs/ReponseVerificationSucces.md +0 -36
- data/docs/RequeteRechercheFlux.md +0 -34
- data/docs/RequeteSoumissionFlux.md +0 -28
- data/docs/ResultatChorusPro.md +0 -22
- data/docs/ResultatValidationPDFAPI.md +0 -62
- data/docs/ServiceStructure.md +0 -24
- data/docs/SoumettreFactureCompleteRequest.md +0 -26
- data/docs/SoumettreFactureCompleteResponse.md +0 -34
- data/docs/SoumettreFactureRequest.md +0 -46
- data/docs/SoumettreFactureResponse.md +0 -24
- data/docs/StatutAcquittement.md +0 -15
- data/docs/StatutCelery.md +0 -15
- data/docs/StatutChampAPI.md +0 -15
- data/docs/StatutTache.md +0 -22
- data/docs/SyntaxeFlux.md +0 -15
- data/docs/Tauxmanuel.md +0 -15
- data/docs/TraitementFactureApi.md +0 -831
- data/docs/TypeDocument.md +0 -15
- data/docs/TypeFacture.md +0 -15
- data/docs/Unite.md +0 -15
- data/docs/UtilisateurApi.md +0 -74
- data/docs/VrificationPDFXMLApi.md +0 -435
- data/lib/factpulse/api/sant_api.rb +0 -136
- data/lib/factpulse/api/traitement_facture_api.rb +0 -835
- data/lib/factpulse/api/utilisateur_api.rb +0 -79
- data/lib/factpulse/api/vrification_pdfxml_api.rb +0 -430
- data/lib/factpulse/models/adresse_electronique.rb +0 -196
- data/lib/factpulse/models/adresse_postale.rb +0 -189
- data/lib/factpulse/models/cadre_de_facturation.rb +0 -217
- data/lib/factpulse/models/categorie_tva.rb +0 -47
- data/lib/factpulse/models/champ_verifie_schema.rb +0 -334
- data/lib/factpulse/models/code_cadre_facturation.rb +0 -42
- data/lib/factpulse/models/code_raison_reduction.rb +0 -45
- data/lib/factpulse/models/consulter_facture_request.rb +0 -176
- data/lib/factpulse/models/consulter_facture_response.rb +0 -261
- data/lib/factpulse/models/consulter_structure_request.rb +0 -188
- data/lib/factpulse/models/consulter_structure_response.rb +0 -261
- data/lib/factpulse/models/credentials_afnor.rb +0 -169
- data/lib/factpulse/models/credentials_chorus_pro.rb +0 -191
- data/lib/factpulse/models/destinataire.rb +0 -201
- data/lib/factpulse/models/dimension_page_schema.rb +0 -193
- data/lib/factpulse/models/direction_flux.rb +0 -40
- data/lib/factpulse/models/donnees_facture_simplifiees.rb +0 -342
- data/lib/factpulse/models/facture_enrichie_info.rb +0 -348
- data/lib/factpulse/models/facture_entrante.rb +0 -522
- data/lib/factpulse/models/flux_resume.rb +0 -251
- data/lib/factpulse/models/format_facture.rb +0 -41
- data/lib/factpulse/models/format_sortie.rb +0 -40
- data/lib/factpulse/models/fournisseur.rb +0 -257
- data/lib/factpulse/models/fournisseur_entrant.rb +0 -236
- data/lib/factpulse/models/information_signature_api.rb +0 -216
- data/lib/factpulse/models/ligne_de_poste.rb +0 -390
- data/lib/factpulse/models/ligne_de_poste_montant_remise_ht.rb +0 -104
- data/lib/factpulse/models/ligne_de_poste_taux_tva_manuel.rb +0 -104
- data/lib/factpulse/models/ligne_de_tva.rb +0 -262
- data/lib/factpulse/models/mode_depot.rb +0 -41
- data/lib/factpulse/models/mode_paiement.rb +0 -44
- data/lib/factpulse/models/montant_a_payer.rb +0 -104
- data/lib/factpulse/models/montant_base_ht.rb +0 -104
- data/lib/factpulse/models/montant_ht_total.rb +0 -104
- data/lib/factpulse/models/montant_remise_globale_ttc.rb +0 -104
- data/lib/factpulse/models/montant_total.rb +0 -272
- data/lib/factpulse/models/montant_total_acompte.rb +0 -104
- data/lib/factpulse/models/montant_total_ligne_ht.rb +0 -104
- data/lib/factpulse/models/montant_ttc_total.rb +0 -104
- data/lib/factpulse/models/montant_tva.rb +0 -104
- data/lib/factpulse/models/montant_tva_ligne.rb +0 -104
- data/lib/factpulse/models/montant_tva_total.rb +0 -104
- data/lib/factpulse/models/montant_unitaire_ht.rb +0 -104
- data/lib/factpulse/models/nature_operation.rb +0 -52
- data/lib/factpulse/models/note.rb +0 -175
- data/lib/factpulse/models/note_obligatoire_schema.rb +0 -265
- data/lib/factpulse/models/obtenir_id_chorus_pro_request.rb +0 -188
- data/lib/factpulse/models/obtenir_id_chorus_pro_response.rb +0 -230
- data/lib/factpulse/models/options_processing.rb +0 -207
- data/lib/factpulse/models/parametres_signature.rb +0 -235
- data/lib/factpulse/models/parametres_structure.rb +0 -175
- data/lib/factpulse/models/pdf_factur_x_info.rb +0 -205
- data/lib/factpulse/models/piece_jointe_complementaire.rb +0 -269
- data/lib/factpulse/models/profil_api.rb +0 -42
- data/lib/factpulse/models/profil_flux.rb +0 -41
- data/lib/factpulse/models/quantite.rb +0 -104
- data/lib/factpulse/models/rechercher_services_response.rb +0 -214
- data/lib/factpulse/models/rechercher_structure_request.rb +0 -191
- data/lib/factpulse/models/rechercher_structure_response.rb +0 -216
- data/lib/factpulse/models/references.rb +0 -290
- data/lib/factpulse/models/reponse_recherche_flux.rb +0 -249
- data/lib/factpulse/models/reponse_soumission_flux.rb +0 -294
- data/lib/factpulse/models/reponse_tache.rb +0 -165
- data/lib/factpulse/models/reponse_validation_erreur.rb +0 -167
- data/lib/factpulse/models/reponse_validation_succes.rb +0 -165
- data/lib/factpulse/models/reponse_verification_succes.rb +0 -343
- data/lib/factpulse/models/requete_recherche_flux.rb +0 -306
- data/lib/factpulse/models/requete_soumission_flux.rb +0 -238
- data/lib/factpulse/models/resultat_chorus_pro.rb +0 -186
- data/lib/factpulse/models/resultat_validation_pdfapi.rb +0 -523
- data/lib/factpulse/models/service_structure.rb +0 -247
- data/lib/factpulse/models/soumettre_facture_complete_request.rb +0 -239
- data/lib/factpulse/models/soumettre_facture_complete_response.rb +0 -355
- data/lib/factpulse/models/soumettre_facture_request.rb +0 -388
- data/lib/factpulse/models/soumettre_facture_response.rb +0 -213
- data/lib/factpulse/models/statut_acquittement.rb +0 -41
- data/lib/factpulse/models/statut_celery.rb +0 -43
- data/lib/factpulse/models/statut_champ_api.rb +0 -43
- data/lib/factpulse/models/statut_facture.rb +0 -203
- data/lib/factpulse/models/statut_tache.rb +0 -226
- data/lib/factpulse/models/syntaxe_flux.rb +0 -43
- data/lib/factpulse/models/tauxmanuel.rb +0 -104
- data/lib/factpulse/models/type_document.rb +0 -43
- data/lib/factpulse/models/type_facture.rb +0 -54
- data/lib/factpulse/models/type_flux.rb +0 -43
- data/lib/factpulse/models/type_tva.rb +0 -42
- data/lib/factpulse/models/unite.rb +0 -44
|
@@ -0,0 +1,835 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#FactPulse REST API
|
|
3
|
+
|
|
4
|
+
# REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module FactPulse
|
|
16
|
+
class InvoiceProcessingApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Generate a Factur-X invoice
|
|
23
|
+
# Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"sender\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"recipient\": {\"siret\": \"35600000000048\"}, \"lines\": [ {\"description\": \"Service\", \"quantity\": 10, \"unitPrice\": 100.00, \"vatRate\": 20.0} ] } ``` **⚠️ Required fields (simplified format)**: - `number`: Unique invoice number - `sender.siret`: Sender's SIRET (14 digits) - `sender.iban`: Bank account IBAN (no public API to retrieve it) - `recipient.siret`: Recipient's SIRET - `lines[]`: At least one invoice line **What happens automatically with `auto_enrich=True`**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT = Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format='pdf') - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a `task_id` (HTTP 202 Accepted) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires `source_pdf`) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status `completed`): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
|
|
24
|
+
# @param invoice_data [String] Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [APIProfile] :profile Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
27
|
+
# @option opts [OutputFormat] :output_format Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
|
|
28
|
+
# @option opts [Boolean] :auto_enrich 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only) (default to true)
|
|
29
|
+
# @option opts [File] :source_pdf
|
|
30
|
+
# @return [TaskResponse]
|
|
31
|
+
def generate_invoice_api_v1_processing_generate_invoice_post(invoice_data, opts = {})
|
|
32
|
+
data, _status_code, _headers = generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(invoice_data, opts)
|
|
33
|
+
data
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Generate a Factur-X invoice
|
|
37
|
+
# Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"sender\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"recipient\": {\"siret\": \"35600000000048\"}, \"lines\": [ {\"description\": \"Service\", \"quantity\": 10, \"unitPrice\": 100.00, \"vatRate\": 20.0} ] } ``` **⚠️ Required fields (simplified format)**: - `number`: Unique invoice number - `sender.siret`: Sender's SIRET (14 digits) - `sender.iban`: Bank account IBAN (no public API to retrieve it) - `recipient.siret`: Recipient's SIRET - `lines[]`: At least one invoice line **What happens automatically with `auto_enrich=True`**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT = Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format='pdf') - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a `task_id` (HTTP 202 Accepted) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires `source_pdf`) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status `completed`): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
|
|
38
|
+
# @param invoice_data [String] Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
|
|
39
|
+
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @option opts [APIProfile] :profile Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
41
|
+
# @option opts [OutputFormat] :output_format Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
|
|
42
|
+
# @option opts [Boolean] :auto_enrich 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only) (default to true)
|
|
43
|
+
# @option opts [File] :source_pdf
|
|
44
|
+
# @return [Array<(TaskResponse, Integer, Hash)>] TaskResponse data, response status code and response headers
|
|
45
|
+
def generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(invoice_data, opts = {})
|
|
46
|
+
if @api_client.config.debugging
|
|
47
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.generate_invoice_api_v1_processing_generate_invoice_post ...'
|
|
48
|
+
end
|
|
49
|
+
# verify the required parameter 'invoice_data' is set
|
|
50
|
+
if @api_client.config.client_side_validation && invoice_data.nil?
|
|
51
|
+
fail ArgumentError, "Missing the required parameter 'invoice_data' when calling InvoiceProcessingApi.generate_invoice_api_v1_processing_generate_invoice_post"
|
|
52
|
+
end
|
|
53
|
+
# resource path
|
|
54
|
+
local_var_path = '/api/v1/processing/generate-invoice'
|
|
55
|
+
|
|
56
|
+
# query parameters
|
|
57
|
+
query_params = opts[:query_params] || {}
|
|
58
|
+
|
|
59
|
+
# header parameters
|
|
60
|
+
header_params = opts[:header_params] || {}
|
|
61
|
+
# HTTP header 'Accept' (if needed)
|
|
62
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
63
|
+
# HTTP header 'Content-Type'
|
|
64
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
65
|
+
if !content_type.nil?
|
|
66
|
+
header_params['Content-Type'] = content_type
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# form parameters
|
|
70
|
+
form_params = opts[:form_params] || {}
|
|
71
|
+
form_params['invoice_data'] = invoice_data
|
|
72
|
+
form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil?
|
|
73
|
+
form_params['output_format'] = opts[:'output_format'] if !opts[:'output_format'].nil?
|
|
74
|
+
form_params['auto_enrich'] = opts[:'auto_enrich'] if !opts[:'auto_enrich'].nil?
|
|
75
|
+
form_params['source_pdf'] = opts[:'source_pdf'] if !opts[:'source_pdf'].nil?
|
|
76
|
+
|
|
77
|
+
# http body (model)
|
|
78
|
+
post_body = opts[:debug_body]
|
|
79
|
+
|
|
80
|
+
# return_type
|
|
81
|
+
return_type = opts[:debug_return_type] || 'TaskResponse'
|
|
82
|
+
|
|
83
|
+
# auth_names
|
|
84
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
85
|
+
|
|
86
|
+
new_options = opts.merge(
|
|
87
|
+
:operation => :"InvoiceProcessingApi.generate_invoice_api_v1_processing_generate_invoice_post",
|
|
88
|
+
:header_params => header_params,
|
|
89
|
+
:query_params => query_params,
|
|
90
|
+
:form_params => form_params,
|
|
91
|
+
:body => post_body,
|
|
92
|
+
:auth_names => auth_names,
|
|
93
|
+
:return_type => return_type
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
97
|
+
if @api_client.config.debugging
|
|
98
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#generate_invoice_api_v1_processing_generate_invoice_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
99
|
+
end
|
|
100
|
+
return data, status_code, headers
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Generate a self-signed X.509 test certificate
|
|
104
|
+
# Generates a self-signed X.509 certificate for PDF electronic signature testing. **⚠️ WARNING: TEST certificate only!** This certificate is: - ✅ Suitable for testing and development - ✅ Compatible with PDF signing (PAdES) - ✅ Compliant with eIDAS **SES** level (Simple Electronic Signature) - ❌ **NEVER usable in production** - ❌ **Not recognized** by browsers and PDF readers - ❌ **No legal value** ## eIDAS levels - **SES** (Simple): Self-signed certificate ← Generated by this endpoint - **AdES** (Advanced): Commercial CA certificate (Let's Encrypt, etc.) - **QES** (Qualified): Qualified certificate from QTSP (CertEurope, Universign, etc.) ## Usage Once generated, the certificate can be: 1. **Saved in Django** (recommended): - Django Admin > Signing Certificates - Upload `certificate_pem` and `private_key_pem` 2. **Used directly**: - Sign a PDF with `/sign-pdf` - The certificate will be automatically used ## Example call ```bash curl -X POST \"https://www.factpulse.fr/api/v1/processing/generate-test-certificate\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organization\": \"Client XYZ Ltd\", \"email\": \"contact@xyz.com\", \"validity_days\": 365 }' ``` ## Use cases - PDF signature testing in development - Electronic signature POC - Training and demos - Automated integration tests ## Technical compliance Certificate generated with: - RSA key 2048 or 4096 bits - SHA-256 algorithm - Key Usage extensions: `digitalSignature`, `contentCommitment` (non-repudiation) - Extended Key Usage extensions: `codeSigning`, `emailProtection` - Validity: 1 day to 10 years (configurable) - Format: PEM (certificate and key) - Optional: PKCS#12 (.p12)
|
|
105
|
+
# @param generate_certificate_request [GenerateCertificateRequest]
|
|
106
|
+
# @param [Hash] opts the optional parameters
|
|
107
|
+
# @return [GenerateCertificateResponse]
|
|
108
|
+
def generate_test_certificate_api_v1_processing_generate_test_certificate_post(generate_certificate_request, opts = {})
|
|
109
|
+
data, _status_code, _headers = generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(generate_certificate_request, opts)
|
|
110
|
+
data
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Generate a self-signed X.509 test certificate
|
|
114
|
+
# Generates a self-signed X.509 certificate for PDF electronic signature testing. **⚠️ WARNING: TEST certificate only!** This certificate is: - ✅ Suitable for testing and development - ✅ Compatible with PDF signing (PAdES) - ✅ Compliant with eIDAS **SES** level (Simple Electronic Signature) - ❌ **NEVER usable in production** - ❌ **Not recognized** by browsers and PDF readers - ❌ **No legal value** ## eIDAS levels - **SES** (Simple): Self-signed certificate ← Generated by this endpoint - **AdES** (Advanced): Commercial CA certificate (Let's Encrypt, etc.) - **QES** (Qualified): Qualified certificate from QTSP (CertEurope, Universign, etc.) ## Usage Once generated, the certificate can be: 1. **Saved in Django** (recommended): - Django Admin > Signing Certificates - Upload `certificate_pem` and `private_key_pem` 2. **Used directly**: - Sign a PDF with `/sign-pdf` - The certificate will be automatically used ## Example call ```bash curl -X POST \"https://www.factpulse.fr/api/v1/processing/generate-test-certificate\" \\ -H \"Authorization: Bearer eyJ0eXAi...\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"cn\": \"Test Client XYZ\", \"organization\": \"Client XYZ Ltd\", \"email\": \"contact@xyz.com\", \"validity_days\": 365 }' ``` ## Use cases - PDF signature testing in development - Electronic signature POC - Training and demos - Automated integration tests ## Technical compliance Certificate generated with: - RSA key 2048 or 4096 bits - SHA-256 algorithm - Key Usage extensions: `digitalSignature`, `contentCommitment` (non-repudiation) - Extended Key Usage extensions: `codeSigning`, `emailProtection` - Validity: 1 day to 10 years (configurable) - Format: PEM (certificate and key) - Optional: PKCS#12 (.p12)
|
|
115
|
+
# @param generate_certificate_request [GenerateCertificateRequest]
|
|
116
|
+
# @param [Hash] opts the optional parameters
|
|
117
|
+
# @return [Array<(GenerateCertificateResponse, Integer, Hash)>] GenerateCertificateResponse data, response status code and response headers
|
|
118
|
+
def generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(generate_certificate_request, opts = {})
|
|
119
|
+
if @api_client.config.debugging
|
|
120
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.generate_test_certificate_api_v1_processing_generate_test_certificate_post ...'
|
|
121
|
+
end
|
|
122
|
+
# verify the required parameter 'generate_certificate_request' is set
|
|
123
|
+
if @api_client.config.client_side_validation && generate_certificate_request.nil?
|
|
124
|
+
fail ArgumentError, "Missing the required parameter 'generate_certificate_request' when calling InvoiceProcessingApi.generate_test_certificate_api_v1_processing_generate_test_certificate_post"
|
|
125
|
+
end
|
|
126
|
+
# resource path
|
|
127
|
+
local_var_path = '/api/v1/processing/generate-test-certificate'
|
|
128
|
+
|
|
129
|
+
# query parameters
|
|
130
|
+
query_params = opts[:query_params] || {}
|
|
131
|
+
|
|
132
|
+
# header parameters
|
|
133
|
+
header_params = opts[:header_params] || {}
|
|
134
|
+
# HTTP header 'Accept' (if needed)
|
|
135
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
136
|
+
# HTTP header 'Content-Type'
|
|
137
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
138
|
+
if !content_type.nil?
|
|
139
|
+
header_params['Content-Type'] = content_type
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# form parameters
|
|
143
|
+
form_params = opts[:form_params] || {}
|
|
144
|
+
|
|
145
|
+
# http body (model)
|
|
146
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_certificate_request)
|
|
147
|
+
|
|
148
|
+
# return_type
|
|
149
|
+
return_type = opts[:debug_return_type] || 'GenerateCertificateResponse'
|
|
150
|
+
|
|
151
|
+
# auth_names
|
|
152
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
153
|
+
|
|
154
|
+
new_options = opts.merge(
|
|
155
|
+
:operation => :"InvoiceProcessingApi.generate_test_certificate_api_v1_processing_generate_test_certificate_post",
|
|
156
|
+
:header_params => header_params,
|
|
157
|
+
:query_params => query_params,
|
|
158
|
+
:form_params => form_params,
|
|
159
|
+
:body => post_body,
|
|
160
|
+
:auth_names => auth_names,
|
|
161
|
+
:return_type => return_type
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
165
|
+
if @api_client.config.debugging
|
|
166
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#generate_test_certificate_api_v1_processing_generate_test_certificate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
167
|
+
end
|
|
168
|
+
return data, status_code, headers
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Get task generation status
|
|
172
|
+
# Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status=\"SUCCESS\"`, the `result` field contains: - `status`: \"SUCCESS\" or \"ERROR\" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
|
|
173
|
+
# @param task_id [String]
|
|
174
|
+
# @param [Hash] opts the optional parameters
|
|
175
|
+
# @return [TaskStatus]
|
|
176
|
+
def get_task_status_api_v1_processing_tasks_task_id_status_get(task_id, opts = {})
|
|
177
|
+
data, _status_code, _headers = get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts)
|
|
178
|
+
data
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Get task generation status
|
|
182
|
+
# Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status=\"SUCCESS\"`, the `result` field contains: - `status`: \"SUCCESS\" or \"ERROR\" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
|
|
183
|
+
# @param task_id [String]
|
|
184
|
+
# @param [Hash] opts the optional parameters
|
|
185
|
+
# @return [Array<(TaskStatus, Integer, Hash)>] TaskStatus data, response status code and response headers
|
|
186
|
+
def get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts = {})
|
|
187
|
+
if @api_client.config.debugging
|
|
188
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.get_task_status_api_v1_processing_tasks_task_id_status_get ...'
|
|
189
|
+
end
|
|
190
|
+
# verify the required parameter 'task_id' is set
|
|
191
|
+
if @api_client.config.client_side_validation && task_id.nil?
|
|
192
|
+
fail ArgumentError, "Missing the required parameter 'task_id' when calling InvoiceProcessingApi.get_task_status_api_v1_processing_tasks_task_id_status_get"
|
|
193
|
+
end
|
|
194
|
+
# resource path
|
|
195
|
+
local_var_path = '/api/v1/processing/tasks/{task_id}/status'.sub('{' + 'task_id' + '}', CGI.escape(task_id.to_s))
|
|
196
|
+
|
|
197
|
+
# query parameters
|
|
198
|
+
query_params = opts[:query_params] || {}
|
|
199
|
+
|
|
200
|
+
# header parameters
|
|
201
|
+
header_params = opts[:header_params] || {}
|
|
202
|
+
# HTTP header 'Accept' (if needed)
|
|
203
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
204
|
+
|
|
205
|
+
# form parameters
|
|
206
|
+
form_params = opts[:form_params] || {}
|
|
207
|
+
|
|
208
|
+
# http body (model)
|
|
209
|
+
post_body = opts[:debug_body]
|
|
210
|
+
|
|
211
|
+
# return_type
|
|
212
|
+
return_type = opts[:debug_return_type] || 'TaskStatus'
|
|
213
|
+
|
|
214
|
+
# auth_names
|
|
215
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
216
|
+
|
|
217
|
+
new_options = opts.merge(
|
|
218
|
+
:operation => :"InvoiceProcessingApi.get_task_status_api_v1_processing_tasks_task_id_status_get",
|
|
219
|
+
:header_params => header_params,
|
|
220
|
+
:query_params => query_params,
|
|
221
|
+
:form_params => form_params,
|
|
222
|
+
:body => post_body,
|
|
223
|
+
:auth_names => auth_names,
|
|
224
|
+
:return_type => return_type
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
228
|
+
if @api_client.config.debugging
|
|
229
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#get_task_status_api_v1_processing_tasks_task_id_status_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
230
|
+
end
|
|
231
|
+
return data, status_code, headers
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Sign a PDF with client's certificate (PAdES-B-LT)
|
|
235
|
+
# Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT). **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **eIDAS levels**: SES (self-signed), AdES (commercial CA), QES (PSCO - out of scope). **Security**: Double authentication X-Internal-Secret + JWT Bearer to retrieve the certificate. **⚠️ Legal disclaimer**: Generated signatures are electronic seals as defined by the eIDAS regulation. The level of legal validity depends on the certificate used (SES/AdES/QES). FactPulse does not provide QES qualified certificates - you must obtain a certificate from a PSCO (qualified Trust Service Provider) for maximum legal validity.
|
|
236
|
+
# @param pdf_file [File] PDF file to sign (will be processed and returned signed in base64)
|
|
237
|
+
# @param [Hash] opts the optional parameters
|
|
238
|
+
# @option opts [String] :reason
|
|
239
|
+
# @option opts [String] :location
|
|
240
|
+
# @option opts [String] :contact
|
|
241
|
+
# @option opts [String] :field_name PDF signature field name (default to 'FactPulseSignature')
|
|
242
|
+
# @option opts [Boolean] :use_pades_lt Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access. (default to false)
|
|
243
|
+
# @option opts [Boolean] :use_timestamp Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T) (default to true)
|
|
244
|
+
# @return [Object]
|
|
245
|
+
def sign_pdf_api_v1_processing_sign_pdf_post(pdf_file, opts = {})
|
|
246
|
+
data, _status_code, _headers = sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(pdf_file, opts)
|
|
247
|
+
data
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Sign a PDF with client's certificate (PAdES-B-LT)
|
|
251
|
+
# Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT). **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **eIDAS levels**: SES (self-signed), AdES (commercial CA), QES (PSCO - out of scope). **Security**: Double authentication X-Internal-Secret + JWT Bearer to retrieve the certificate. **⚠️ Legal disclaimer**: Generated signatures are electronic seals as defined by the eIDAS regulation. The level of legal validity depends on the certificate used (SES/AdES/QES). FactPulse does not provide QES qualified certificates - you must obtain a certificate from a PSCO (qualified Trust Service Provider) for maximum legal validity.
|
|
252
|
+
# @param pdf_file [File] PDF file to sign (will be processed and returned signed in base64)
|
|
253
|
+
# @param [Hash] opts the optional parameters
|
|
254
|
+
# @option opts [String] :reason
|
|
255
|
+
# @option opts [String] :location
|
|
256
|
+
# @option opts [String] :contact
|
|
257
|
+
# @option opts [String] :field_name PDF signature field name (default to 'FactPulseSignature')
|
|
258
|
+
# @option opts [Boolean] :use_pades_lt Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access. (default to false)
|
|
259
|
+
# @option opts [Boolean] :use_timestamp Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T) (default to true)
|
|
260
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
|
261
|
+
def sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(pdf_file, opts = {})
|
|
262
|
+
if @api_client.config.debugging
|
|
263
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.sign_pdf_api_v1_processing_sign_pdf_post ...'
|
|
264
|
+
end
|
|
265
|
+
# verify the required parameter 'pdf_file' is set
|
|
266
|
+
if @api_client.config.client_side_validation && pdf_file.nil?
|
|
267
|
+
fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.sign_pdf_api_v1_processing_sign_pdf_post"
|
|
268
|
+
end
|
|
269
|
+
# resource path
|
|
270
|
+
local_var_path = '/api/v1/processing/sign-pdf'
|
|
271
|
+
|
|
272
|
+
# query parameters
|
|
273
|
+
query_params = opts[:query_params] || {}
|
|
274
|
+
|
|
275
|
+
# header parameters
|
|
276
|
+
header_params = opts[:header_params] || {}
|
|
277
|
+
# HTTP header 'Accept' (if needed)
|
|
278
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
279
|
+
# HTTP header 'Content-Type'
|
|
280
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
281
|
+
if !content_type.nil?
|
|
282
|
+
header_params['Content-Type'] = content_type
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# form parameters
|
|
286
|
+
form_params = opts[:form_params] || {}
|
|
287
|
+
form_params['pdf_file'] = pdf_file
|
|
288
|
+
form_params['reason'] = opts[:'reason'] if !opts[:'reason'].nil?
|
|
289
|
+
form_params['location'] = opts[:'location'] if !opts[:'location'].nil?
|
|
290
|
+
form_params['contact'] = opts[:'contact'] if !opts[:'contact'].nil?
|
|
291
|
+
form_params['field_name'] = opts[:'field_name'] if !opts[:'field_name'].nil?
|
|
292
|
+
form_params['use_pades_lt'] = opts[:'use_pades_lt'] if !opts[:'use_pades_lt'].nil?
|
|
293
|
+
form_params['use_timestamp'] = opts[:'use_timestamp'] if !opts[:'use_timestamp'].nil?
|
|
294
|
+
|
|
295
|
+
# http body (model)
|
|
296
|
+
post_body = opts[:debug_body]
|
|
297
|
+
|
|
298
|
+
# return_type
|
|
299
|
+
return_type = opts[:debug_return_type] || 'Object'
|
|
300
|
+
|
|
301
|
+
# auth_names
|
|
302
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
303
|
+
|
|
304
|
+
new_options = opts.merge(
|
|
305
|
+
:operation => :"InvoiceProcessingApi.sign_pdf_api_v1_processing_sign_pdf_post",
|
|
306
|
+
:header_params => header_params,
|
|
307
|
+
:query_params => query_params,
|
|
308
|
+
:form_params => form_params,
|
|
309
|
+
:body => post_body,
|
|
310
|
+
:auth_names => auth_names,
|
|
311
|
+
:return_type => return_type
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
315
|
+
if @api_client.config.debugging
|
|
316
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#sign_pdf_api_v1_processing_sign_pdf_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
317
|
+
end
|
|
318
|
+
return data, status_code, headers
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# Sign a PDF asynchronously (Celery)
|
|
322
|
+
# Signs an uploaded PDF asynchronously via a Celery task. **Difference with /sign-pdf**: - `/sign-pdf`: Synchronous signature (blocking until completion) - `/sign-pdf-async`: Asynchronous signature (returns immediately with task_id) **Async advantages**: - No timeout for large files - No blocking of FastAPI worker - Progress tracking via task_id - Ideal for batch processing **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **⚠️ Legal disclaimer**: Same as /sign-pdf (see that endpoint's documentation).
|
|
323
|
+
# @param pdf_file [File] PDF file to sign (processed asynchronously)
|
|
324
|
+
# @param [Hash] opts the optional parameters
|
|
325
|
+
# @option opts [String] :reason
|
|
326
|
+
# @option opts [String] :location
|
|
327
|
+
# @option opts [String] :contact
|
|
328
|
+
# @option opts [String] :field_name PDF signature field name (default to 'FactPulseSignature')
|
|
329
|
+
# @option opts [Boolean] :use_pades_lt Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access. (default to false)
|
|
330
|
+
# @option opts [Boolean] :use_timestamp Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T) (default to true)
|
|
331
|
+
# @return [Object]
|
|
332
|
+
def sign_pdf_async_api_v1_processing_sign_pdf_async_post(pdf_file, opts = {})
|
|
333
|
+
data, _status_code, _headers = sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(pdf_file, opts)
|
|
334
|
+
data
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Sign a PDF asynchronously (Celery)
|
|
338
|
+
# Signs an uploaded PDF asynchronously via a Celery task. **Difference with /sign-pdf**: - `/sign-pdf`: Synchronous signature (blocking until completion) - `/sign-pdf-async`: Asynchronous signature (returns immediately with task_id) **Async advantages**: - No timeout for large files - No blocking of FastAPI worker - Progress tracking via task_id - Ideal for batch processing **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **⚠️ Legal disclaimer**: Same as /sign-pdf (see that endpoint's documentation).
|
|
339
|
+
# @param pdf_file [File] PDF file to sign (processed asynchronously)
|
|
340
|
+
# @param [Hash] opts the optional parameters
|
|
341
|
+
# @option opts [String] :reason
|
|
342
|
+
# @option opts [String] :location
|
|
343
|
+
# @option opts [String] :contact
|
|
344
|
+
# @option opts [String] :field_name PDF signature field name (default to 'FactPulseSignature')
|
|
345
|
+
# @option opts [Boolean] :use_pades_lt Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access. (default to false)
|
|
346
|
+
# @option opts [Boolean] :use_timestamp Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T) (default to true)
|
|
347
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
|
348
|
+
def sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(pdf_file, opts = {})
|
|
349
|
+
if @api_client.config.debugging
|
|
350
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.sign_pdf_async_api_v1_processing_sign_pdf_async_post ...'
|
|
351
|
+
end
|
|
352
|
+
# verify the required parameter 'pdf_file' is set
|
|
353
|
+
if @api_client.config.client_side_validation && pdf_file.nil?
|
|
354
|
+
fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.sign_pdf_async_api_v1_processing_sign_pdf_async_post"
|
|
355
|
+
end
|
|
356
|
+
# resource path
|
|
357
|
+
local_var_path = '/api/v1/processing/sign-pdf-async'
|
|
358
|
+
|
|
359
|
+
# query parameters
|
|
360
|
+
query_params = opts[:query_params] || {}
|
|
361
|
+
|
|
362
|
+
# header parameters
|
|
363
|
+
header_params = opts[:header_params] || {}
|
|
364
|
+
# HTTP header 'Accept' (if needed)
|
|
365
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
366
|
+
# HTTP header 'Content-Type'
|
|
367
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
368
|
+
if !content_type.nil?
|
|
369
|
+
header_params['Content-Type'] = content_type
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
# form parameters
|
|
373
|
+
form_params = opts[:form_params] || {}
|
|
374
|
+
form_params['pdf_file'] = pdf_file
|
|
375
|
+
form_params['reason'] = opts[:'reason'] if !opts[:'reason'].nil?
|
|
376
|
+
form_params['location'] = opts[:'location'] if !opts[:'location'].nil?
|
|
377
|
+
form_params['contact'] = opts[:'contact'] if !opts[:'contact'].nil?
|
|
378
|
+
form_params['field_name'] = opts[:'field_name'] if !opts[:'field_name'].nil?
|
|
379
|
+
form_params['use_pades_lt'] = opts[:'use_pades_lt'] if !opts[:'use_pades_lt'].nil?
|
|
380
|
+
form_params['use_timestamp'] = opts[:'use_timestamp'] if !opts[:'use_timestamp'].nil?
|
|
381
|
+
|
|
382
|
+
# http body (model)
|
|
383
|
+
post_body = opts[:debug_body]
|
|
384
|
+
|
|
385
|
+
# return_type
|
|
386
|
+
return_type = opts[:debug_return_type] || 'Object'
|
|
387
|
+
|
|
388
|
+
# auth_names
|
|
389
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
390
|
+
|
|
391
|
+
new_options = opts.merge(
|
|
392
|
+
:operation => :"InvoiceProcessingApi.sign_pdf_async_api_v1_processing_sign_pdf_async_post",
|
|
393
|
+
:header_params => header_params,
|
|
394
|
+
:query_params => query_params,
|
|
395
|
+
:form_params => form_params,
|
|
396
|
+
:body => post_body,
|
|
397
|
+
:auth_names => auth_names,
|
|
398
|
+
:return_type => return_type
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
402
|
+
if @api_client.config.debugging
|
|
403
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#sign_pdf_async_api_v1_processing_sign_pdf_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
404
|
+
end
|
|
405
|
+
return data, status_code, headers
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
# Submit a complete invoice (generation + signature + submission)
|
|
409
|
+
# Unified endpoint to submit a complete invoice to different destinations. **Automated workflow:** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Destination credentials - 2 modes available:** **Mode 1 - Retrieval via JWT (recommended):** - Credentials are retrieved automatically via the JWT `client_uid` - Do not provide the `credentials` field in `destination` - Zero-trust architecture: no secrets in the payload - Example: `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials in the payload:** - Provide credentials directly in the payload - Useful for tests or third-party integrations - Example: `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Electronic signature (optional) - 2 modes available:** **Mode 1 - Stored certificate (recommended):** - Certificate is retrieved automatically via the JWT `client_uid` - No key to provide in the payload - PAdES-B-LT signature with timestamp (eIDAS compliant) - Example: `\"signature\": {\"reason\": \"Factur-X compliance\"}` **Mode 2 - Keys in the payload (for tests):** - Provide `key_pem` and `cert_pem` directly - PEM format accepted: raw or base64 - Useful for tests or special cases without stored certificate - Example: `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` If `key_pem` and `cert_pem` are provided → Mode 2 Otherwise → Mode 1 (certificate retrieved via `client_uid`)
|
|
410
|
+
# @param submit_complete_invoice_request [SubmitCompleteInvoiceRequest]
|
|
411
|
+
# @param [Hash] opts the optional parameters
|
|
412
|
+
# @return [SubmitCompleteInvoiceResponse]
|
|
413
|
+
def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post(submit_complete_invoice_request, opts = {})
|
|
414
|
+
data, _status_code, _headers = submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(submit_complete_invoice_request, opts)
|
|
415
|
+
data
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Submit a complete invoice (generation + signature + submission)
|
|
419
|
+
# Unified endpoint to submit a complete invoice to different destinations. **Automated workflow:** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Destination credentials - 2 modes available:** **Mode 1 - Retrieval via JWT (recommended):** - Credentials are retrieved automatically via the JWT `client_uid` - Do not provide the `credentials` field in `destination` - Zero-trust architecture: no secrets in the payload - Example: `\"destination\": {\"type\": \"chorus_pro\"}` **Mode 2 - Credentials in the payload:** - Provide credentials directly in the payload - Useful for tests or third-party integrations - Example: `\"destination\": {\"type\": \"chorus_pro\", \"credentials\": {...}}` **Electronic signature (optional) - 2 modes available:** **Mode 1 - Stored certificate (recommended):** - Certificate is retrieved automatically via the JWT `client_uid` - No key to provide in the payload - PAdES-B-LT signature with timestamp (eIDAS compliant) - Example: `\"signature\": {\"reason\": \"Factur-X compliance\"}` **Mode 2 - Keys in the payload (for tests):** - Provide `key_pem` and `cert_pem` directly - PEM format accepted: raw or base64 - Useful for tests or special cases without stored certificate - Example: `\"signature\": {\"key_pem\": \"-----BEGIN...\", \"cert_pem\": \"-----BEGIN...\"}` If `key_pem` and `cert_pem` are provided → Mode 2 Otherwise → Mode 1 (certificate retrieved via `client_uid`)
|
|
420
|
+
# @param submit_complete_invoice_request [SubmitCompleteInvoiceRequest]
|
|
421
|
+
# @param [Hash] opts the optional parameters
|
|
422
|
+
# @return [Array<(SubmitCompleteInvoiceResponse, Integer, Hash)>] SubmitCompleteInvoiceResponse data, response status code and response headers
|
|
423
|
+
def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(submit_complete_invoice_request, opts = {})
|
|
424
|
+
if @api_client.config.debugging
|
|
425
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.submit_complete_invoice_api_v1_processing_invoices_submit_complete_post ...'
|
|
426
|
+
end
|
|
427
|
+
# verify the required parameter 'submit_complete_invoice_request' is set
|
|
428
|
+
if @api_client.config.client_side_validation && submit_complete_invoice_request.nil?
|
|
429
|
+
fail ArgumentError, "Missing the required parameter 'submit_complete_invoice_request' when calling InvoiceProcessingApi.submit_complete_invoice_api_v1_processing_invoices_submit_complete_post"
|
|
430
|
+
end
|
|
431
|
+
# resource path
|
|
432
|
+
local_var_path = '/api/v1/processing/invoices/submit-complete'
|
|
433
|
+
|
|
434
|
+
# query parameters
|
|
435
|
+
query_params = opts[:query_params] || {}
|
|
436
|
+
|
|
437
|
+
# header parameters
|
|
438
|
+
header_params = opts[:header_params] || {}
|
|
439
|
+
# HTTP header 'Accept' (if needed)
|
|
440
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
441
|
+
# HTTP header 'Content-Type'
|
|
442
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
443
|
+
if !content_type.nil?
|
|
444
|
+
header_params['Content-Type'] = content_type
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
# form parameters
|
|
448
|
+
form_params = opts[:form_params] || {}
|
|
449
|
+
|
|
450
|
+
# http body (model)
|
|
451
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(submit_complete_invoice_request)
|
|
452
|
+
|
|
453
|
+
# return_type
|
|
454
|
+
return_type = opts[:debug_return_type] || 'SubmitCompleteInvoiceResponse'
|
|
455
|
+
|
|
456
|
+
# auth_names
|
|
457
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
458
|
+
|
|
459
|
+
new_options = opts.merge(
|
|
460
|
+
:operation => :"InvoiceProcessingApi.submit_complete_invoice_api_v1_processing_invoices_submit_complete_post",
|
|
461
|
+
:header_params => header_params,
|
|
462
|
+
:query_params => query_params,
|
|
463
|
+
:form_params => form_params,
|
|
464
|
+
:body => post_body,
|
|
465
|
+
:auth_names => auth_names,
|
|
466
|
+
:return_type => return_type
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
470
|
+
if @api_client.config.debugging
|
|
471
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#submit_complete_invoice_api_v1_processing_invoices_submit_complete_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
472
|
+
end
|
|
473
|
+
return data, status_code, headers
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
# Submit a complete invoice (asynchronous with Celery)
|
|
477
|
+
# Asynchronous version of the `/invoices/submit-complete` endpoint using Celery for background processing. **Automated workflow (same as synchronous version):** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Differences with synchronous version:** - ✅ **Non-blocking**: Returns immediately with a `task_id` (HTTP 202 Accepted) - ✅ **Background processing**: Invoice is processed by a Celery worker - ✅ **Progress tracking**: Use `/tasks/{task_id}/status` to track status - ✅ **Ideal for high volumes**: Allows processing many invoices in parallel **How to use:** 1. **Submission**: Call this endpoint with your invoice data 2. **Immediate return**: You receive a `task_id` (e.g., \"abc123-def456\") 3. **Tracking**: Call `/tasks/{task_id}/status` to check progress 4. **Result**: When `status = \"SUCCESS\"`, the `result` field contains the complete response **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
|
|
478
|
+
# @param submit_complete_invoice_request [SubmitCompleteInvoiceRequest]
|
|
479
|
+
# @param [Hash] opts the optional parameters
|
|
480
|
+
# @return [TaskResponse]
|
|
481
|
+
def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post(submit_complete_invoice_request, opts = {})
|
|
482
|
+
data, _status_code, _headers = submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(submit_complete_invoice_request, opts)
|
|
483
|
+
data
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
# Submit a complete invoice (asynchronous with Celery)
|
|
487
|
+
# Asynchronous version of the `/invoices/submit-complete` endpoint using Celery for background processing. **Automated workflow (same as synchronous version):** 1. **Auto-enrichment** (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. **Submission**: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Differences with synchronous version:** - ✅ **Non-blocking**: Returns immediately with a `task_id` (HTTP 202 Accepted) - ✅ **Background processing**: Invoice is processed by a Celery worker - ✅ **Progress tracking**: Use `/tasks/{task_id}/status` to track status - ✅ **Ideal for high volumes**: Allows processing many invoices in parallel **How to use:** 1. **Submission**: Call this endpoint with your invoice data 2. **Immediate return**: You receive a `task_id` (e.g., \"abc123-def456\") 3. **Tracking**: Call `/tasks/{task_id}/status` to check progress 4. **Result**: When `status = \"SUCCESS\"`, the `result` field contains the complete response **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
|
|
488
|
+
# @param submit_complete_invoice_request [SubmitCompleteInvoiceRequest]
|
|
489
|
+
# @param [Hash] opts the optional parameters
|
|
490
|
+
# @return [Array<(TaskResponse, Integer, Hash)>] TaskResponse data, response status code and response headers
|
|
491
|
+
def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(submit_complete_invoice_request, opts = {})
|
|
492
|
+
if @api_client.config.debugging
|
|
493
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post ...'
|
|
494
|
+
end
|
|
495
|
+
# verify the required parameter 'submit_complete_invoice_request' is set
|
|
496
|
+
if @api_client.config.client_side_validation && submit_complete_invoice_request.nil?
|
|
497
|
+
fail ArgumentError, "Missing the required parameter 'submit_complete_invoice_request' when calling InvoiceProcessingApi.submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post"
|
|
498
|
+
end
|
|
499
|
+
# resource path
|
|
500
|
+
local_var_path = '/api/v1/processing/invoices/submit-complete-async'
|
|
501
|
+
|
|
502
|
+
# query parameters
|
|
503
|
+
query_params = opts[:query_params] || {}
|
|
504
|
+
|
|
505
|
+
# header parameters
|
|
506
|
+
header_params = opts[:header_params] || {}
|
|
507
|
+
# HTTP header 'Accept' (if needed)
|
|
508
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
509
|
+
# HTTP header 'Content-Type'
|
|
510
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
511
|
+
if !content_type.nil?
|
|
512
|
+
header_params['Content-Type'] = content_type
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
# form parameters
|
|
516
|
+
form_params = opts[:form_params] || {}
|
|
517
|
+
|
|
518
|
+
# http body (model)
|
|
519
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(submit_complete_invoice_request)
|
|
520
|
+
|
|
521
|
+
# return_type
|
|
522
|
+
return_type = opts[:debug_return_type] || 'TaskResponse'
|
|
523
|
+
|
|
524
|
+
# auth_names
|
|
525
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
526
|
+
|
|
527
|
+
new_options = opts.merge(
|
|
528
|
+
:operation => :"InvoiceProcessingApi.submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post",
|
|
529
|
+
:header_params => header_params,
|
|
530
|
+
:query_params => query_params,
|
|
531
|
+
:form_params => form_params,
|
|
532
|
+
:body => post_body,
|
|
533
|
+
:auth_names => auth_names,
|
|
534
|
+
:return_type => return_type
|
|
535
|
+
)
|
|
536
|
+
|
|
537
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
538
|
+
if @api_client.config.debugging
|
|
539
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
540
|
+
end
|
|
541
|
+
return data, status_code, headers
|
|
542
|
+
end
|
|
543
|
+
|
|
544
|
+
# Validate a complete Factur-X PDF
|
|
545
|
+
# Validates a complete Factur-X PDF according to European and French standards. ## Applied validation standards - **EN 16931**: European semantic standard (directive 2014/55/EU) - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Factur-X / ZUGFeRD**: Franco-German specification - **Schematron**: XML business rules validation - **eIDAS**: European regulation on electronic identification (signatures) ## Checks performed ### 1. Factur-X XML extraction and validation **Checks performed:** - Presence of embedded XML file (`factur-x.xml` or `zugferd-invoice.xml`) - Automatic profile detection (MINIMUM, BASIC, EN16931, EXTENDED) - XML parsing with UTF-8 validation - GuidelineSpecifiedDocumentContextParameter/ID extraction **Schematron validation:** - Business rules for detected profile (MINIMUM: 45 rules, EN16931: 178 rules) - Cardinality of required elements - Calculation consistency (net, VAT, gross amounts, discounts) - Identifier formats (SIRET, intra-EU VAT, IBAN) - Standardized codes (ISO country codes, UN/ECE units, VAT codes) **What is verified:** - ✅ XML structure conforming to Cross Industry Invoice XSD - ✅ Correct UN/CEFACT namespace - ✅ European business rules (BR-xx) - ✅ French-specific rules (FR-xx) ### 2. PDF/A-3 compliance **Basic validation (metadata):** - Presence of `/Type` field set to `Catalog` - Metadata `pdfaid:part` = 3 (PDF/A-3) - Metadata `pdfaid:conformance` = B or U - PDF version >= 1.4 **Strict VeraPDF validation (if use_verapdf=True):** - 146+ ISO 19005-3 rules (PDF/A-3B) - Absence of forbidden content (JavaScript, multimedia, dynamic forms) - Correctly embedded fonts and subsets - Compliant color spaces (sRGB, DeviceGray) - Valid file structure (cross-reference table) - XMP metadata conforming to ISO 16684-1 **What is verified:** - ✅ Long-term archivable file (20+ years) - ✅ Guaranteed readability (embedded fonts) - ✅ Legal compliance (France, Germany, EU) ### 3. XMP metadata (eXtensible Metadata Platform) **Checks performed:** - Presence of `<?xpacket>` block with XMP metadata - `fx:` namespace for Factur-X: `urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#` - Required Factur-X fields: - `fx:ConformanceLevel`: Profile (MINIMUM, BASIC, EN16931, EXTENDED) - `fx:DocumentFileName`: Embedded XML name - `fx:DocumentType`: \"INVOICE\" - `fx:Version`: Factur-X version (1.0.07) **What is verified:** - ✅ Metadata conforming to ISO 16684-1 - ✅ Correct declared Factur-X profile - ✅ Supported Factur-X version ### 4. Electronic signatures **Detection and analysis:** - Presence of `/Sig` dictionaries in PDF - Signature type: PAdES (PDF Advanced Electronic Signature) - Information extraction: - Signer name (`/Name`) - Signing date (`/M`) - Signature reason (`/Reason`) - Signature location (`/Location`) - Signature type (approval, certification) **What is verified:** - ✅ Presence of signatures or seals - ✅ Number of signatures (single or multi-signature) - ℹ️ No cryptographic verification (requires certificates) ## Parameters - **pdf_file** (required): The Factur-X PDF file to validate - **profile** (optional): Expected profile. If absent, auto-detected from XML - **use_verapdf** (optional, default=false): Enable strict PDF/A validation with VeraPDF - `false`: Fast metadata validation (2-3 seconds) - `true`: Complete ISO 19005-3 validation (15-30 seconds, **recommended for production**) ## Detailed response ```json { \"isCompliant\": true, \"xml\": { \"present\": true, \"compliant\": true, \"profile\": \"EN16931\", \"errors\": [] }, \"pdfa\": { \"compliant\": true, \"version\": \"PDF/A-3B\", \"method\": \"verapdf\", \"errors\": [] }, \"xmp\": { \"present\": true, \"compliant\": true, \"metadata\": {...} }, \"signatures\": { \"present\": true, \"count\": 1, \"details\": [...] } } ``` ## Use cases - **Before sending**: Validate generated invoice before transmission to client - **On reception**: Verify compliance of invoice received from supplier - **Audit**: Check quality of invoice batches - **Legal compliance**: Ensure B2B/B2G obligations are met in France - **Debugging**: Identify issues in generation process - **Archiving**: Guarantee long-term validity (PDF/A-3) ## Processing time - Basic validation: 2-3 seconds - VeraPDF validation: 15-30 seconds (depends on PDF size)
|
|
546
|
+
# @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
|
|
547
|
+
# @param [Hash] opts the optional parameters
|
|
548
|
+
# @option opts [APIProfile] :profile
|
|
549
|
+
# @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation. (default to false)
|
|
550
|
+
# @return [PDFValidationResultAPI]
|
|
551
|
+
def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post(pdf_file, opts = {})
|
|
552
|
+
data, _status_code, _headers = validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(pdf_file, opts)
|
|
553
|
+
data
|
|
554
|
+
end
|
|
555
|
+
|
|
556
|
+
# Validate a complete Factur-X PDF
|
|
557
|
+
# Validates a complete Factur-X PDF according to European and French standards. ## Applied validation standards - **EN 16931**: European semantic standard (directive 2014/55/EU) - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Factur-X / ZUGFeRD**: Franco-German specification - **Schematron**: XML business rules validation - **eIDAS**: European regulation on electronic identification (signatures) ## Checks performed ### 1. Factur-X XML extraction and validation **Checks performed:** - Presence of embedded XML file (`factur-x.xml` or `zugferd-invoice.xml`) - Automatic profile detection (MINIMUM, BASIC, EN16931, EXTENDED) - XML parsing with UTF-8 validation - GuidelineSpecifiedDocumentContextParameter/ID extraction **Schematron validation:** - Business rules for detected profile (MINIMUM: 45 rules, EN16931: 178 rules) - Cardinality of required elements - Calculation consistency (net, VAT, gross amounts, discounts) - Identifier formats (SIRET, intra-EU VAT, IBAN) - Standardized codes (ISO country codes, UN/ECE units, VAT codes) **What is verified:** - ✅ XML structure conforming to Cross Industry Invoice XSD - ✅ Correct UN/CEFACT namespace - ✅ European business rules (BR-xx) - ✅ French-specific rules (FR-xx) ### 2. PDF/A-3 compliance **Basic validation (metadata):** - Presence of `/Type` field set to `Catalog` - Metadata `pdfaid:part` = 3 (PDF/A-3) - Metadata `pdfaid:conformance` = B or U - PDF version >= 1.4 **Strict VeraPDF validation (if use_verapdf=True):** - 146+ ISO 19005-3 rules (PDF/A-3B) - Absence of forbidden content (JavaScript, multimedia, dynamic forms) - Correctly embedded fonts and subsets - Compliant color spaces (sRGB, DeviceGray) - Valid file structure (cross-reference table) - XMP metadata conforming to ISO 16684-1 **What is verified:** - ✅ Long-term archivable file (20+ years) - ✅ Guaranteed readability (embedded fonts) - ✅ Legal compliance (France, Germany, EU) ### 3. XMP metadata (eXtensible Metadata Platform) **Checks performed:** - Presence of `<?xpacket>` block with XMP metadata - `fx:` namespace for Factur-X: `urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#` - Required Factur-X fields: - `fx:ConformanceLevel`: Profile (MINIMUM, BASIC, EN16931, EXTENDED) - `fx:DocumentFileName`: Embedded XML name - `fx:DocumentType`: \"INVOICE\" - `fx:Version`: Factur-X version (1.0.07) **What is verified:** - ✅ Metadata conforming to ISO 16684-1 - ✅ Correct declared Factur-X profile - ✅ Supported Factur-X version ### 4. Electronic signatures **Detection and analysis:** - Presence of `/Sig` dictionaries in PDF - Signature type: PAdES (PDF Advanced Electronic Signature) - Information extraction: - Signer name (`/Name`) - Signing date (`/M`) - Signature reason (`/Reason`) - Signature location (`/Location`) - Signature type (approval, certification) **What is verified:** - ✅ Presence of signatures or seals - ✅ Number of signatures (single or multi-signature) - ℹ️ No cryptographic verification (requires certificates) ## Parameters - **pdf_file** (required): The Factur-X PDF file to validate - **profile** (optional): Expected profile. If absent, auto-detected from XML - **use_verapdf** (optional, default=false): Enable strict PDF/A validation with VeraPDF - `false`: Fast metadata validation (2-3 seconds) - `true`: Complete ISO 19005-3 validation (15-30 seconds, **recommended for production**) ## Detailed response ```json { \"isCompliant\": true, \"xml\": { \"present\": true, \"compliant\": true, \"profile\": \"EN16931\", \"errors\": [] }, \"pdfa\": { \"compliant\": true, \"version\": \"PDF/A-3B\", \"method\": \"verapdf\", \"errors\": [] }, \"xmp\": { \"present\": true, \"compliant\": true, \"metadata\": {...} }, \"signatures\": { \"present\": true, \"count\": 1, \"details\": [...] } } ``` ## Use cases - **Before sending**: Validate generated invoice before transmission to client - **On reception**: Verify compliance of invoice received from supplier - **Audit**: Check quality of invoice batches - **Legal compliance**: Ensure B2B/B2G obligations are met in France - **Debugging**: Identify issues in generation process - **Archiving**: Guarantee long-term validity (PDF/A-3) ## Processing time - Basic validation: 2-3 seconds - VeraPDF validation: 15-30 seconds (depends on PDF size)
|
|
558
|
+
# @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
|
|
559
|
+
# @param [Hash] opts the optional parameters
|
|
560
|
+
# @option opts [APIProfile] :profile
|
|
561
|
+
# @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation. (default to false)
|
|
562
|
+
# @return [Array<(PDFValidationResultAPI, Integer, Hash)>] PDFValidationResultAPI data, response status code and response headers
|
|
563
|
+
def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(pdf_file, opts = {})
|
|
564
|
+
if @api_client.config.debugging
|
|
565
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post ...'
|
|
566
|
+
end
|
|
567
|
+
# verify the required parameter 'pdf_file' is set
|
|
568
|
+
if @api_client.config.client_side_validation && pdf_file.nil?
|
|
569
|
+
fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post"
|
|
570
|
+
end
|
|
571
|
+
# resource path
|
|
572
|
+
local_var_path = '/api/v1/processing/validate-facturx-pdf'
|
|
573
|
+
|
|
574
|
+
# query parameters
|
|
575
|
+
query_params = opts[:query_params] || {}
|
|
576
|
+
|
|
577
|
+
# header parameters
|
|
578
|
+
header_params = opts[:header_params] || {}
|
|
579
|
+
# HTTP header 'Accept' (if needed)
|
|
580
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
581
|
+
# HTTP header 'Content-Type'
|
|
582
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
583
|
+
if !content_type.nil?
|
|
584
|
+
header_params['Content-Type'] = content_type
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
# form parameters
|
|
588
|
+
form_params = opts[:form_params] || {}
|
|
589
|
+
form_params['pdf_file'] = pdf_file
|
|
590
|
+
form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil?
|
|
591
|
+
form_params['use_verapdf'] = opts[:'use_verapdf'] if !opts[:'use_verapdf'].nil?
|
|
592
|
+
|
|
593
|
+
# http body (model)
|
|
594
|
+
post_body = opts[:debug_body]
|
|
595
|
+
|
|
596
|
+
# return_type
|
|
597
|
+
return_type = opts[:debug_return_type] || 'PDFValidationResultAPI'
|
|
598
|
+
|
|
599
|
+
# auth_names
|
|
600
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
601
|
+
|
|
602
|
+
new_options = opts.merge(
|
|
603
|
+
:operation => :"InvoiceProcessingApi.validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post",
|
|
604
|
+
:header_params => header_params,
|
|
605
|
+
:query_params => query_params,
|
|
606
|
+
:form_params => form_params,
|
|
607
|
+
:body => post_body,
|
|
608
|
+
:auth_names => auth_names,
|
|
609
|
+
:return_type => return_type
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
613
|
+
if @api_client.config.debugging
|
|
614
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
615
|
+
end
|
|
616
|
+
return data, status_code, headers
|
|
617
|
+
end
|
|
618
|
+
|
|
619
|
+
# Validate a Factur-X PDF (asynchronous with polling)
|
|
620
|
+
# Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a `task_id` (HTTP 202) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn't wait during validation ## When to use this mode? - **VeraPDF validation enabled** (`use_verapdf=True`): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs > 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile's Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use `GET /tasks/{task_id}/status` endpoint to retrieve the result. **Polling example**: ```python import requests import time # 1. Submit task response = requests.post(\"/validate-facturx-async\", files={\"pdf_file\": pdf_file}) task_id = response.json()[\"taskId\"] # 2. Poll every 2 seconds while True: status_response = requests.get(f\"/tasks/{task_id}/status\") status = status_response.json() if status[\"status\"] == \"SUCCESS\": result = status[\"result\"][\"validation_result\"] print(f\"Compliant: {result['is_compliant']}\") break elif status[\"status\"] == \"FAILURE\": print(f\"Error: {status['result']['errorMessage']}\") break time.sleep(2) # Wait 2 seconds before next check ``` ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
|
|
621
|
+
# @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
|
|
622
|
+
# @param [Hash] opts the optional parameters
|
|
623
|
+
# @option opts [APIProfile] :profile
|
|
624
|
+
# @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds. (default to false)
|
|
625
|
+
# @return [TaskResponse]
|
|
626
|
+
def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post(pdf_file, opts = {})
|
|
627
|
+
data, _status_code, _headers = validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(pdf_file, opts)
|
|
628
|
+
data
|
|
629
|
+
end
|
|
630
|
+
|
|
631
|
+
# Validate a Factur-X PDF (asynchronous with polling)
|
|
632
|
+
# Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a `task_id` (HTTP 202) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn't wait during validation ## When to use this mode? - **VeraPDF validation enabled** (`use_verapdf=True`): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs > 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile's Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use `GET /tasks/{task_id}/status` endpoint to retrieve the result. **Polling example**: ```python import requests import time # 1. Submit task response = requests.post(\"/validate-facturx-async\", files={\"pdf_file\": pdf_file}) task_id = response.json()[\"taskId\"] # 2. Poll every 2 seconds while True: status_response = requests.get(f\"/tasks/{task_id}/status\") status = status_response.json() if status[\"status\"] == \"SUCCESS\": result = status[\"result\"][\"validation_result\"] print(f\"Compliant: {result['is_compliant']}\") break elif status[\"status\"] == \"FAILURE\": print(f\"Error: {status['result']['errorMessage']}\") break time.sleep(2) # Wait 2 seconds before next check ``` ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
|
|
633
|
+
# @param pdf_file [File] Factur-X PDF file to validate (.pdf format).
|
|
634
|
+
# @param [Hash] opts the optional parameters
|
|
635
|
+
# @option opts [APIProfile] :profile
|
|
636
|
+
# @option opts [Boolean] :use_verapdf Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds. (default to false)
|
|
637
|
+
# @return [Array<(TaskResponse, Integer, Hash)>] TaskResponse data, response status code and response headers
|
|
638
|
+
def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(pdf_file, opts = {})
|
|
639
|
+
if @api_client.config.debugging
|
|
640
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post ...'
|
|
641
|
+
end
|
|
642
|
+
# verify the required parameter 'pdf_file' is set
|
|
643
|
+
if @api_client.config.client_side_validation && pdf_file.nil?
|
|
644
|
+
fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post"
|
|
645
|
+
end
|
|
646
|
+
# resource path
|
|
647
|
+
local_var_path = '/api/v1/processing/validate-facturx-async'
|
|
648
|
+
|
|
649
|
+
# query parameters
|
|
650
|
+
query_params = opts[:query_params] || {}
|
|
651
|
+
|
|
652
|
+
# header parameters
|
|
653
|
+
header_params = opts[:header_params] || {}
|
|
654
|
+
# HTTP header 'Accept' (if needed)
|
|
655
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
656
|
+
# HTTP header 'Content-Type'
|
|
657
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
658
|
+
if !content_type.nil?
|
|
659
|
+
header_params['Content-Type'] = content_type
|
|
660
|
+
end
|
|
661
|
+
|
|
662
|
+
# form parameters
|
|
663
|
+
form_params = opts[:form_params] || {}
|
|
664
|
+
form_params['pdf_file'] = pdf_file
|
|
665
|
+
form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil?
|
|
666
|
+
form_params['use_verapdf'] = opts[:'use_verapdf'] if !opts[:'use_verapdf'].nil?
|
|
667
|
+
|
|
668
|
+
# http body (model)
|
|
669
|
+
post_body = opts[:debug_body]
|
|
670
|
+
|
|
671
|
+
# return_type
|
|
672
|
+
return_type = opts[:debug_return_type] || 'TaskResponse'
|
|
673
|
+
|
|
674
|
+
# auth_names
|
|
675
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
676
|
+
|
|
677
|
+
new_options = opts.merge(
|
|
678
|
+
:operation => :"InvoiceProcessingApi.validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post",
|
|
679
|
+
:header_params => header_params,
|
|
680
|
+
:query_params => query_params,
|
|
681
|
+
:form_params => form_params,
|
|
682
|
+
:body => post_body,
|
|
683
|
+
:auth_names => auth_names,
|
|
684
|
+
:return_type => return_type
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
688
|
+
if @api_client.config.debugging
|
|
689
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
690
|
+
end
|
|
691
|
+
return data, status_code, headers
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
# Validate electronic signatures of a PDF
|
|
695
|
+
# Validates electronic signatures present in an uploaded PDF. **Verifications performed**: - Presence of signatures - Document integrity (not modified since signing) - Certificate validity - Chain of trust (if available) - Presence of timestamp (PAdES-B-T) - Validation data (PAdES-B-LT) **Supported standards**: PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note**: This validation is technical (cryptographic integrity). Legal validity depends on the eIDAS level of the certificate (SES/AdES/QES) and the context of use.
|
|
696
|
+
# @param pdf_file [File] PDF file to validate (will be analyzed to detect and validate signatures)
|
|
697
|
+
# @param [Hash] opts the optional parameters
|
|
698
|
+
# @return [Object]
|
|
699
|
+
def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post(pdf_file, opts = {})
|
|
700
|
+
data, _status_code, _headers = validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(pdf_file, opts)
|
|
701
|
+
data
|
|
702
|
+
end
|
|
703
|
+
|
|
704
|
+
# Validate electronic signatures of a PDF
|
|
705
|
+
# Validates electronic signatures present in an uploaded PDF. **Verifications performed**: - Presence of signatures - Document integrity (not modified since signing) - Certificate validity - Chain of trust (if available) - Presence of timestamp (PAdES-B-T) - Validation data (PAdES-B-LT) **Supported standards**: PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note**: This validation is technical (cryptographic integrity). Legal validity depends on the eIDAS level of the certificate (SES/AdES/QES) and the context of use.
|
|
706
|
+
# @param pdf_file [File] PDF file to validate (will be analyzed to detect and validate signatures)
|
|
707
|
+
# @param [Hash] opts the optional parameters
|
|
708
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
|
709
|
+
def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(pdf_file, opts = {})
|
|
710
|
+
if @api_client.config.debugging
|
|
711
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post ...'
|
|
712
|
+
end
|
|
713
|
+
# verify the required parameter 'pdf_file' is set
|
|
714
|
+
if @api_client.config.client_side_validation && pdf_file.nil?
|
|
715
|
+
fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post"
|
|
716
|
+
end
|
|
717
|
+
# resource path
|
|
718
|
+
local_var_path = '/api/v1/processing/validate-pdf-signature'
|
|
719
|
+
|
|
720
|
+
# query parameters
|
|
721
|
+
query_params = opts[:query_params] || {}
|
|
722
|
+
|
|
723
|
+
# header parameters
|
|
724
|
+
header_params = opts[:header_params] || {}
|
|
725
|
+
# HTTP header 'Accept' (if needed)
|
|
726
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
727
|
+
# HTTP header 'Content-Type'
|
|
728
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
729
|
+
if !content_type.nil?
|
|
730
|
+
header_params['Content-Type'] = content_type
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
# form parameters
|
|
734
|
+
form_params = opts[:form_params] || {}
|
|
735
|
+
form_params['pdf_file'] = pdf_file
|
|
736
|
+
|
|
737
|
+
# http body (model)
|
|
738
|
+
post_body = opts[:debug_body]
|
|
739
|
+
|
|
740
|
+
# return_type
|
|
741
|
+
return_type = opts[:debug_return_type] || 'Object'
|
|
742
|
+
|
|
743
|
+
# auth_names
|
|
744
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
745
|
+
|
|
746
|
+
new_options = opts.merge(
|
|
747
|
+
:operation => :"InvoiceProcessingApi.validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post",
|
|
748
|
+
:header_params => header_params,
|
|
749
|
+
:query_params => query_params,
|
|
750
|
+
:form_params => form_params,
|
|
751
|
+
:body => post_body,
|
|
752
|
+
:auth_names => auth_names,
|
|
753
|
+
:return_type => return_type
|
|
754
|
+
)
|
|
755
|
+
|
|
756
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
757
|
+
if @api_client.config.debugging
|
|
758
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
759
|
+
end
|
|
760
|
+
return data, status_code, headers
|
|
761
|
+
end
|
|
762
|
+
|
|
763
|
+
# Validate an existing Factur-X XML
|
|
764
|
+
# Validates a Factur-X XML file against Schematron business rules according to EN 16931 standard. ## Applied Standard **Schematron ISO/IEC 19757-3**: Business rules validation language for XML - Semantic validation (beyond XSD syntax) - European EN 16931 business rules - French-specific Factur-X rules - Arithmetic calculations and data consistency ## Profiles and validated rules ### MINIMUM (45 rules) - Unique invoice identifier - Dates (issue, due date) - Party identifiers (SIRET/SIREN) - Total gross amount ### BASIC (102 rules) - All MINIMUM rules - Detailed invoice lines - Basic VAT calculations - Payment methods - References (order, contract) ### EN16931 (178 rules) - All BASIC rules - **European rules (BR-xx)**: 81 business rules - **French rules (FR-xx)**: 12 France-specific rules - **Advanced calculations (CR-xx)**: 32 calculation rules - **Standardized codes (CL-xx)**: 52 code lists ### EXTENDED (210+ rules) - All EN16931 rules - Logistics information - Advanced accounting data - Multiple external references ## Checks performed ### 1. Syntax validation - Correct XML parsing (UTF-8, well-formed) - UN/CEFACT namespaces present - Hierarchical structure respected ### 2. Business rules (BR-xx) Examples: - `BR-1`: Invoice total must equal sum of line totals + document-level amounts - `BR-CO-10`: Sum of VAT base amounts must equal invoice net total - `BR-16`: Invoice currency code must be in ISO 4217 list ### 3. French rules (FR-xx) Examples: - `FR-1`: Supplier SIRET must have 14 digits - `FR-2`: Customer SIRET must have 14 digits (if present) - `FR-5`: Intra-EU VAT number must be in format FRxx999999999 ### 4. Calculation rules (CR-xx) - Net + VAT = Gross amounts - Sum of lines = Document total - Discounts and surcharges correctly applied - Compliant rounding (2 decimals for amounts) ### 5. Standardized codes (CL-xx) - ISO 3166-1 alpha-2 country codes - ISO 4217 currency codes - UN/ECE Rec 20 measurement units - VAT codes (types, categories, exemptions) - SchemeID for identifiers (0002=SIREN, 0009=SIRET, etc.) ## Validation process 1. **XSLT loading**: Schematron file converted to XSLT (Saxon-HE) 2. **Transformation**: Rules applied to XML 3. **Results analysis**: Extraction of errors (`failed-assert`) and warnings (`successful-report`) 4. **Report**: Structured list of non-conformities ## Responses **200 OK**: Compliant XML ```json { \"message\": \"XML is compliant with EN16931 profile\" } ``` **400 Bad Request**: Non-compliant XML ```json { \"detail\": [ \"[BR-1] Invoice total (120.00) does not match calculated sum (100.00 + 20.00)\", \"[FR-1] Supplier SIRET must contain exactly 14 digits\" ] } ``` ## Use cases - **Pre-validation**: Verify XML before PDF/A integration - **Debugging**: Precisely identify generation errors - **Testing**: Validate test or example XMLs - **Compliance**: Ensure European and French rules are met - **Development**: Quick testing without PDF generation ## Processing time - MINIMUM profile: ~0.5 second - EN16931 profile: ~1-2 seconds - EXTENDED profile: ~2-3 seconds
|
|
765
|
+
# @param xml_file [File] Factur-X XML file to validate (.xml format).
|
|
766
|
+
# @param [Hash] opts the optional parameters
|
|
767
|
+
# @option opts [APIProfile] :profile Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
768
|
+
# @return [ValidationSuccessResponse]
|
|
769
|
+
def validate_xml_api_v1_processing_validate_xml_post(xml_file, opts = {})
|
|
770
|
+
data, _status_code, _headers = validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts)
|
|
771
|
+
data
|
|
772
|
+
end
|
|
773
|
+
|
|
774
|
+
# Validate an existing Factur-X XML
|
|
775
|
+
# Validates a Factur-X XML file against Schematron business rules according to EN 16931 standard. ## Applied Standard **Schematron ISO/IEC 19757-3**: Business rules validation language for XML - Semantic validation (beyond XSD syntax) - European EN 16931 business rules - French-specific Factur-X rules - Arithmetic calculations and data consistency ## Profiles and validated rules ### MINIMUM (45 rules) - Unique invoice identifier - Dates (issue, due date) - Party identifiers (SIRET/SIREN) - Total gross amount ### BASIC (102 rules) - All MINIMUM rules - Detailed invoice lines - Basic VAT calculations - Payment methods - References (order, contract) ### EN16931 (178 rules) - All BASIC rules - **European rules (BR-xx)**: 81 business rules - **French rules (FR-xx)**: 12 France-specific rules - **Advanced calculations (CR-xx)**: 32 calculation rules - **Standardized codes (CL-xx)**: 52 code lists ### EXTENDED (210+ rules) - All EN16931 rules - Logistics information - Advanced accounting data - Multiple external references ## Checks performed ### 1. Syntax validation - Correct XML parsing (UTF-8, well-formed) - UN/CEFACT namespaces present - Hierarchical structure respected ### 2. Business rules (BR-xx) Examples: - `BR-1`: Invoice total must equal sum of line totals + document-level amounts - `BR-CO-10`: Sum of VAT base amounts must equal invoice net total - `BR-16`: Invoice currency code must be in ISO 4217 list ### 3. French rules (FR-xx) Examples: - `FR-1`: Supplier SIRET must have 14 digits - `FR-2`: Customer SIRET must have 14 digits (if present) - `FR-5`: Intra-EU VAT number must be in format FRxx999999999 ### 4. Calculation rules (CR-xx) - Net + VAT = Gross amounts - Sum of lines = Document total - Discounts and surcharges correctly applied - Compliant rounding (2 decimals for amounts) ### 5. Standardized codes (CL-xx) - ISO 3166-1 alpha-2 country codes - ISO 4217 currency codes - UN/ECE Rec 20 measurement units - VAT codes (types, categories, exemptions) - SchemeID for identifiers (0002=SIREN, 0009=SIRET, etc.) ## Validation process 1. **XSLT loading**: Schematron file converted to XSLT (Saxon-HE) 2. **Transformation**: Rules applied to XML 3. **Results analysis**: Extraction of errors (`failed-assert`) and warnings (`successful-report`) 4. **Report**: Structured list of non-conformities ## Responses **200 OK**: Compliant XML ```json { \"message\": \"XML is compliant with EN16931 profile\" } ``` **400 Bad Request**: Non-compliant XML ```json { \"detail\": [ \"[BR-1] Invoice total (120.00) does not match calculated sum (100.00 + 20.00)\", \"[FR-1] Supplier SIRET must contain exactly 14 digits\" ] } ``` ## Use cases - **Pre-validation**: Verify XML before PDF/A integration - **Debugging**: Precisely identify generation errors - **Testing**: Validate test or example XMLs - **Compliance**: Ensure European and French rules are met - **Development**: Quick testing without PDF generation ## Processing time - MINIMUM profile: ~0.5 second - EN16931 profile: ~1-2 seconds - EXTENDED profile: ~2-3 seconds
|
|
776
|
+
# @param xml_file [File] Factur-X XML file to validate (.xml format).
|
|
777
|
+
# @param [Hash] opts the optional parameters
|
|
778
|
+
# @option opts [APIProfile] :profile Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
779
|
+
# @return [Array<(ValidationSuccessResponse, Integer, Hash)>] ValidationSuccessResponse data, response status code and response headers
|
|
780
|
+
def validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts = {})
|
|
781
|
+
if @api_client.config.debugging
|
|
782
|
+
@api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_xml_api_v1_processing_validate_xml_post ...'
|
|
783
|
+
end
|
|
784
|
+
# verify the required parameter 'xml_file' is set
|
|
785
|
+
if @api_client.config.client_side_validation && xml_file.nil?
|
|
786
|
+
fail ArgumentError, "Missing the required parameter 'xml_file' when calling InvoiceProcessingApi.validate_xml_api_v1_processing_validate_xml_post"
|
|
787
|
+
end
|
|
788
|
+
# resource path
|
|
789
|
+
local_var_path = '/api/v1/processing/validate-xml'
|
|
790
|
+
|
|
791
|
+
# query parameters
|
|
792
|
+
query_params = opts[:query_params] || {}
|
|
793
|
+
|
|
794
|
+
# header parameters
|
|
795
|
+
header_params = opts[:header_params] || {}
|
|
796
|
+
# HTTP header 'Accept' (if needed)
|
|
797
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
798
|
+
# HTTP header 'Content-Type'
|
|
799
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
800
|
+
if !content_type.nil?
|
|
801
|
+
header_params['Content-Type'] = content_type
|
|
802
|
+
end
|
|
803
|
+
|
|
804
|
+
# form parameters
|
|
805
|
+
form_params = opts[:form_params] || {}
|
|
806
|
+
form_params['xml_file'] = xml_file
|
|
807
|
+
form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil?
|
|
808
|
+
|
|
809
|
+
# http body (model)
|
|
810
|
+
post_body = opts[:debug_body]
|
|
811
|
+
|
|
812
|
+
# return_type
|
|
813
|
+
return_type = opts[:debug_return_type] || 'ValidationSuccessResponse'
|
|
814
|
+
|
|
815
|
+
# auth_names
|
|
816
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
817
|
+
|
|
818
|
+
new_options = opts.merge(
|
|
819
|
+
:operation => :"InvoiceProcessingApi.validate_xml_api_v1_processing_validate_xml_post",
|
|
820
|
+
:header_params => header_params,
|
|
821
|
+
:query_params => query_params,
|
|
822
|
+
:form_params => form_params,
|
|
823
|
+
:body => post_body,
|
|
824
|
+
:auth_names => auth_names,
|
|
825
|
+
:return_type => return_type
|
|
826
|
+
)
|
|
827
|
+
|
|
828
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
829
|
+
if @api_client.config.debugging
|
|
830
|
+
@api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_xml_api_v1_processing_validate_xml_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
831
|
+
end
|
|
832
|
+
return data, status_code, headers
|
|
833
|
+
end
|
|
834
|
+
end
|
|
835
|
+
end
|