factpulse 2.0.37__py3-none-any.whl → 3.0.23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of factpulse might be problematic. Click here for more details.
- factpulse/__init__.py +542 -197
- factpulse/api/__init__.py +7 -4
- factpulse/api/afnorpdppa_api.py +49 -47
- factpulse/api/afnorpdppa_directory_service_api.py +1225 -310
- factpulse/api/afnorpdppa_flow_service_api.py +212 -81
- factpulse/api/chorus_pro_api.py +271 -218
- factpulse/api/document_conversion_api.py +1222 -0
- factpulse/api/downloads_api.py +1171 -0
- factpulse/api/e_reporting_api.py +3254 -0
- factpulse/api/{sant_api.py → health_api.py} +29 -22
- factpulse/api/invoice_processing_api.py +3634 -0
- factpulse/api/{vrification_pdfxml_api.py → pdfxml_verification_api.py} +331 -252
- factpulse/api/{utilisateur_api.py → user_api.py} +21 -17
- factpulse/api_client.py +4 -3
- factpulse/configuration.py +11 -6
- factpulse/exceptions.py +3 -2
- factpulse/models/__init__.py +265 -95
- factpulse/models/accept_language.py +38 -0
- factpulse/models/acknowledgment_status.py +39 -0
- factpulse/models/additional_document.py +116 -0
- factpulse/models/afnor_acknowledgement.py +100 -0
- factpulse/models/afnor_acknowledgement_detail.py +105 -0
- factpulse/models/afnor_address_edit.py +111 -0
- factpulse/models/afnor_address_patch.py +141 -0
- factpulse/models/afnor_address_put.py +129 -0
- factpulse/models/afnor_address_read.py +113 -0
- factpulse/models/afnor_algorithm.py +41 -0
- factpulse/models/afnor_contains_operator.py +37 -0
- factpulse/models/afnor_create_directory_line_body.py +98 -0
- factpulse/models/afnor_create_directory_line_body_addressing_information.py +122 -0
- factpulse/models/afnor_create_directory_line_body_period.py +91 -0
- factpulse/models/afnor_create_routing_code_body.py +153 -0
- factpulse/models/afnor_credentials.py +107 -0
- factpulse/models/afnor_destination.py +127 -0
- factpulse/models/afnor_diffusion_status.py +38 -0
- factpulse/models/afnor_directory_line_field.py +42 -0
- factpulse/models/afnor_directory_line_payload_history_legal_unit_facility_routing_code.py +139 -0
- factpulse/models/afnor_directory_line_payload_history_legal_unit_facility_routing_code_platform.py +92 -0
- factpulse/models/afnor_directory_line_payload_history_legal_unit_facility_routing_code_routing_code.py +134 -0
- factpulse/models/afnor_directory_line_post201_response.py +94 -0
- factpulse/models/afnor_directory_line_search_post200_response.py +104 -0
- factpulse/models/afnor_entity_type.py +38 -0
- factpulse/models/afnor_error.py +97 -0
- factpulse/models/afnor_facility_administrative_status.py +38 -0
- factpulse/models/afnor_facility_nature.py +38 -0
- factpulse/models/afnor_facility_payload_history.py +140 -0
- factpulse/models/afnor_facility_payload_history_ule_b2g_additional_data.py +98 -0
- factpulse/models/afnor_facility_payload_included.py +134 -0
- factpulse/models/afnor_facility_type.py +38 -0
- factpulse/models/afnor_flow.py +129 -0
- factpulse/models/afnor_flow_ack_status.py +39 -0
- factpulse/models/afnor_flow_direction.py +38 -0
- factpulse/models/afnor_flow_info.py +112 -0
- factpulse/models/afnor_flow_profile.py +39 -0
- factpulse/models/afnor_flow_syntax.py +41 -0
- factpulse/models/afnor_flow_type.py +49 -0
- factpulse/models/afnor_full_flow_info.py +117 -0
- factpulse/models/afnor_health_check_response.py +92 -0
- factpulse/models/afnor_legal_unit_administrative_status.py +38 -0
- factpulse/models/afnor_legal_unit_payload_history.py +107 -0
- factpulse/models/afnor_legal_unit_payload_included.py +107 -0
- factpulse/models/afnor_legal_unit_payload_included_no_siren.py +95 -0
- factpulse/models/afnor_platform_status.py +38 -0
- factpulse/models/afnor_processing_rule.py +42 -0
- factpulse/models/afnor_reason_code.py +141 -0
- factpulse/models/afnor_reason_code_enum.py +51 -0
- factpulse/models/afnor_recipient_platform_type.py +38 -0
- factpulse/models/afnor_result.py +127 -0
- factpulse/models/afnor_routing_code_administrative_status.py +38 -0
- factpulse/models/afnor_routing_code_field.py +44 -0
- factpulse/models/afnor_routing_code_payload_history_legal_unit_facility.py +158 -0
- factpulse/models/afnor_routing_code_post201_response.py +113 -0
- factpulse/models/afnor_routing_code_search.py +122 -0
- factpulse/models/afnor_routing_code_search_filters.py +128 -0
- factpulse/models/afnor_routing_code_search_filters_administrative_status.py +92 -0
- factpulse/models/afnor_routing_code_search_filters_routing_code_name.py +102 -0
- factpulse/models/afnor_routing_code_search_filters_routing_identifier.py +102 -0
- factpulse/models/afnor_routing_code_search_post200_response.py +104 -0
- factpulse/models/afnor_routing_code_search_sorting_inner.py +92 -0
- factpulse/models/afnor_search_directory_line.py +109 -0
- factpulse/models/afnor_search_directory_line_filters.py +116 -0
- factpulse/models/afnor_search_directory_line_filters_addressing_identifier.py +92 -0
- factpulse/models/afnor_search_directory_line_filters_addressing_suffix.py +92 -0
- factpulse/models/afnor_search_directory_line_sorting_inner.py +92 -0
- factpulse/models/afnor_search_flow_content.py +104 -0
- factpulse/models/afnor_search_flow_filters.py +106 -0
- factpulse/models/afnor_search_flow_params.py +95 -0
- factpulse/models/afnor_search_siren.py +109 -0
- factpulse/models/afnor_search_siren_filters.py +110 -0
- factpulse/models/afnor_search_siren_filters_administrative_status.py +92 -0
- factpulse/models/afnor_search_siren_filters_business_name.py +92 -0
- factpulse/models/afnor_search_siren_filters_entity_type.py +92 -0
- factpulse/models/afnor_search_siren_filters_siren.py +102 -0
- factpulse/models/afnor_search_siren_sorting_inner.py +92 -0
- factpulse/models/afnor_search_siret.py +122 -0
- factpulse/models/afnor_search_siret_filters.py +140 -0
- factpulse/models/afnor_search_siret_filters_address_lines.py +92 -0
- factpulse/models/afnor_search_siret_filters_administrative_status.py +92 -0
- factpulse/models/afnor_search_siret_filters_country_subdivision.py +92 -0
- factpulse/models/afnor_search_siret_filters_facility_type.py +92 -0
- factpulse/models/afnor_search_siret_filters_locality.py +92 -0
- factpulse/models/afnor_search_siret_filters_name.py +92 -0
- factpulse/models/afnor_search_siret_filters_postal_code.py +102 -0
- factpulse/models/afnor_search_siret_filters_siret.py +102 -0
- factpulse/models/afnor_search_siret_sorting_inner.py +92 -0
- factpulse/models/afnor_siren_field.py +41 -0
- factpulse/models/afnor_siren_search_post200_response.py +104 -0
- factpulse/models/afnor_siret_field.py +50 -0
- factpulse/models/afnor_siret_search_post200_response.py +104 -0
- factpulse/models/afnor_sorting_order.py +38 -0
- factpulse/models/afnor_strict_operator.py +37 -0
- factpulse/models/afnor_update_patch_directory_line_body.py +89 -0
- factpulse/models/afnor_update_patch_routing_code_body.py +120 -0
- factpulse/models/afnor_update_put_routing_code_body.py +114 -0
- factpulse/models/afnor_webhook_callback_content.py +92 -0
- factpulse/models/aggregated_payment_input.py +106 -0
- factpulse/models/aggregated_transaction_input.py +136 -0
- factpulse/models/allowance_charge.py +150 -0
- factpulse/models/allowance_charge_reason_code.py +74 -0
- factpulse/models/allowance_reason_code.py +43 -0
- factpulse/models/allowance_total_amount.py +146 -0
- factpulse/models/amount.py +140 -0
- factpulse/models/amount1.py +140 -0
- factpulse/models/amount_due.py +140 -0
- factpulse/models/api_error.py +6 -5
- factpulse/models/api_profile.py +41 -0
- factpulse/models/async_task_status.py +98 -0
- factpulse/models/base_amount.py +146 -0
- factpulse/models/bounding_box_schema.py +11 -10
- factpulse/models/buyercountry.py +137 -0
- factpulse/models/celery_status.py +41 -0
- factpulse/models/certificate_info_response.py +25 -24
- factpulse/models/charge_total_amount.py +146 -0
- factpulse/models/chorus_pro_credentials.py +14 -13
- factpulse/models/chorus_pro_destination.py +109 -0
- factpulse/models/chorus_pro_result.py +102 -0
- factpulse/models/contact.py +114 -0
- factpulse/models/convert_resume_request.py +88 -0
- factpulse/models/convert_success_response.py +127 -0
- factpulse/models/convert_validation_failed_response.py +121 -0
- factpulse/models/country_code.py +206 -0
- factpulse/models/create_aggregated_report_request.py +170 -0
- factpulse/models/create_e_reporting_request.py +173 -0
- factpulse/models/currency.py +137 -0
- factpulse/models/currency_code.py +89 -0
- factpulse/models/delivery_party.py +122 -0
- factpulse/models/destination.py +28 -27
- factpulse/models/directory_line_include.py +40 -0
- factpulse/models/doc_type.py +40 -0
- factpulse/models/document_type_info.py +92 -0
- factpulse/models/e_reporting_flow_type.py +40 -0
- factpulse/models/e_reporting_validation_error.py +97 -0
- factpulse/models/electronic_address.py +91 -0
- factpulse/models/enriched_invoice_info.py +134 -0
- factpulse/models/error_level.py +3 -2
- factpulse/models/error_source.py +3 -2
- factpulse/models/extraction_info.py +94 -0
- factpulse/models/factur_x_invoice.py +321 -0
- factpulse/models/factur_xpdf_info.py +92 -0
- factpulse/models/facture_electronique_rest_api_schemas_ereporting_invoice_type_code.py +41 -0
- factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.py +116 -0
- factpulse/models/field_status.py +41 -0
- factpulse/models/file_info.py +95 -0
- factpulse/models/files_info.py +107 -0
- factpulse/models/flow_direction.py +38 -0
- factpulse/models/flow_profile.py +39 -0
- factpulse/models/flow_summary.py +132 -0
- factpulse/models/flow_syntax.py +41 -0
- factpulse/models/flow_type.py +49 -0
- factpulse/models/generate_aggregated_report_response.py +100 -0
- factpulse/models/generate_certificate_request.py +27 -26
- factpulse/models/generate_certificate_response.py +16 -15
- factpulse/models/generate_e_reporting_response.py +96 -0
- factpulse/models/get_chorus_pro_id_request.py +101 -0
- factpulse/models/get_chorus_pro_id_response.py +99 -0
- factpulse/models/get_invoice_request.py +99 -0
- factpulse/models/get_invoice_response.py +143 -0
- factpulse/models/get_structure_request.py +101 -0
- factpulse/models/get_structure_response.py +143 -0
- factpulse/models/global_allowance_amount.py +140 -0
- factpulse/models/gross_unit_price.py +146 -0
- factpulse/models/http_validation_error.py +3 -2
- factpulse/models/incoming_invoice.py +175 -0
- factpulse/models/incoming_supplier.py +145 -0
- factpulse/models/invoice_format.py +39 -0
- factpulse/models/invoice_input.py +179 -0
- factpulse/models/invoice_line.py +370 -0
- factpulse/models/invoice_line_allowance_amount.py +146 -0
- factpulse/models/invoice_note.py +95 -0
- factpulse/models/invoice_payment_input.py +110 -0
- factpulse/models/invoice_references.py +195 -0
- factpulse/models/invoice_status.py +97 -0
- factpulse/models/invoice_totals.py +178 -0
- factpulse/models/invoice_totals_prepayment.py +146 -0
- factpulse/models/invoice_type_code.py +52 -0
- factpulse/models/invoice_type_code_output.py +52 -0
- factpulse/models/invoicing_framework.py +111 -0
- factpulse/models/invoicing_framework_code.py +40 -0
- factpulse/models/line_net_amount.py +146 -0
- factpulse/models/line_sub_type.py +39 -0
- factpulse/models/line_total_amount.py +146 -0
- factpulse/models/location_inner.py +139 -0
- factpulse/models/mandatory_note_schema.py +125 -0
- factpulse/models/manual_rate.py +140 -0
- factpulse/models/manual_vat_rate.py +140 -0
- factpulse/models/missing_field.py +108 -0
- factpulse/models/operation_nature.py +50 -0
- factpulse/models/output_format.py +38 -0
- factpulse/models/page_dimensions_schema.py +90 -0
- factpulse/models/payee.py +169 -0
- factpulse/models/payment_amount_by_rate.py +98 -0
- factpulse/models/payment_card.py +100 -0
- factpulse/models/payment_means.py +42 -0
- factpulse/models/pdf_validation_result_api.py +170 -0
- factpulse/models/pdp_credentials.py +16 -15
- factpulse/models/percentage.py +146 -0
- factpulse/models/postal_address.py +135 -0
- factpulse/models/price_allowance_amount.py +146 -0
- factpulse/models/price_basis_quantity.py +146 -0
- factpulse/models/processing_options.py +95 -0
- factpulse/models/processing_rule.py +42 -0
- factpulse/models/product_characteristic.py +90 -0
- factpulse/models/product_classification.py +102 -0
- factpulse/models/quantity.py +140 -0
- factpulse/models/rate.py +140 -0
- factpulse/models/rate1.py +140 -0
- factpulse/models/recipient.py +168 -0
- factpulse/models/report_period.py +91 -0
- factpulse/models/report_sender.py +98 -0
- factpulse/models/rounding_amount.py +146 -0
- factpulse/models/routing_code_include.py +38 -0
- factpulse/models/schematron_validation_error.py +128 -0
- factpulse/models/scheme_id.py +18 -4
- factpulse/models/search_flow_request.py +144 -0
- factpulse/models/search_flow_response.py +102 -0
- factpulse/models/search_services_response.py +102 -0
- factpulse/models/search_structure_request.py +120 -0
- factpulse/models/search_structure_response.py +102 -0
- factpulse/models/sellercountry.py +137 -0
- factpulse/models/signature_info.py +7 -6
- factpulse/models/signature_info_api.py +123 -0
- factpulse/models/signature_parameters.py +134 -0
- factpulse/models/simplified_invoice_data.py +151 -0
- factpulse/models/siret_include.py +37 -0
- factpulse/models/structure_info.py +15 -14
- factpulse/models/structure_parameters.py +92 -0
- factpulse/models/structure_service.py +94 -0
- factpulse/models/submission_mode.py +39 -0
- factpulse/models/submit_aggregated_report_request.py +127 -0
- factpulse/models/submit_complete_invoice_request.py +117 -0
- factpulse/models/submit_complete_invoice_response.py +146 -0
- factpulse/models/submit_e_reporting_request.py +127 -0
- factpulse/models/submit_e_reporting_response.py +117 -0
- factpulse/models/submit_flow_request.py +124 -0
- factpulse/models/submit_flow_response.py +110 -0
- factpulse/models/submit_gross_amount.py +140 -0
- factpulse/models/submit_invoice_request.py +177 -0
- factpulse/models/submit_invoice_response.py +104 -0
- factpulse/models/submit_net_amount.py +140 -0
- factpulse/models/submit_vat_amount.py +140 -0
- factpulse/models/supplementary_attachment.py +96 -0
- factpulse/models/supplier.py +226 -0
- factpulse/models/task_response.py +88 -0
- factpulse/models/tax_breakdown_input.py +104 -0
- factpulse/models/tax_due_date_type.py +42 -0
- factpulse/models/tax_representative.py +96 -0
- factpulse/models/taxable_amount.py +140 -0
- factpulse/models/taxableamount.py +140 -0
- factpulse/models/taxamount.py +140 -0
- factpulse/models/taxamount1.py +140 -0
- factpulse/models/taxamount2.py +140 -0
- factpulse/models/taxexclusiveamount.py +140 -0
- factpulse/models/taxexclusiveamount1.py +140 -0
- factpulse/models/total_gross_amount.py +140 -0
- factpulse/models/total_net_amount.py +140 -0
- factpulse/models/total_vat_amount.py +140 -0
- factpulse/models/transaction_category.py +40 -0
- factpulse/models/transmission_type_code.py +38 -0
- factpulse/models/unit_net_price.py +140 -0
- factpulse/models/unit_of_measure.py +42 -0
- factpulse/models/validate_e_reporting_request.py +92 -0
- factpulse/models/validate_e_reporting_response.py +113 -0
- factpulse/models/validation_error.py +6 -5
- factpulse/models/validation_error_detail.py +7 -6
- factpulse/models/validation_error_response.py +88 -0
- factpulse/models/validation_info.py +106 -0
- factpulse/models/validation_success_response.py +88 -0
- factpulse/models/vat_accounting_code.py +40 -0
- factpulse/models/vat_amount.py +140 -0
- factpulse/models/vat_category.py +45 -0
- factpulse/models/vat_line.py +141 -0
- factpulse/models/vat_point_date_code.py +39 -0
- factpulse/models/vat_rate.py +146 -0
- factpulse/models/verification_success_response.py +136 -0
- factpulse/models/verified_field_schema.py +130 -0
- factpulse/rest.py +3 -2
- factpulse-3.0.23.dist-info/METADATA +294 -0
- factpulse-3.0.23.dist-info/RECORD +306 -0
- {factpulse-2.0.37.dist-info → factpulse-3.0.23.dist-info}/licenses/LICENSE +1 -1
- factpulse_helpers/__init__.py +34 -34
- factpulse_helpers/client.py +1020 -795
- factpulse_helpers/exceptions.py +68 -68
- factpulse/api/traitement_facture_api.py +0 -3437
- factpulse/models/adresse_electronique.py +0 -90
- factpulse/models/adresse_postale.py +0 -120
- factpulse/models/cadre_de_facturation.py +0 -110
- factpulse/models/categorie_tva.py +0 -44
- factpulse/models/champ_verifie_schema.py +0 -129
- factpulse/models/code_cadre_facturation.py +0 -39
- factpulse/models/code_raison_reduction.py +0 -42
- factpulse/models/consulter_facture_request.py +0 -98
- factpulse/models/consulter_facture_response.py +0 -142
- factpulse/models/consulter_structure_request.py +0 -100
- factpulse/models/consulter_structure_response.py +0 -142
- factpulse/models/credentials_afnor.py +0 -106
- factpulse/models/credentials_chorus_pro.py +0 -115
- factpulse/models/destinataire.py +0 -130
- factpulse/models/destination_afnor.py +0 -127
- factpulse/models/destination_chorus_pro.py +0 -108
- factpulse/models/dimension_page_schema.py +0 -89
- factpulse/models/direction_flux.py +0 -37
- factpulse/models/donnees_facture_simplifiees.py +0 -124
- factpulse/models/facture_enrichie_info.py +0 -133
- factpulse/models/facture_entrante.py +0 -196
- factpulse/models/facture_factur_x.py +0 -183
- factpulse/models/flux_resume.py +0 -131
- factpulse/models/format_facture.py +0 -38
- factpulse/models/format_sortie.py +0 -37
- factpulse/models/fournisseur.py +0 -153
- factpulse/models/fournisseur_entrant.py +0 -144
- factpulse/models/information_signature_api.py +0 -122
- factpulse/models/ligne_de_poste.py +0 -183
- factpulse/models/ligne_de_poste_montant_remise_ht.py +0 -145
- factpulse/models/ligne_de_poste_taux_tva_manuel.py +0 -145
- factpulse/models/ligne_de_tva.py +0 -132
- factpulse/models/mode_depot.py +0 -38
- factpulse/models/mode_paiement.py +0 -41
- factpulse/models/montant_a_payer.py +0 -139
- factpulse/models/montant_base_ht.py +0 -139
- factpulse/models/montant_ht_total.py +0 -139
- factpulse/models/montant_remise_globale_ttc.py +0 -139
- factpulse/models/montant_total.py +0 -133
- factpulse/models/montant_total_acompte.py +0 -145
- factpulse/models/montant_total_ligne_ht.py +0 -139
- factpulse/models/montant_ttc_total.py +0 -139
- factpulse/models/montant_tva.py +0 -139
- factpulse/models/montant_tva_ligne.py +0 -139
- factpulse/models/montant_tva_total.py +0 -139
- factpulse/models/montant_unitaire_ht.py +0 -139
- factpulse/models/nature_operation.py +0 -49
- factpulse/models/note.py +0 -94
- factpulse/models/note_obligatoire_schema.py +0 -124
- factpulse/models/obtenir_id_chorus_pro_request.py +0 -100
- factpulse/models/obtenir_id_chorus_pro_response.py +0 -98
- factpulse/models/options_processing.py +0 -94
- factpulse/models/parametres_signature.py +0 -133
- factpulse/models/parametres_structure.py +0 -91
- factpulse/models/pdf_factur_x_info.py +0 -91
- factpulse/models/piece_jointe_complementaire.py +0 -95
- factpulse/models/profil_api.py +0 -39
- factpulse/models/profil_flux.py +0 -38
- factpulse/models/quantite.py +0 -139
- factpulse/models/rechercher_services_response.py +0 -101
- factpulse/models/rechercher_structure_request.py +0 -119
- factpulse/models/rechercher_structure_response.py +0 -101
- factpulse/models/references.py +0 -124
- factpulse/models/reponse_healthcheck_afnor.py +0 -91
- factpulse/models/reponse_recherche_flux.py +0 -101
- factpulse/models/reponse_soumission_flux.py +0 -109
- factpulse/models/reponse_tache.py +0 -87
- factpulse/models/reponse_validation_erreur.py +0 -87
- factpulse/models/reponse_validation_succes.py +0 -87
- factpulse/models/reponse_verification_succes.py +0 -135
- factpulse/models/requete_recherche_flux.py +0 -143
- factpulse/models/requete_soumission_flux.py +0 -123
- factpulse/models/resultat_afnor.py +0 -105
- factpulse/models/resultat_chorus_pro.py +0 -101
- factpulse/models/resultat_validation_pdfapi.py +0 -169
- factpulse/models/service_structure.py +0 -93
- factpulse/models/soumettre_facture_complete_request.py +0 -116
- factpulse/models/soumettre_facture_complete_response.py +0 -145
- factpulse/models/soumettre_facture_request.py +0 -176
- factpulse/models/soumettre_facture_response.py +0 -103
- factpulse/models/statut_acquittement.py +0 -38
- factpulse/models/statut_celery.py +0 -40
- factpulse/models/statut_champ_api.py +0 -40
- factpulse/models/statut_facture.py +0 -96
- factpulse/models/statut_tache.py +0 -97
- factpulse/models/syntaxe_flux.py +0 -40
- factpulse/models/tauxmanuel.py +0 -139
- factpulse/models/type_document.py +0 -40
- factpulse/models/type_facture.py +0 -37
- factpulse/models/type_flux.py +0 -40
- factpulse/models/type_tva.py +0 -39
- factpulse/models/unite.py +0 -41
- factpulse/models/validation_error_loc_inner.py +0 -138
- factpulse-2.0.37.dist-info/METADATA +0 -292
- factpulse-2.0.37.dist-info/RECORD +0 -134
- {factpulse-2.0.37.dist-info → factpulse-3.0.23.dist-info}/WHEEL +0 -0
- {factpulse-2.0.37.dist-info → factpulse-3.0.23.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,3634 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FactPulse REST API
|
|
5
|
+
|
|
6
|
+
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://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://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://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://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://factpulse.fr/api/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://factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: contact@factpulse.fr
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
import warnings
|
|
16
|
+
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
17
|
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
18
|
+
from typing_extensions import Annotated
|
|
19
|
+
|
|
20
|
+
from pydantic import Field, StrictBool, StrictBytes, StrictStr
|
|
21
|
+
from typing import Any, Optional, Tuple, Union
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from factpulse.models.async_task_status import AsyncTaskStatus
|
|
24
|
+
from factpulse.models.generate_certificate_request import GenerateCertificateRequest
|
|
25
|
+
from factpulse.models.generate_certificate_response import GenerateCertificateResponse
|
|
26
|
+
from factpulse.models.pdf_validation_result_api import PDFValidationResultAPI
|
|
27
|
+
from factpulse.models.submit_complete_invoice_request import SubmitCompleteInvoiceRequest
|
|
28
|
+
from factpulse.models.submit_complete_invoice_response import SubmitCompleteInvoiceResponse
|
|
29
|
+
from factpulse.models.task_response import TaskResponse
|
|
30
|
+
from factpulse.models.validation_success_response import ValidationSuccessResponse
|
|
31
|
+
|
|
32
|
+
from factpulse.api_client import ApiClient, RequestSerialized
|
|
33
|
+
from factpulse.api_response import ApiResponse
|
|
34
|
+
from factpulse.rest import RESTResponseType
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class InvoiceProcessingApi:
|
|
38
|
+
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
39
|
+
Ref: https://openapi-generator.tech
|
|
40
|
+
|
|
41
|
+
Do not edit the class manually.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
def __init__(self, api_client=None) -> None:
|
|
45
|
+
if api_client is None:
|
|
46
|
+
api_client = ApiClient.get_default()
|
|
47
|
+
self.api_client = api_client
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@validate_call
|
|
51
|
+
def generate_invoice_api_v1_processing_generate_invoice_post(
|
|
52
|
+
self,
|
|
53
|
+
invoice_data: Annotated[StrictStr, Field(description="Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FacturXInvoice structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! ")],
|
|
54
|
+
profile: Annotated[Optional[Any], Field(description="Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.")] = None,
|
|
55
|
+
output_format: Annotated[Optional[Any], Field(description="Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).")] = None,
|
|
56
|
+
auto_enrich: Annotated[Optional[StrictBool], Field(description="🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)")] = None,
|
|
57
|
+
source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
|
|
58
|
+
callback_url: Optional[StrictStr] = None,
|
|
59
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
60
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
61
|
+
_request_timeout: Union[
|
|
62
|
+
None,
|
|
63
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
64
|
+
Tuple[
|
|
65
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
66
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
67
|
+
]
|
|
68
|
+
] = None,
|
|
69
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
70
|
+
_content_type: Optional[StrictStr] = None,
|
|
71
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
72
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
73
|
+
) -> TaskResponse:
|
|
74
|
+
"""Generate a Factur-X invoice
|
|
75
|
+
|
|
76
|
+
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 supplier SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"supplier\": { \"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 - `supplier.siret`: Supplier's SIRET (14 digits) - `supplier.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 ## Webhook notification (recommended) Instead of polling, you can receive a webhook notification when the task completes: ``` callback_url=https://your-server.com/webhook ``` The webhook will POST a JSON payload with: - `event_type`: `generation.completed` or `generation.failed` - `data.task_id`: The Celery task ID - `data.content_b64` or `data.xml_content`: The generated content - `X-Webhook-Signature` header for HMAC verification See `/docs/WEBHOOKS.md` for full documentation. ## 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.
|
|
77
|
+
|
|
78
|
+
:param invoice_data: Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FacturXInvoice structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! (required)
|
|
79
|
+
:type invoice_data: str
|
|
80
|
+
:param profile: Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
81
|
+
:type profile: APIProfile
|
|
82
|
+
:param output_format: Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
|
|
83
|
+
:type output_format: OutputFormat
|
|
84
|
+
:param auto_enrich: 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
|
|
85
|
+
:type auto_enrich: bool
|
|
86
|
+
:param source_pdf:
|
|
87
|
+
:type source_pdf: bytearray
|
|
88
|
+
:param callback_url:
|
|
89
|
+
:type callback_url: str
|
|
90
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
91
|
+
:type webhook_mode: str
|
|
92
|
+
:param skip_br_fr:
|
|
93
|
+
:type skip_br_fr: bool
|
|
94
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
95
|
+
number provided, it will be total request
|
|
96
|
+
timeout. It can also be a pair (tuple) of
|
|
97
|
+
(connection, read) timeouts.
|
|
98
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
99
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
100
|
+
request; this effectively ignores the
|
|
101
|
+
authentication in the spec for a single request.
|
|
102
|
+
:type _request_auth: dict, optional
|
|
103
|
+
:param _content_type: force content-type for the request.
|
|
104
|
+
:type _content_type: str, Optional
|
|
105
|
+
:param _headers: set to override the headers for a single
|
|
106
|
+
request; this effectively ignores the headers
|
|
107
|
+
in the spec for a single request.
|
|
108
|
+
:type _headers: dict, optional
|
|
109
|
+
:param _host_index: set to override the host_index for a single
|
|
110
|
+
request; this effectively ignores the host_index
|
|
111
|
+
in the spec for a single request.
|
|
112
|
+
:type _host_index: int, optional
|
|
113
|
+
:return: Returns the result object.
|
|
114
|
+
""" # noqa: E501
|
|
115
|
+
|
|
116
|
+
_param = self._generate_invoice_api_v1_processing_generate_invoice_post_serialize(
|
|
117
|
+
invoice_data=invoice_data,
|
|
118
|
+
profile=profile,
|
|
119
|
+
output_format=output_format,
|
|
120
|
+
auto_enrich=auto_enrich,
|
|
121
|
+
source_pdf=source_pdf,
|
|
122
|
+
callback_url=callback_url,
|
|
123
|
+
webhook_mode=webhook_mode,
|
|
124
|
+
skip_br_fr=skip_br_fr,
|
|
125
|
+
_request_auth=_request_auth,
|
|
126
|
+
_content_type=_content_type,
|
|
127
|
+
_headers=_headers,
|
|
128
|
+
_host_index=_host_index
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
132
|
+
'202': "TaskResponse",
|
|
133
|
+
'400': None,
|
|
134
|
+
'422': None,
|
|
135
|
+
'401': "APIError",
|
|
136
|
+
}
|
|
137
|
+
response_data = self.api_client.call_api(
|
|
138
|
+
*_param,
|
|
139
|
+
_request_timeout=_request_timeout
|
|
140
|
+
)
|
|
141
|
+
response_data.read()
|
|
142
|
+
return self.api_client.response_deserialize(
|
|
143
|
+
response_data=response_data,
|
|
144
|
+
response_types_map=_response_types_map,
|
|
145
|
+
).data
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@validate_call
|
|
149
|
+
def generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(
|
|
150
|
+
self,
|
|
151
|
+
invoice_data: Annotated[StrictStr, Field(description="Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FacturXInvoice structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! ")],
|
|
152
|
+
profile: Annotated[Optional[Any], Field(description="Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.")] = None,
|
|
153
|
+
output_format: Annotated[Optional[Any], Field(description="Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).")] = None,
|
|
154
|
+
auto_enrich: Annotated[Optional[StrictBool], Field(description="🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)")] = None,
|
|
155
|
+
source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
|
|
156
|
+
callback_url: Optional[StrictStr] = None,
|
|
157
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
158
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
159
|
+
_request_timeout: Union[
|
|
160
|
+
None,
|
|
161
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
162
|
+
Tuple[
|
|
163
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
164
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
165
|
+
]
|
|
166
|
+
] = None,
|
|
167
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
168
|
+
_content_type: Optional[StrictStr] = None,
|
|
169
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
170
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
171
|
+
) -> ApiResponse[TaskResponse]:
|
|
172
|
+
"""Generate a Factur-X invoice
|
|
173
|
+
|
|
174
|
+
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 supplier SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"supplier\": { \"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 - `supplier.siret`: Supplier's SIRET (14 digits) - `supplier.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 ## Webhook notification (recommended) Instead of polling, you can receive a webhook notification when the task completes: ``` callback_url=https://your-server.com/webhook ``` The webhook will POST a JSON payload with: - `event_type`: `generation.completed` or `generation.failed` - `data.task_id`: The Celery task ID - `data.content_b64` or `data.xml_content`: The generated content - `X-Webhook-Signature` header for HMAC verification See `/docs/WEBHOOKS.md` for full documentation. ## 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.
|
|
175
|
+
|
|
176
|
+
:param invoice_data: Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FacturXInvoice structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! (required)
|
|
177
|
+
:type invoice_data: str
|
|
178
|
+
:param profile: Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
179
|
+
:type profile: APIProfile
|
|
180
|
+
:param output_format: Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
|
|
181
|
+
:type output_format: OutputFormat
|
|
182
|
+
:param auto_enrich: 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
|
|
183
|
+
:type auto_enrich: bool
|
|
184
|
+
:param source_pdf:
|
|
185
|
+
:type source_pdf: bytearray
|
|
186
|
+
:param callback_url:
|
|
187
|
+
:type callback_url: str
|
|
188
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
189
|
+
:type webhook_mode: str
|
|
190
|
+
:param skip_br_fr:
|
|
191
|
+
:type skip_br_fr: bool
|
|
192
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
193
|
+
number provided, it will be total request
|
|
194
|
+
timeout. It can also be a pair (tuple) of
|
|
195
|
+
(connection, read) timeouts.
|
|
196
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
197
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
198
|
+
request; this effectively ignores the
|
|
199
|
+
authentication in the spec for a single request.
|
|
200
|
+
:type _request_auth: dict, optional
|
|
201
|
+
:param _content_type: force content-type for the request.
|
|
202
|
+
:type _content_type: str, Optional
|
|
203
|
+
:param _headers: set to override the headers for a single
|
|
204
|
+
request; this effectively ignores the headers
|
|
205
|
+
in the spec for a single request.
|
|
206
|
+
:type _headers: dict, optional
|
|
207
|
+
:param _host_index: set to override the host_index for a single
|
|
208
|
+
request; this effectively ignores the host_index
|
|
209
|
+
in the spec for a single request.
|
|
210
|
+
:type _host_index: int, optional
|
|
211
|
+
:return: Returns the result object.
|
|
212
|
+
""" # noqa: E501
|
|
213
|
+
|
|
214
|
+
_param = self._generate_invoice_api_v1_processing_generate_invoice_post_serialize(
|
|
215
|
+
invoice_data=invoice_data,
|
|
216
|
+
profile=profile,
|
|
217
|
+
output_format=output_format,
|
|
218
|
+
auto_enrich=auto_enrich,
|
|
219
|
+
source_pdf=source_pdf,
|
|
220
|
+
callback_url=callback_url,
|
|
221
|
+
webhook_mode=webhook_mode,
|
|
222
|
+
skip_br_fr=skip_br_fr,
|
|
223
|
+
_request_auth=_request_auth,
|
|
224
|
+
_content_type=_content_type,
|
|
225
|
+
_headers=_headers,
|
|
226
|
+
_host_index=_host_index
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
230
|
+
'202': "TaskResponse",
|
|
231
|
+
'400': None,
|
|
232
|
+
'422': None,
|
|
233
|
+
'401': "APIError",
|
|
234
|
+
}
|
|
235
|
+
response_data = self.api_client.call_api(
|
|
236
|
+
*_param,
|
|
237
|
+
_request_timeout=_request_timeout
|
|
238
|
+
)
|
|
239
|
+
response_data.read()
|
|
240
|
+
return self.api_client.response_deserialize(
|
|
241
|
+
response_data=response_data,
|
|
242
|
+
response_types_map=_response_types_map,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
@validate_call
|
|
247
|
+
def generate_invoice_api_v1_processing_generate_invoice_post_without_preload_content(
|
|
248
|
+
self,
|
|
249
|
+
invoice_data: Annotated[StrictStr, Field(description="Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FacturXInvoice structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! ")],
|
|
250
|
+
profile: Annotated[Optional[Any], Field(description="Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.")] = None,
|
|
251
|
+
output_format: Annotated[Optional[Any], Field(description="Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).")] = None,
|
|
252
|
+
auto_enrich: Annotated[Optional[StrictBool], Field(description="🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)")] = None,
|
|
253
|
+
source_pdf: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None,
|
|
254
|
+
callback_url: Optional[StrictStr] = None,
|
|
255
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
256
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
257
|
+
_request_timeout: Union[
|
|
258
|
+
None,
|
|
259
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
260
|
+
Tuple[
|
|
261
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
262
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
263
|
+
]
|
|
264
|
+
] = None,
|
|
265
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
266
|
+
_content_type: Optional[StrictStr] = None,
|
|
267
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
268
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
269
|
+
) -> RESTResponseType:
|
|
270
|
+
"""Generate a Factur-X invoice
|
|
271
|
+
|
|
272
|
+
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 supplier SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"supplier\": { \"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 - `supplier.siret`: Supplier's SIRET (14 digits) - `supplier.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 ## Webhook notification (recommended) Instead of polling, you can receive a webhook notification when the task completes: ``` callback_url=https://your-server.com/webhook ``` The webhook will POST a JSON payload with: - `event_type`: `generation.completed` or `generation.failed` - `data.task_id`: The Celery task ID - `data.content_b64` or `data.xml_content`: The generated content - `X-Webhook-Signature` header for HMAC verification See `/docs/WEBHOOKS.md` for full documentation. ## 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.
|
|
273
|
+
|
|
274
|
+
:param invoice_data: Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FacturXInvoice structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! (required)
|
|
275
|
+
:type invoice_data: str
|
|
276
|
+
:param profile: Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
277
|
+
:type profile: APIProfile
|
|
278
|
+
:param output_format: Output format: 'xml' (XML only) or 'pdf' (Factur-X PDF with embedded XML).
|
|
279
|
+
:type output_format: OutputFormat
|
|
280
|
+
:param auto_enrich: 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
|
|
281
|
+
:type auto_enrich: bool
|
|
282
|
+
:param source_pdf:
|
|
283
|
+
:type source_pdf: bytearray
|
|
284
|
+
:param callback_url:
|
|
285
|
+
:type callback_url: str
|
|
286
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
287
|
+
:type webhook_mode: str
|
|
288
|
+
:param skip_br_fr:
|
|
289
|
+
:type skip_br_fr: bool
|
|
290
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
291
|
+
number provided, it will be total request
|
|
292
|
+
timeout. It can also be a pair (tuple) of
|
|
293
|
+
(connection, read) timeouts.
|
|
294
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
295
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
296
|
+
request; this effectively ignores the
|
|
297
|
+
authentication in the spec for a single request.
|
|
298
|
+
:type _request_auth: dict, optional
|
|
299
|
+
:param _content_type: force content-type for the request.
|
|
300
|
+
:type _content_type: str, Optional
|
|
301
|
+
:param _headers: set to override the headers for a single
|
|
302
|
+
request; this effectively ignores the headers
|
|
303
|
+
in the spec for a single request.
|
|
304
|
+
:type _headers: dict, optional
|
|
305
|
+
:param _host_index: set to override the host_index for a single
|
|
306
|
+
request; this effectively ignores the host_index
|
|
307
|
+
in the spec for a single request.
|
|
308
|
+
:type _host_index: int, optional
|
|
309
|
+
:return: Returns the result object.
|
|
310
|
+
""" # noqa: E501
|
|
311
|
+
|
|
312
|
+
_param = self._generate_invoice_api_v1_processing_generate_invoice_post_serialize(
|
|
313
|
+
invoice_data=invoice_data,
|
|
314
|
+
profile=profile,
|
|
315
|
+
output_format=output_format,
|
|
316
|
+
auto_enrich=auto_enrich,
|
|
317
|
+
source_pdf=source_pdf,
|
|
318
|
+
callback_url=callback_url,
|
|
319
|
+
webhook_mode=webhook_mode,
|
|
320
|
+
skip_br_fr=skip_br_fr,
|
|
321
|
+
_request_auth=_request_auth,
|
|
322
|
+
_content_type=_content_type,
|
|
323
|
+
_headers=_headers,
|
|
324
|
+
_host_index=_host_index
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
328
|
+
'202': "TaskResponse",
|
|
329
|
+
'400': None,
|
|
330
|
+
'422': None,
|
|
331
|
+
'401': "APIError",
|
|
332
|
+
}
|
|
333
|
+
response_data = self.api_client.call_api(
|
|
334
|
+
*_param,
|
|
335
|
+
_request_timeout=_request_timeout
|
|
336
|
+
)
|
|
337
|
+
return response_data.response
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def _generate_invoice_api_v1_processing_generate_invoice_post_serialize(
|
|
341
|
+
self,
|
|
342
|
+
invoice_data,
|
|
343
|
+
profile,
|
|
344
|
+
output_format,
|
|
345
|
+
auto_enrich,
|
|
346
|
+
source_pdf,
|
|
347
|
+
callback_url,
|
|
348
|
+
webhook_mode,
|
|
349
|
+
skip_br_fr,
|
|
350
|
+
_request_auth,
|
|
351
|
+
_content_type,
|
|
352
|
+
_headers,
|
|
353
|
+
_host_index,
|
|
354
|
+
) -> RequestSerialized:
|
|
355
|
+
|
|
356
|
+
_host = None
|
|
357
|
+
|
|
358
|
+
_collection_formats: Dict[str, str] = {
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
_path_params: Dict[str, str] = {}
|
|
362
|
+
_query_params: List[Tuple[str, str]] = []
|
|
363
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
364
|
+
_form_params: List[Tuple[str, str]] = []
|
|
365
|
+
_files: Dict[
|
|
366
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
367
|
+
] = {}
|
|
368
|
+
_body_params: Optional[bytes] = None
|
|
369
|
+
|
|
370
|
+
# process the path parameters
|
|
371
|
+
# process the query parameters
|
|
372
|
+
# process the header parameters
|
|
373
|
+
# process the form parameters
|
|
374
|
+
if invoice_data is not None:
|
|
375
|
+
_form_params.append(('invoice_data', invoice_data))
|
|
376
|
+
if profile is not None:
|
|
377
|
+
_form_params.append(('profile', profile))
|
|
378
|
+
if output_format is not None:
|
|
379
|
+
_form_params.append(('output_format', output_format))
|
|
380
|
+
if auto_enrich is not None:
|
|
381
|
+
_form_params.append(('auto_enrich', auto_enrich))
|
|
382
|
+
if source_pdf is not None:
|
|
383
|
+
_files['source_pdf'] = source_pdf
|
|
384
|
+
if callback_url is not None:
|
|
385
|
+
_form_params.append(('callback_url', callback_url))
|
|
386
|
+
if webhook_mode is not None:
|
|
387
|
+
_form_params.append(('webhook_mode', webhook_mode))
|
|
388
|
+
if skip_br_fr is not None:
|
|
389
|
+
_form_params.append(('skip_br_fr', skip_br_fr))
|
|
390
|
+
# process the body parameter
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
# set the HTTP header `Accept`
|
|
394
|
+
if 'Accept' not in _header_params:
|
|
395
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
396
|
+
[
|
|
397
|
+
'application/json'
|
|
398
|
+
]
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
# set the HTTP header `Content-Type`
|
|
402
|
+
if _content_type:
|
|
403
|
+
_header_params['Content-Type'] = _content_type
|
|
404
|
+
else:
|
|
405
|
+
_default_content_type = (
|
|
406
|
+
self.api_client.select_header_content_type(
|
|
407
|
+
[
|
|
408
|
+
'multipart/form-data'
|
|
409
|
+
]
|
|
410
|
+
)
|
|
411
|
+
)
|
|
412
|
+
if _default_content_type is not None:
|
|
413
|
+
_header_params['Content-Type'] = _default_content_type
|
|
414
|
+
|
|
415
|
+
# authentication setting
|
|
416
|
+
_auth_settings: List[str] = [
|
|
417
|
+
'HTTPBearer'
|
|
418
|
+
]
|
|
419
|
+
|
|
420
|
+
return self.api_client.param_serialize(
|
|
421
|
+
method='POST',
|
|
422
|
+
resource_path='/api/v1/processing/generate-invoice',
|
|
423
|
+
path_params=_path_params,
|
|
424
|
+
query_params=_query_params,
|
|
425
|
+
header_params=_header_params,
|
|
426
|
+
body=_body_params,
|
|
427
|
+
post_params=_form_params,
|
|
428
|
+
files=_files,
|
|
429
|
+
auth_settings=_auth_settings,
|
|
430
|
+
collection_formats=_collection_formats,
|
|
431
|
+
_host=_host,
|
|
432
|
+
_request_auth=_request_auth
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
@validate_call
|
|
439
|
+
def generate_test_certificate_api_v1_processing_generate_test_certificate_post(
|
|
440
|
+
self,
|
|
441
|
+
generate_certificate_request: GenerateCertificateRequest,
|
|
442
|
+
_request_timeout: Union[
|
|
443
|
+
None,
|
|
444
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
445
|
+
Tuple[
|
|
446
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
447
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
448
|
+
]
|
|
449
|
+
] = None,
|
|
450
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
451
|
+
_content_type: Optional[StrictStr] = None,
|
|
452
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
453
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
454
|
+
) -> GenerateCertificateResponse:
|
|
455
|
+
"""Generate a self-signed X.509 test certificate
|
|
456
|
+
|
|
457
|
+
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://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)
|
|
458
|
+
|
|
459
|
+
:param generate_certificate_request: (required)
|
|
460
|
+
:type generate_certificate_request: GenerateCertificateRequest
|
|
461
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
462
|
+
number provided, it will be total request
|
|
463
|
+
timeout. It can also be a pair (tuple) of
|
|
464
|
+
(connection, read) timeouts.
|
|
465
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
466
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
467
|
+
request; this effectively ignores the
|
|
468
|
+
authentication in the spec for a single request.
|
|
469
|
+
:type _request_auth: dict, optional
|
|
470
|
+
:param _content_type: force content-type for the request.
|
|
471
|
+
:type _content_type: str, Optional
|
|
472
|
+
:param _headers: set to override the headers for a single
|
|
473
|
+
request; this effectively ignores the headers
|
|
474
|
+
in the spec for a single request.
|
|
475
|
+
:type _headers: dict, optional
|
|
476
|
+
:param _host_index: set to override the host_index for a single
|
|
477
|
+
request; this effectively ignores the host_index
|
|
478
|
+
in the spec for a single request.
|
|
479
|
+
:type _host_index: int, optional
|
|
480
|
+
:return: Returns the result object.
|
|
481
|
+
""" # noqa: E501
|
|
482
|
+
|
|
483
|
+
_param = self._generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
|
|
484
|
+
generate_certificate_request=generate_certificate_request,
|
|
485
|
+
_request_auth=_request_auth,
|
|
486
|
+
_content_type=_content_type,
|
|
487
|
+
_headers=_headers,
|
|
488
|
+
_host_index=_host_index
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
492
|
+
'200': "GenerateCertificateResponse",
|
|
493
|
+
'400': None,
|
|
494
|
+
'500': None,
|
|
495
|
+
'422': "HTTPValidationError",
|
|
496
|
+
'401': "APIError",
|
|
497
|
+
}
|
|
498
|
+
response_data = self.api_client.call_api(
|
|
499
|
+
*_param,
|
|
500
|
+
_request_timeout=_request_timeout
|
|
501
|
+
)
|
|
502
|
+
response_data.read()
|
|
503
|
+
return self.api_client.response_deserialize(
|
|
504
|
+
response_data=response_data,
|
|
505
|
+
response_types_map=_response_types_map,
|
|
506
|
+
).data
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
@validate_call
|
|
510
|
+
def generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(
|
|
511
|
+
self,
|
|
512
|
+
generate_certificate_request: GenerateCertificateRequest,
|
|
513
|
+
_request_timeout: Union[
|
|
514
|
+
None,
|
|
515
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
516
|
+
Tuple[
|
|
517
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
518
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
519
|
+
]
|
|
520
|
+
] = None,
|
|
521
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
522
|
+
_content_type: Optional[StrictStr] = None,
|
|
523
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
524
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
525
|
+
) -> ApiResponse[GenerateCertificateResponse]:
|
|
526
|
+
"""Generate a self-signed X.509 test certificate
|
|
527
|
+
|
|
528
|
+
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://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)
|
|
529
|
+
|
|
530
|
+
:param generate_certificate_request: (required)
|
|
531
|
+
:type generate_certificate_request: GenerateCertificateRequest
|
|
532
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
533
|
+
number provided, it will be total request
|
|
534
|
+
timeout. It can also be a pair (tuple) of
|
|
535
|
+
(connection, read) timeouts.
|
|
536
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
537
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
538
|
+
request; this effectively ignores the
|
|
539
|
+
authentication in the spec for a single request.
|
|
540
|
+
:type _request_auth: dict, optional
|
|
541
|
+
:param _content_type: force content-type for the request.
|
|
542
|
+
:type _content_type: str, Optional
|
|
543
|
+
:param _headers: set to override the headers for a single
|
|
544
|
+
request; this effectively ignores the headers
|
|
545
|
+
in the spec for a single request.
|
|
546
|
+
:type _headers: dict, optional
|
|
547
|
+
:param _host_index: set to override the host_index for a single
|
|
548
|
+
request; this effectively ignores the host_index
|
|
549
|
+
in the spec for a single request.
|
|
550
|
+
:type _host_index: int, optional
|
|
551
|
+
:return: Returns the result object.
|
|
552
|
+
""" # noqa: E501
|
|
553
|
+
|
|
554
|
+
_param = self._generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
|
|
555
|
+
generate_certificate_request=generate_certificate_request,
|
|
556
|
+
_request_auth=_request_auth,
|
|
557
|
+
_content_type=_content_type,
|
|
558
|
+
_headers=_headers,
|
|
559
|
+
_host_index=_host_index
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
563
|
+
'200': "GenerateCertificateResponse",
|
|
564
|
+
'400': None,
|
|
565
|
+
'500': None,
|
|
566
|
+
'422': "HTTPValidationError",
|
|
567
|
+
'401': "APIError",
|
|
568
|
+
}
|
|
569
|
+
response_data = self.api_client.call_api(
|
|
570
|
+
*_param,
|
|
571
|
+
_request_timeout=_request_timeout
|
|
572
|
+
)
|
|
573
|
+
response_data.read()
|
|
574
|
+
return self.api_client.response_deserialize(
|
|
575
|
+
response_data=response_data,
|
|
576
|
+
response_types_map=_response_types_map,
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
@validate_call
|
|
581
|
+
def generate_test_certificate_api_v1_processing_generate_test_certificate_post_without_preload_content(
|
|
582
|
+
self,
|
|
583
|
+
generate_certificate_request: GenerateCertificateRequest,
|
|
584
|
+
_request_timeout: Union[
|
|
585
|
+
None,
|
|
586
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
587
|
+
Tuple[
|
|
588
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
589
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
590
|
+
]
|
|
591
|
+
] = None,
|
|
592
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
593
|
+
_content_type: Optional[StrictStr] = None,
|
|
594
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
595
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
596
|
+
) -> RESTResponseType:
|
|
597
|
+
"""Generate a self-signed X.509 test certificate
|
|
598
|
+
|
|
599
|
+
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://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)
|
|
600
|
+
|
|
601
|
+
:param generate_certificate_request: (required)
|
|
602
|
+
:type generate_certificate_request: GenerateCertificateRequest
|
|
603
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
604
|
+
number provided, it will be total request
|
|
605
|
+
timeout. It can also be a pair (tuple) of
|
|
606
|
+
(connection, read) timeouts.
|
|
607
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
608
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
609
|
+
request; this effectively ignores the
|
|
610
|
+
authentication in the spec for a single request.
|
|
611
|
+
:type _request_auth: dict, optional
|
|
612
|
+
:param _content_type: force content-type for the request.
|
|
613
|
+
:type _content_type: str, Optional
|
|
614
|
+
:param _headers: set to override the headers for a single
|
|
615
|
+
request; this effectively ignores the headers
|
|
616
|
+
in the spec for a single request.
|
|
617
|
+
:type _headers: dict, optional
|
|
618
|
+
:param _host_index: set to override the host_index for a single
|
|
619
|
+
request; this effectively ignores the host_index
|
|
620
|
+
in the spec for a single request.
|
|
621
|
+
:type _host_index: int, optional
|
|
622
|
+
:return: Returns the result object.
|
|
623
|
+
""" # noqa: E501
|
|
624
|
+
|
|
625
|
+
_param = self._generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
|
|
626
|
+
generate_certificate_request=generate_certificate_request,
|
|
627
|
+
_request_auth=_request_auth,
|
|
628
|
+
_content_type=_content_type,
|
|
629
|
+
_headers=_headers,
|
|
630
|
+
_host_index=_host_index
|
|
631
|
+
)
|
|
632
|
+
|
|
633
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
634
|
+
'200': "GenerateCertificateResponse",
|
|
635
|
+
'400': None,
|
|
636
|
+
'500': None,
|
|
637
|
+
'422': "HTTPValidationError",
|
|
638
|
+
'401': "APIError",
|
|
639
|
+
}
|
|
640
|
+
response_data = self.api_client.call_api(
|
|
641
|
+
*_param,
|
|
642
|
+
_request_timeout=_request_timeout
|
|
643
|
+
)
|
|
644
|
+
return response_data.response
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
def _generate_test_certificate_api_v1_processing_generate_test_certificate_post_serialize(
|
|
648
|
+
self,
|
|
649
|
+
generate_certificate_request,
|
|
650
|
+
_request_auth,
|
|
651
|
+
_content_type,
|
|
652
|
+
_headers,
|
|
653
|
+
_host_index,
|
|
654
|
+
) -> RequestSerialized:
|
|
655
|
+
|
|
656
|
+
_host = None
|
|
657
|
+
|
|
658
|
+
_collection_formats: Dict[str, str] = {
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
_path_params: Dict[str, str] = {}
|
|
662
|
+
_query_params: List[Tuple[str, str]] = []
|
|
663
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
664
|
+
_form_params: List[Tuple[str, str]] = []
|
|
665
|
+
_files: Dict[
|
|
666
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
667
|
+
] = {}
|
|
668
|
+
_body_params: Optional[bytes] = None
|
|
669
|
+
|
|
670
|
+
# process the path parameters
|
|
671
|
+
# process the query parameters
|
|
672
|
+
# process the header parameters
|
|
673
|
+
# process the form parameters
|
|
674
|
+
# process the body parameter
|
|
675
|
+
if generate_certificate_request is not None:
|
|
676
|
+
_body_params = generate_certificate_request
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
# set the HTTP header `Accept`
|
|
680
|
+
if 'Accept' not in _header_params:
|
|
681
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
682
|
+
[
|
|
683
|
+
'application/json'
|
|
684
|
+
]
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
# set the HTTP header `Content-Type`
|
|
688
|
+
if _content_type:
|
|
689
|
+
_header_params['Content-Type'] = _content_type
|
|
690
|
+
else:
|
|
691
|
+
_default_content_type = (
|
|
692
|
+
self.api_client.select_header_content_type(
|
|
693
|
+
[
|
|
694
|
+
'application/json'
|
|
695
|
+
]
|
|
696
|
+
)
|
|
697
|
+
)
|
|
698
|
+
if _default_content_type is not None:
|
|
699
|
+
_header_params['Content-Type'] = _default_content_type
|
|
700
|
+
|
|
701
|
+
# authentication setting
|
|
702
|
+
_auth_settings: List[str] = [
|
|
703
|
+
'HTTPBearer'
|
|
704
|
+
]
|
|
705
|
+
|
|
706
|
+
return self.api_client.param_serialize(
|
|
707
|
+
method='POST',
|
|
708
|
+
resource_path='/api/v1/processing/generate-test-certificate',
|
|
709
|
+
path_params=_path_params,
|
|
710
|
+
query_params=_query_params,
|
|
711
|
+
header_params=_header_params,
|
|
712
|
+
body=_body_params,
|
|
713
|
+
post_params=_form_params,
|
|
714
|
+
files=_files,
|
|
715
|
+
auth_settings=_auth_settings,
|
|
716
|
+
collection_formats=_collection_formats,
|
|
717
|
+
_host=_host,
|
|
718
|
+
_request_auth=_request_auth
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
@validate_call
|
|
725
|
+
def get_task_status_api_v1_processing_tasks_task_id_status_get(
|
|
726
|
+
self,
|
|
727
|
+
task_id: Annotated[StrictStr, Field(description="Celery task ID returned by async endpoints (UUID format)")],
|
|
728
|
+
_request_timeout: Union[
|
|
729
|
+
None,
|
|
730
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
731
|
+
Tuple[
|
|
732
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
733
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
734
|
+
]
|
|
735
|
+
] = None,
|
|
736
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
737
|
+
_content_type: Optional[StrictStr] = None,
|
|
738
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
739
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
740
|
+
) -> AsyncTaskStatus:
|
|
741
|
+
"""Get task generation status
|
|
742
|
+
|
|
743
|
+
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`.
|
|
744
|
+
|
|
745
|
+
:param task_id: Celery task ID returned by async endpoints (UUID format) (required)
|
|
746
|
+
:type task_id: str
|
|
747
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
748
|
+
number provided, it will be total request
|
|
749
|
+
timeout. It can also be a pair (tuple) of
|
|
750
|
+
(connection, read) timeouts.
|
|
751
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
752
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
753
|
+
request; this effectively ignores the
|
|
754
|
+
authentication in the spec for a single request.
|
|
755
|
+
:type _request_auth: dict, optional
|
|
756
|
+
:param _content_type: force content-type for the request.
|
|
757
|
+
:type _content_type: str, Optional
|
|
758
|
+
:param _headers: set to override the headers for a single
|
|
759
|
+
request; this effectively ignores the headers
|
|
760
|
+
in the spec for a single request.
|
|
761
|
+
:type _headers: dict, optional
|
|
762
|
+
:param _host_index: set to override the host_index for a single
|
|
763
|
+
request; this effectively ignores the host_index
|
|
764
|
+
in the spec for a single request.
|
|
765
|
+
:type _host_index: int, optional
|
|
766
|
+
:return: Returns the result object.
|
|
767
|
+
""" # noqa: E501
|
|
768
|
+
|
|
769
|
+
_param = self._get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
|
|
770
|
+
task_id=task_id,
|
|
771
|
+
_request_auth=_request_auth,
|
|
772
|
+
_content_type=_content_type,
|
|
773
|
+
_headers=_headers,
|
|
774
|
+
_host_index=_host_index
|
|
775
|
+
)
|
|
776
|
+
|
|
777
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
778
|
+
'200': "AsyncTaskStatus",
|
|
779
|
+
'422': "HTTPValidationError",
|
|
780
|
+
'401': "APIError",
|
|
781
|
+
}
|
|
782
|
+
response_data = self.api_client.call_api(
|
|
783
|
+
*_param,
|
|
784
|
+
_request_timeout=_request_timeout
|
|
785
|
+
)
|
|
786
|
+
response_data.read()
|
|
787
|
+
return self.api_client.response_deserialize(
|
|
788
|
+
response_data=response_data,
|
|
789
|
+
response_types_map=_response_types_map,
|
|
790
|
+
).data
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
@validate_call
|
|
794
|
+
def get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(
|
|
795
|
+
self,
|
|
796
|
+
task_id: Annotated[StrictStr, Field(description="Celery task ID returned by async endpoints (UUID format)")],
|
|
797
|
+
_request_timeout: Union[
|
|
798
|
+
None,
|
|
799
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
800
|
+
Tuple[
|
|
801
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
802
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
803
|
+
]
|
|
804
|
+
] = None,
|
|
805
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
806
|
+
_content_type: Optional[StrictStr] = None,
|
|
807
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
808
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
809
|
+
) -> ApiResponse[AsyncTaskStatus]:
|
|
810
|
+
"""Get task generation status
|
|
811
|
+
|
|
812
|
+
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`.
|
|
813
|
+
|
|
814
|
+
:param task_id: Celery task ID returned by async endpoints (UUID format) (required)
|
|
815
|
+
:type task_id: str
|
|
816
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
817
|
+
number provided, it will be total request
|
|
818
|
+
timeout. It can also be a pair (tuple) of
|
|
819
|
+
(connection, read) timeouts.
|
|
820
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
821
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
822
|
+
request; this effectively ignores the
|
|
823
|
+
authentication in the spec for a single request.
|
|
824
|
+
:type _request_auth: dict, optional
|
|
825
|
+
:param _content_type: force content-type for the request.
|
|
826
|
+
:type _content_type: str, Optional
|
|
827
|
+
:param _headers: set to override the headers for a single
|
|
828
|
+
request; this effectively ignores the headers
|
|
829
|
+
in the spec for a single request.
|
|
830
|
+
:type _headers: dict, optional
|
|
831
|
+
:param _host_index: set to override the host_index for a single
|
|
832
|
+
request; this effectively ignores the host_index
|
|
833
|
+
in the spec for a single request.
|
|
834
|
+
:type _host_index: int, optional
|
|
835
|
+
:return: Returns the result object.
|
|
836
|
+
""" # noqa: E501
|
|
837
|
+
|
|
838
|
+
_param = self._get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
|
|
839
|
+
task_id=task_id,
|
|
840
|
+
_request_auth=_request_auth,
|
|
841
|
+
_content_type=_content_type,
|
|
842
|
+
_headers=_headers,
|
|
843
|
+
_host_index=_host_index
|
|
844
|
+
)
|
|
845
|
+
|
|
846
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
847
|
+
'200': "AsyncTaskStatus",
|
|
848
|
+
'422': "HTTPValidationError",
|
|
849
|
+
'401': "APIError",
|
|
850
|
+
}
|
|
851
|
+
response_data = self.api_client.call_api(
|
|
852
|
+
*_param,
|
|
853
|
+
_request_timeout=_request_timeout
|
|
854
|
+
)
|
|
855
|
+
response_data.read()
|
|
856
|
+
return self.api_client.response_deserialize(
|
|
857
|
+
response_data=response_data,
|
|
858
|
+
response_types_map=_response_types_map,
|
|
859
|
+
)
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
@validate_call
|
|
863
|
+
def get_task_status_api_v1_processing_tasks_task_id_status_get_without_preload_content(
|
|
864
|
+
self,
|
|
865
|
+
task_id: Annotated[StrictStr, Field(description="Celery task ID returned by async endpoints (UUID format)")],
|
|
866
|
+
_request_timeout: Union[
|
|
867
|
+
None,
|
|
868
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
869
|
+
Tuple[
|
|
870
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
871
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
872
|
+
]
|
|
873
|
+
] = None,
|
|
874
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
875
|
+
_content_type: Optional[StrictStr] = None,
|
|
876
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
877
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
878
|
+
) -> RESTResponseType:
|
|
879
|
+
"""Get task generation status
|
|
880
|
+
|
|
881
|
+
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`.
|
|
882
|
+
|
|
883
|
+
:param task_id: Celery task ID returned by async endpoints (UUID format) (required)
|
|
884
|
+
:type task_id: str
|
|
885
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
886
|
+
number provided, it will be total request
|
|
887
|
+
timeout. It can also be a pair (tuple) of
|
|
888
|
+
(connection, read) timeouts.
|
|
889
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
890
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
891
|
+
request; this effectively ignores the
|
|
892
|
+
authentication in the spec for a single request.
|
|
893
|
+
:type _request_auth: dict, optional
|
|
894
|
+
:param _content_type: force content-type for the request.
|
|
895
|
+
:type _content_type: str, Optional
|
|
896
|
+
:param _headers: set to override the headers for a single
|
|
897
|
+
request; this effectively ignores the headers
|
|
898
|
+
in the spec for a single request.
|
|
899
|
+
:type _headers: dict, optional
|
|
900
|
+
:param _host_index: set to override the host_index for a single
|
|
901
|
+
request; this effectively ignores the host_index
|
|
902
|
+
in the spec for a single request.
|
|
903
|
+
:type _host_index: int, optional
|
|
904
|
+
:return: Returns the result object.
|
|
905
|
+
""" # noqa: E501
|
|
906
|
+
|
|
907
|
+
_param = self._get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
|
|
908
|
+
task_id=task_id,
|
|
909
|
+
_request_auth=_request_auth,
|
|
910
|
+
_content_type=_content_type,
|
|
911
|
+
_headers=_headers,
|
|
912
|
+
_host_index=_host_index
|
|
913
|
+
)
|
|
914
|
+
|
|
915
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
916
|
+
'200': "AsyncTaskStatus",
|
|
917
|
+
'422': "HTTPValidationError",
|
|
918
|
+
'401': "APIError",
|
|
919
|
+
}
|
|
920
|
+
response_data = self.api_client.call_api(
|
|
921
|
+
*_param,
|
|
922
|
+
_request_timeout=_request_timeout
|
|
923
|
+
)
|
|
924
|
+
return response_data.response
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
def _get_task_status_api_v1_processing_tasks_task_id_status_get_serialize(
|
|
928
|
+
self,
|
|
929
|
+
task_id,
|
|
930
|
+
_request_auth,
|
|
931
|
+
_content_type,
|
|
932
|
+
_headers,
|
|
933
|
+
_host_index,
|
|
934
|
+
) -> RequestSerialized:
|
|
935
|
+
|
|
936
|
+
_host = None
|
|
937
|
+
|
|
938
|
+
_collection_formats: Dict[str, str] = {
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
_path_params: Dict[str, str] = {}
|
|
942
|
+
_query_params: List[Tuple[str, str]] = []
|
|
943
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
944
|
+
_form_params: List[Tuple[str, str]] = []
|
|
945
|
+
_files: Dict[
|
|
946
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
947
|
+
] = {}
|
|
948
|
+
_body_params: Optional[bytes] = None
|
|
949
|
+
|
|
950
|
+
# process the path parameters
|
|
951
|
+
if task_id is not None:
|
|
952
|
+
_path_params['task_id'] = task_id
|
|
953
|
+
# process the query parameters
|
|
954
|
+
# process the header parameters
|
|
955
|
+
# process the form parameters
|
|
956
|
+
# process the body parameter
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
# set the HTTP header `Accept`
|
|
960
|
+
if 'Accept' not in _header_params:
|
|
961
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
962
|
+
[
|
|
963
|
+
'application/json'
|
|
964
|
+
]
|
|
965
|
+
)
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
# authentication setting
|
|
969
|
+
_auth_settings: List[str] = [
|
|
970
|
+
'HTTPBearer'
|
|
971
|
+
]
|
|
972
|
+
|
|
973
|
+
return self.api_client.param_serialize(
|
|
974
|
+
method='GET',
|
|
975
|
+
resource_path='/api/v1/processing/tasks/{task_id}/status',
|
|
976
|
+
path_params=_path_params,
|
|
977
|
+
query_params=_query_params,
|
|
978
|
+
header_params=_header_params,
|
|
979
|
+
body=_body_params,
|
|
980
|
+
post_params=_form_params,
|
|
981
|
+
files=_files,
|
|
982
|
+
auth_settings=_auth_settings,
|
|
983
|
+
collection_formats=_collection_formats,
|
|
984
|
+
_host=_host,
|
|
985
|
+
_request_auth=_request_auth
|
|
986
|
+
)
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
@validate_call
|
|
992
|
+
def sign_pdf_api_v1_processing_sign_pdf_post(
|
|
993
|
+
self,
|
|
994
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (will be processed and returned signed in base64)")],
|
|
995
|
+
reason: Optional[StrictStr] = None,
|
|
996
|
+
location: Optional[StrictStr] = None,
|
|
997
|
+
contact: Optional[StrictStr] = None,
|
|
998
|
+
field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
|
|
999
|
+
use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
|
|
1000
|
+
use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
|
|
1001
|
+
_request_timeout: Union[
|
|
1002
|
+
None,
|
|
1003
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1004
|
+
Tuple[
|
|
1005
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1006
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1007
|
+
]
|
|
1008
|
+
] = None,
|
|
1009
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1010
|
+
_content_type: Optional[StrictStr] = None,
|
|
1011
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1012
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1013
|
+
) -> object:
|
|
1014
|
+
"""Sign a PDF with client's certificate (PAdES-B-LT)
|
|
1015
|
+
|
|
1016
|
+
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.
|
|
1017
|
+
|
|
1018
|
+
:param pdf_file: PDF file to sign (will be processed and returned signed in base64) (required)
|
|
1019
|
+
:type pdf_file: bytearray
|
|
1020
|
+
:param reason:
|
|
1021
|
+
:type reason: str
|
|
1022
|
+
:param location:
|
|
1023
|
+
:type location: str
|
|
1024
|
+
:param contact:
|
|
1025
|
+
:type contact: str
|
|
1026
|
+
:param field_name: PDF signature field name
|
|
1027
|
+
:type field_name: str
|
|
1028
|
+
:param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
|
|
1029
|
+
:type use_pades_lt: bool
|
|
1030
|
+
:param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
|
|
1031
|
+
:type use_timestamp: bool
|
|
1032
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1033
|
+
number provided, it will be total request
|
|
1034
|
+
timeout. It can also be a pair (tuple) of
|
|
1035
|
+
(connection, read) timeouts.
|
|
1036
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1037
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1038
|
+
request; this effectively ignores the
|
|
1039
|
+
authentication in the spec for a single request.
|
|
1040
|
+
:type _request_auth: dict, optional
|
|
1041
|
+
:param _content_type: force content-type for the request.
|
|
1042
|
+
:type _content_type: str, Optional
|
|
1043
|
+
:param _headers: set to override the headers for a single
|
|
1044
|
+
request; this effectively ignores the headers
|
|
1045
|
+
in the spec for a single request.
|
|
1046
|
+
:type _headers: dict, optional
|
|
1047
|
+
:param _host_index: set to override the host_index for a single
|
|
1048
|
+
request; this effectively ignores the host_index
|
|
1049
|
+
in the spec for a single request.
|
|
1050
|
+
:type _host_index: int, optional
|
|
1051
|
+
:return: Returns the result object.
|
|
1052
|
+
""" # noqa: E501
|
|
1053
|
+
|
|
1054
|
+
_param = self._sign_pdf_api_v1_processing_sign_pdf_post_serialize(
|
|
1055
|
+
pdf_file=pdf_file,
|
|
1056
|
+
reason=reason,
|
|
1057
|
+
location=location,
|
|
1058
|
+
contact=contact,
|
|
1059
|
+
field_name=field_name,
|
|
1060
|
+
use_pades_lt=use_pades_lt,
|
|
1061
|
+
use_timestamp=use_timestamp,
|
|
1062
|
+
_request_auth=_request_auth,
|
|
1063
|
+
_content_type=_content_type,
|
|
1064
|
+
_headers=_headers,
|
|
1065
|
+
_host_index=_host_index
|
|
1066
|
+
)
|
|
1067
|
+
|
|
1068
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1069
|
+
'200': "object",
|
|
1070
|
+
'400': None,
|
|
1071
|
+
'404': None,
|
|
1072
|
+
'401': None,
|
|
1073
|
+
'503': None,
|
|
1074
|
+
'422': "HTTPValidationError",
|
|
1075
|
+
}
|
|
1076
|
+
response_data = self.api_client.call_api(
|
|
1077
|
+
*_param,
|
|
1078
|
+
_request_timeout=_request_timeout
|
|
1079
|
+
)
|
|
1080
|
+
response_data.read()
|
|
1081
|
+
return self.api_client.response_deserialize(
|
|
1082
|
+
response_data=response_data,
|
|
1083
|
+
response_types_map=_response_types_map,
|
|
1084
|
+
).data
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
@validate_call
|
|
1088
|
+
def sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(
|
|
1089
|
+
self,
|
|
1090
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (will be processed and returned signed in base64)")],
|
|
1091
|
+
reason: Optional[StrictStr] = None,
|
|
1092
|
+
location: Optional[StrictStr] = None,
|
|
1093
|
+
contact: Optional[StrictStr] = None,
|
|
1094
|
+
field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
|
|
1095
|
+
use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
|
|
1096
|
+
use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
|
|
1097
|
+
_request_timeout: Union[
|
|
1098
|
+
None,
|
|
1099
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1100
|
+
Tuple[
|
|
1101
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1102
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1103
|
+
]
|
|
1104
|
+
] = None,
|
|
1105
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1106
|
+
_content_type: Optional[StrictStr] = None,
|
|
1107
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1108
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1109
|
+
) -> ApiResponse[object]:
|
|
1110
|
+
"""Sign a PDF with client's certificate (PAdES-B-LT)
|
|
1111
|
+
|
|
1112
|
+
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.
|
|
1113
|
+
|
|
1114
|
+
:param pdf_file: PDF file to sign (will be processed and returned signed in base64) (required)
|
|
1115
|
+
:type pdf_file: bytearray
|
|
1116
|
+
:param reason:
|
|
1117
|
+
:type reason: str
|
|
1118
|
+
:param location:
|
|
1119
|
+
:type location: str
|
|
1120
|
+
:param contact:
|
|
1121
|
+
:type contact: str
|
|
1122
|
+
:param field_name: PDF signature field name
|
|
1123
|
+
:type field_name: str
|
|
1124
|
+
:param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
|
|
1125
|
+
:type use_pades_lt: bool
|
|
1126
|
+
:param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
|
|
1127
|
+
:type use_timestamp: bool
|
|
1128
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1129
|
+
number provided, it will be total request
|
|
1130
|
+
timeout. It can also be a pair (tuple) of
|
|
1131
|
+
(connection, read) timeouts.
|
|
1132
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1133
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1134
|
+
request; this effectively ignores the
|
|
1135
|
+
authentication in the spec for a single request.
|
|
1136
|
+
:type _request_auth: dict, optional
|
|
1137
|
+
:param _content_type: force content-type for the request.
|
|
1138
|
+
:type _content_type: str, Optional
|
|
1139
|
+
:param _headers: set to override the headers for a single
|
|
1140
|
+
request; this effectively ignores the headers
|
|
1141
|
+
in the spec for a single request.
|
|
1142
|
+
:type _headers: dict, optional
|
|
1143
|
+
:param _host_index: set to override the host_index for a single
|
|
1144
|
+
request; this effectively ignores the host_index
|
|
1145
|
+
in the spec for a single request.
|
|
1146
|
+
:type _host_index: int, optional
|
|
1147
|
+
:return: Returns the result object.
|
|
1148
|
+
""" # noqa: E501
|
|
1149
|
+
|
|
1150
|
+
_param = self._sign_pdf_api_v1_processing_sign_pdf_post_serialize(
|
|
1151
|
+
pdf_file=pdf_file,
|
|
1152
|
+
reason=reason,
|
|
1153
|
+
location=location,
|
|
1154
|
+
contact=contact,
|
|
1155
|
+
field_name=field_name,
|
|
1156
|
+
use_pades_lt=use_pades_lt,
|
|
1157
|
+
use_timestamp=use_timestamp,
|
|
1158
|
+
_request_auth=_request_auth,
|
|
1159
|
+
_content_type=_content_type,
|
|
1160
|
+
_headers=_headers,
|
|
1161
|
+
_host_index=_host_index
|
|
1162
|
+
)
|
|
1163
|
+
|
|
1164
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1165
|
+
'200': "object",
|
|
1166
|
+
'400': None,
|
|
1167
|
+
'404': None,
|
|
1168
|
+
'401': None,
|
|
1169
|
+
'503': None,
|
|
1170
|
+
'422': "HTTPValidationError",
|
|
1171
|
+
}
|
|
1172
|
+
response_data = self.api_client.call_api(
|
|
1173
|
+
*_param,
|
|
1174
|
+
_request_timeout=_request_timeout
|
|
1175
|
+
)
|
|
1176
|
+
response_data.read()
|
|
1177
|
+
return self.api_client.response_deserialize(
|
|
1178
|
+
response_data=response_data,
|
|
1179
|
+
response_types_map=_response_types_map,
|
|
1180
|
+
)
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
@validate_call
|
|
1184
|
+
def sign_pdf_api_v1_processing_sign_pdf_post_without_preload_content(
|
|
1185
|
+
self,
|
|
1186
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (will be processed and returned signed in base64)")],
|
|
1187
|
+
reason: Optional[StrictStr] = None,
|
|
1188
|
+
location: Optional[StrictStr] = None,
|
|
1189
|
+
contact: Optional[StrictStr] = None,
|
|
1190
|
+
field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
|
|
1191
|
+
use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
|
|
1192
|
+
use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
|
|
1193
|
+
_request_timeout: Union[
|
|
1194
|
+
None,
|
|
1195
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1196
|
+
Tuple[
|
|
1197
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1198
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1199
|
+
]
|
|
1200
|
+
] = None,
|
|
1201
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1202
|
+
_content_type: Optional[StrictStr] = None,
|
|
1203
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1204
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1205
|
+
) -> RESTResponseType:
|
|
1206
|
+
"""Sign a PDF with client's certificate (PAdES-B-LT)
|
|
1207
|
+
|
|
1208
|
+
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.
|
|
1209
|
+
|
|
1210
|
+
:param pdf_file: PDF file to sign (will be processed and returned signed in base64) (required)
|
|
1211
|
+
:type pdf_file: bytearray
|
|
1212
|
+
:param reason:
|
|
1213
|
+
:type reason: str
|
|
1214
|
+
:param location:
|
|
1215
|
+
:type location: str
|
|
1216
|
+
:param contact:
|
|
1217
|
+
:type contact: str
|
|
1218
|
+
:param field_name: PDF signature field name
|
|
1219
|
+
:type field_name: str
|
|
1220
|
+
:param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
|
|
1221
|
+
:type use_pades_lt: bool
|
|
1222
|
+
:param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
|
|
1223
|
+
:type use_timestamp: bool
|
|
1224
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1225
|
+
number provided, it will be total request
|
|
1226
|
+
timeout. It can also be a pair (tuple) of
|
|
1227
|
+
(connection, read) timeouts.
|
|
1228
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1229
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1230
|
+
request; this effectively ignores the
|
|
1231
|
+
authentication in the spec for a single request.
|
|
1232
|
+
:type _request_auth: dict, optional
|
|
1233
|
+
:param _content_type: force content-type for the request.
|
|
1234
|
+
:type _content_type: str, Optional
|
|
1235
|
+
:param _headers: set to override the headers for a single
|
|
1236
|
+
request; this effectively ignores the headers
|
|
1237
|
+
in the spec for a single request.
|
|
1238
|
+
:type _headers: dict, optional
|
|
1239
|
+
:param _host_index: set to override the host_index for a single
|
|
1240
|
+
request; this effectively ignores the host_index
|
|
1241
|
+
in the spec for a single request.
|
|
1242
|
+
:type _host_index: int, optional
|
|
1243
|
+
:return: Returns the result object.
|
|
1244
|
+
""" # noqa: E501
|
|
1245
|
+
|
|
1246
|
+
_param = self._sign_pdf_api_v1_processing_sign_pdf_post_serialize(
|
|
1247
|
+
pdf_file=pdf_file,
|
|
1248
|
+
reason=reason,
|
|
1249
|
+
location=location,
|
|
1250
|
+
contact=contact,
|
|
1251
|
+
field_name=field_name,
|
|
1252
|
+
use_pades_lt=use_pades_lt,
|
|
1253
|
+
use_timestamp=use_timestamp,
|
|
1254
|
+
_request_auth=_request_auth,
|
|
1255
|
+
_content_type=_content_type,
|
|
1256
|
+
_headers=_headers,
|
|
1257
|
+
_host_index=_host_index
|
|
1258
|
+
)
|
|
1259
|
+
|
|
1260
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1261
|
+
'200': "object",
|
|
1262
|
+
'400': None,
|
|
1263
|
+
'404': None,
|
|
1264
|
+
'401': None,
|
|
1265
|
+
'503': None,
|
|
1266
|
+
'422': "HTTPValidationError",
|
|
1267
|
+
}
|
|
1268
|
+
response_data = self.api_client.call_api(
|
|
1269
|
+
*_param,
|
|
1270
|
+
_request_timeout=_request_timeout
|
|
1271
|
+
)
|
|
1272
|
+
return response_data.response
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
def _sign_pdf_api_v1_processing_sign_pdf_post_serialize(
|
|
1276
|
+
self,
|
|
1277
|
+
pdf_file,
|
|
1278
|
+
reason,
|
|
1279
|
+
location,
|
|
1280
|
+
contact,
|
|
1281
|
+
field_name,
|
|
1282
|
+
use_pades_lt,
|
|
1283
|
+
use_timestamp,
|
|
1284
|
+
_request_auth,
|
|
1285
|
+
_content_type,
|
|
1286
|
+
_headers,
|
|
1287
|
+
_host_index,
|
|
1288
|
+
) -> RequestSerialized:
|
|
1289
|
+
|
|
1290
|
+
_host = None
|
|
1291
|
+
|
|
1292
|
+
_collection_formats: Dict[str, str] = {
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
_path_params: Dict[str, str] = {}
|
|
1296
|
+
_query_params: List[Tuple[str, str]] = []
|
|
1297
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
1298
|
+
_form_params: List[Tuple[str, str]] = []
|
|
1299
|
+
_files: Dict[
|
|
1300
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
1301
|
+
] = {}
|
|
1302
|
+
_body_params: Optional[bytes] = None
|
|
1303
|
+
|
|
1304
|
+
# process the path parameters
|
|
1305
|
+
# process the query parameters
|
|
1306
|
+
# process the header parameters
|
|
1307
|
+
# process the form parameters
|
|
1308
|
+
if pdf_file is not None:
|
|
1309
|
+
_files['pdf_file'] = pdf_file
|
|
1310
|
+
if reason is not None:
|
|
1311
|
+
_form_params.append(('reason', reason))
|
|
1312
|
+
if location is not None:
|
|
1313
|
+
_form_params.append(('location', location))
|
|
1314
|
+
if contact is not None:
|
|
1315
|
+
_form_params.append(('contact', contact))
|
|
1316
|
+
if field_name is not None:
|
|
1317
|
+
_form_params.append(('field_name', field_name))
|
|
1318
|
+
if use_pades_lt is not None:
|
|
1319
|
+
_form_params.append(('use_pades_lt', use_pades_lt))
|
|
1320
|
+
if use_timestamp is not None:
|
|
1321
|
+
_form_params.append(('use_timestamp', use_timestamp))
|
|
1322
|
+
# process the body parameter
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
# set the HTTP header `Accept`
|
|
1326
|
+
if 'Accept' not in _header_params:
|
|
1327
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
1328
|
+
[
|
|
1329
|
+
'application/json'
|
|
1330
|
+
]
|
|
1331
|
+
)
|
|
1332
|
+
|
|
1333
|
+
# set the HTTP header `Content-Type`
|
|
1334
|
+
if _content_type:
|
|
1335
|
+
_header_params['Content-Type'] = _content_type
|
|
1336
|
+
else:
|
|
1337
|
+
_default_content_type = (
|
|
1338
|
+
self.api_client.select_header_content_type(
|
|
1339
|
+
[
|
|
1340
|
+
'multipart/form-data'
|
|
1341
|
+
]
|
|
1342
|
+
)
|
|
1343
|
+
)
|
|
1344
|
+
if _default_content_type is not None:
|
|
1345
|
+
_header_params['Content-Type'] = _default_content_type
|
|
1346
|
+
|
|
1347
|
+
# authentication setting
|
|
1348
|
+
_auth_settings: List[str] = [
|
|
1349
|
+
'HTTPBearer'
|
|
1350
|
+
]
|
|
1351
|
+
|
|
1352
|
+
return self.api_client.param_serialize(
|
|
1353
|
+
method='POST',
|
|
1354
|
+
resource_path='/api/v1/processing/sign-pdf',
|
|
1355
|
+
path_params=_path_params,
|
|
1356
|
+
query_params=_query_params,
|
|
1357
|
+
header_params=_header_params,
|
|
1358
|
+
body=_body_params,
|
|
1359
|
+
post_params=_form_params,
|
|
1360
|
+
files=_files,
|
|
1361
|
+
auth_settings=_auth_settings,
|
|
1362
|
+
collection_formats=_collection_formats,
|
|
1363
|
+
_host=_host,
|
|
1364
|
+
_request_auth=_request_auth
|
|
1365
|
+
)
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
@validate_call
|
|
1371
|
+
def sign_pdf_async_api_v1_processing_sign_pdf_async_post(
|
|
1372
|
+
self,
|
|
1373
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (processed asynchronously)")],
|
|
1374
|
+
callback_url: Optional[StrictStr] = None,
|
|
1375
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
1376
|
+
reason: Optional[StrictStr] = None,
|
|
1377
|
+
location: Optional[StrictStr] = None,
|
|
1378
|
+
contact: Optional[StrictStr] = None,
|
|
1379
|
+
field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
|
|
1380
|
+
use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
|
|
1381
|
+
use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
|
|
1382
|
+
_request_timeout: Union[
|
|
1383
|
+
None,
|
|
1384
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1385
|
+
Tuple[
|
|
1386
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1387
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1388
|
+
]
|
|
1389
|
+
] = None,
|
|
1390
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1391
|
+
_content_type: Optional[StrictStr] = None,
|
|
1392
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1393
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1394
|
+
) -> object:
|
|
1395
|
+
"""Sign a PDF asynchronously (Celery)
|
|
1396
|
+
|
|
1397
|
+
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).
|
|
1398
|
+
|
|
1399
|
+
:param pdf_file: PDF file to sign (processed asynchronously) (required)
|
|
1400
|
+
:type pdf_file: bytearray
|
|
1401
|
+
:param callback_url:
|
|
1402
|
+
:type callback_url: str
|
|
1403
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
1404
|
+
:type webhook_mode: str
|
|
1405
|
+
:param reason:
|
|
1406
|
+
:type reason: str
|
|
1407
|
+
:param location:
|
|
1408
|
+
:type location: str
|
|
1409
|
+
:param contact:
|
|
1410
|
+
:type contact: str
|
|
1411
|
+
:param field_name: PDF signature field name
|
|
1412
|
+
:type field_name: str
|
|
1413
|
+
:param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
|
|
1414
|
+
:type use_pades_lt: bool
|
|
1415
|
+
:param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
|
|
1416
|
+
:type use_timestamp: bool
|
|
1417
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1418
|
+
number provided, it will be total request
|
|
1419
|
+
timeout. It can also be a pair (tuple) of
|
|
1420
|
+
(connection, read) timeouts.
|
|
1421
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1422
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1423
|
+
request; this effectively ignores the
|
|
1424
|
+
authentication in the spec for a single request.
|
|
1425
|
+
:type _request_auth: dict, optional
|
|
1426
|
+
:param _content_type: force content-type for the request.
|
|
1427
|
+
:type _content_type: str, Optional
|
|
1428
|
+
:param _headers: set to override the headers for a single
|
|
1429
|
+
request; this effectively ignores the headers
|
|
1430
|
+
in the spec for a single request.
|
|
1431
|
+
:type _headers: dict, optional
|
|
1432
|
+
:param _host_index: set to override the host_index for a single
|
|
1433
|
+
request; this effectively ignores the host_index
|
|
1434
|
+
in the spec for a single request.
|
|
1435
|
+
:type _host_index: int, optional
|
|
1436
|
+
:return: Returns the result object.
|
|
1437
|
+
""" # noqa: E501
|
|
1438
|
+
|
|
1439
|
+
_param = self._sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
|
|
1440
|
+
pdf_file=pdf_file,
|
|
1441
|
+
callback_url=callback_url,
|
|
1442
|
+
webhook_mode=webhook_mode,
|
|
1443
|
+
reason=reason,
|
|
1444
|
+
location=location,
|
|
1445
|
+
contact=contact,
|
|
1446
|
+
field_name=field_name,
|
|
1447
|
+
use_pades_lt=use_pades_lt,
|
|
1448
|
+
use_timestamp=use_timestamp,
|
|
1449
|
+
_request_auth=_request_auth,
|
|
1450
|
+
_content_type=_content_type,
|
|
1451
|
+
_headers=_headers,
|
|
1452
|
+
_host_index=_host_index
|
|
1453
|
+
)
|
|
1454
|
+
|
|
1455
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1456
|
+
'200': "object",
|
|
1457
|
+
'202': None,
|
|
1458
|
+
'400': None,
|
|
1459
|
+
'401': None,
|
|
1460
|
+
'422': "HTTPValidationError",
|
|
1461
|
+
}
|
|
1462
|
+
response_data = self.api_client.call_api(
|
|
1463
|
+
*_param,
|
|
1464
|
+
_request_timeout=_request_timeout
|
|
1465
|
+
)
|
|
1466
|
+
response_data.read()
|
|
1467
|
+
return self.api_client.response_deserialize(
|
|
1468
|
+
response_data=response_data,
|
|
1469
|
+
response_types_map=_response_types_map,
|
|
1470
|
+
).data
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
@validate_call
|
|
1474
|
+
def sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(
|
|
1475
|
+
self,
|
|
1476
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (processed asynchronously)")],
|
|
1477
|
+
callback_url: Optional[StrictStr] = None,
|
|
1478
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
1479
|
+
reason: Optional[StrictStr] = None,
|
|
1480
|
+
location: Optional[StrictStr] = None,
|
|
1481
|
+
contact: Optional[StrictStr] = None,
|
|
1482
|
+
field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
|
|
1483
|
+
use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
|
|
1484
|
+
use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
|
|
1485
|
+
_request_timeout: Union[
|
|
1486
|
+
None,
|
|
1487
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1488
|
+
Tuple[
|
|
1489
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1490
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1491
|
+
]
|
|
1492
|
+
] = None,
|
|
1493
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1494
|
+
_content_type: Optional[StrictStr] = None,
|
|
1495
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1496
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1497
|
+
) -> ApiResponse[object]:
|
|
1498
|
+
"""Sign a PDF asynchronously (Celery)
|
|
1499
|
+
|
|
1500
|
+
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).
|
|
1501
|
+
|
|
1502
|
+
:param pdf_file: PDF file to sign (processed asynchronously) (required)
|
|
1503
|
+
:type pdf_file: bytearray
|
|
1504
|
+
:param callback_url:
|
|
1505
|
+
:type callback_url: str
|
|
1506
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
1507
|
+
:type webhook_mode: str
|
|
1508
|
+
:param reason:
|
|
1509
|
+
:type reason: str
|
|
1510
|
+
:param location:
|
|
1511
|
+
:type location: str
|
|
1512
|
+
:param contact:
|
|
1513
|
+
:type contact: str
|
|
1514
|
+
:param field_name: PDF signature field name
|
|
1515
|
+
:type field_name: str
|
|
1516
|
+
:param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
|
|
1517
|
+
:type use_pades_lt: bool
|
|
1518
|
+
:param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
|
|
1519
|
+
:type use_timestamp: bool
|
|
1520
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1521
|
+
number provided, it will be total request
|
|
1522
|
+
timeout. It can also be a pair (tuple) of
|
|
1523
|
+
(connection, read) timeouts.
|
|
1524
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1525
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1526
|
+
request; this effectively ignores the
|
|
1527
|
+
authentication in the spec for a single request.
|
|
1528
|
+
:type _request_auth: dict, optional
|
|
1529
|
+
:param _content_type: force content-type for the request.
|
|
1530
|
+
:type _content_type: str, Optional
|
|
1531
|
+
:param _headers: set to override the headers for a single
|
|
1532
|
+
request; this effectively ignores the headers
|
|
1533
|
+
in the spec for a single request.
|
|
1534
|
+
:type _headers: dict, optional
|
|
1535
|
+
:param _host_index: set to override the host_index for a single
|
|
1536
|
+
request; this effectively ignores the host_index
|
|
1537
|
+
in the spec for a single request.
|
|
1538
|
+
:type _host_index: int, optional
|
|
1539
|
+
:return: Returns the result object.
|
|
1540
|
+
""" # noqa: E501
|
|
1541
|
+
|
|
1542
|
+
_param = self._sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
|
|
1543
|
+
pdf_file=pdf_file,
|
|
1544
|
+
callback_url=callback_url,
|
|
1545
|
+
webhook_mode=webhook_mode,
|
|
1546
|
+
reason=reason,
|
|
1547
|
+
location=location,
|
|
1548
|
+
contact=contact,
|
|
1549
|
+
field_name=field_name,
|
|
1550
|
+
use_pades_lt=use_pades_lt,
|
|
1551
|
+
use_timestamp=use_timestamp,
|
|
1552
|
+
_request_auth=_request_auth,
|
|
1553
|
+
_content_type=_content_type,
|
|
1554
|
+
_headers=_headers,
|
|
1555
|
+
_host_index=_host_index
|
|
1556
|
+
)
|
|
1557
|
+
|
|
1558
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1559
|
+
'200': "object",
|
|
1560
|
+
'202': None,
|
|
1561
|
+
'400': None,
|
|
1562
|
+
'401': None,
|
|
1563
|
+
'422': "HTTPValidationError",
|
|
1564
|
+
}
|
|
1565
|
+
response_data = self.api_client.call_api(
|
|
1566
|
+
*_param,
|
|
1567
|
+
_request_timeout=_request_timeout
|
|
1568
|
+
)
|
|
1569
|
+
response_data.read()
|
|
1570
|
+
return self.api_client.response_deserialize(
|
|
1571
|
+
response_data=response_data,
|
|
1572
|
+
response_types_map=_response_types_map,
|
|
1573
|
+
)
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
@validate_call
|
|
1577
|
+
def sign_pdf_async_api_v1_processing_sign_pdf_async_post_without_preload_content(
|
|
1578
|
+
self,
|
|
1579
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to sign (processed asynchronously)")],
|
|
1580
|
+
callback_url: Optional[StrictStr] = None,
|
|
1581
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
1582
|
+
reason: Optional[StrictStr] = None,
|
|
1583
|
+
location: Optional[StrictStr] = None,
|
|
1584
|
+
contact: Optional[StrictStr] = None,
|
|
1585
|
+
field_name: Annotated[Optional[StrictStr], Field(description="PDF signature field name")] = None,
|
|
1586
|
+
use_pades_lt: Annotated[Optional[StrictBool], Field(description="Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.")] = None,
|
|
1587
|
+
use_timestamp: Annotated[Optional[StrictBool], Field(description="Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)")] = None,
|
|
1588
|
+
_request_timeout: Union[
|
|
1589
|
+
None,
|
|
1590
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1591
|
+
Tuple[
|
|
1592
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1593
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1594
|
+
]
|
|
1595
|
+
] = None,
|
|
1596
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1597
|
+
_content_type: Optional[StrictStr] = None,
|
|
1598
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1599
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1600
|
+
) -> RESTResponseType:
|
|
1601
|
+
"""Sign a PDF asynchronously (Celery)
|
|
1602
|
+
|
|
1603
|
+
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).
|
|
1604
|
+
|
|
1605
|
+
:param pdf_file: PDF file to sign (processed asynchronously) (required)
|
|
1606
|
+
:type pdf_file: bytearray
|
|
1607
|
+
:param callback_url:
|
|
1608
|
+
:type callback_url: str
|
|
1609
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
1610
|
+
:type webhook_mode: str
|
|
1611
|
+
:param reason:
|
|
1612
|
+
:type reason: str
|
|
1613
|
+
:param location:
|
|
1614
|
+
:type location: str
|
|
1615
|
+
:param contact:
|
|
1616
|
+
:type contact: str
|
|
1617
|
+
:param field_name: PDF signature field name
|
|
1618
|
+
:type field_name: str
|
|
1619
|
+
:param use_pades_lt: Enable PAdES-B-LT (long-term archiving with embedded validation data). REQUIRES a certificate with OCSP/CRL access.
|
|
1620
|
+
:type use_pades_lt: bool
|
|
1621
|
+
:param use_timestamp: Enable RFC 3161 timestamping with FreeTSA (PAdES-B-T)
|
|
1622
|
+
:type use_timestamp: bool
|
|
1623
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1624
|
+
number provided, it will be total request
|
|
1625
|
+
timeout. It can also be a pair (tuple) of
|
|
1626
|
+
(connection, read) timeouts.
|
|
1627
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1628
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1629
|
+
request; this effectively ignores the
|
|
1630
|
+
authentication in the spec for a single request.
|
|
1631
|
+
:type _request_auth: dict, optional
|
|
1632
|
+
:param _content_type: force content-type for the request.
|
|
1633
|
+
:type _content_type: str, Optional
|
|
1634
|
+
:param _headers: set to override the headers for a single
|
|
1635
|
+
request; this effectively ignores the headers
|
|
1636
|
+
in the spec for a single request.
|
|
1637
|
+
:type _headers: dict, optional
|
|
1638
|
+
:param _host_index: set to override the host_index for a single
|
|
1639
|
+
request; this effectively ignores the host_index
|
|
1640
|
+
in the spec for a single request.
|
|
1641
|
+
:type _host_index: int, optional
|
|
1642
|
+
:return: Returns the result object.
|
|
1643
|
+
""" # noqa: E501
|
|
1644
|
+
|
|
1645
|
+
_param = self._sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
|
|
1646
|
+
pdf_file=pdf_file,
|
|
1647
|
+
callback_url=callback_url,
|
|
1648
|
+
webhook_mode=webhook_mode,
|
|
1649
|
+
reason=reason,
|
|
1650
|
+
location=location,
|
|
1651
|
+
contact=contact,
|
|
1652
|
+
field_name=field_name,
|
|
1653
|
+
use_pades_lt=use_pades_lt,
|
|
1654
|
+
use_timestamp=use_timestamp,
|
|
1655
|
+
_request_auth=_request_auth,
|
|
1656
|
+
_content_type=_content_type,
|
|
1657
|
+
_headers=_headers,
|
|
1658
|
+
_host_index=_host_index
|
|
1659
|
+
)
|
|
1660
|
+
|
|
1661
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1662
|
+
'200': "object",
|
|
1663
|
+
'202': None,
|
|
1664
|
+
'400': None,
|
|
1665
|
+
'401': None,
|
|
1666
|
+
'422': "HTTPValidationError",
|
|
1667
|
+
}
|
|
1668
|
+
response_data = self.api_client.call_api(
|
|
1669
|
+
*_param,
|
|
1670
|
+
_request_timeout=_request_timeout
|
|
1671
|
+
)
|
|
1672
|
+
return response_data.response
|
|
1673
|
+
|
|
1674
|
+
|
|
1675
|
+
def _sign_pdf_async_api_v1_processing_sign_pdf_async_post_serialize(
|
|
1676
|
+
self,
|
|
1677
|
+
pdf_file,
|
|
1678
|
+
callback_url,
|
|
1679
|
+
webhook_mode,
|
|
1680
|
+
reason,
|
|
1681
|
+
location,
|
|
1682
|
+
contact,
|
|
1683
|
+
field_name,
|
|
1684
|
+
use_pades_lt,
|
|
1685
|
+
use_timestamp,
|
|
1686
|
+
_request_auth,
|
|
1687
|
+
_content_type,
|
|
1688
|
+
_headers,
|
|
1689
|
+
_host_index,
|
|
1690
|
+
) -> RequestSerialized:
|
|
1691
|
+
|
|
1692
|
+
_host = None
|
|
1693
|
+
|
|
1694
|
+
_collection_formats: Dict[str, str] = {
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
_path_params: Dict[str, str] = {}
|
|
1698
|
+
_query_params: List[Tuple[str, str]] = []
|
|
1699
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
1700
|
+
_form_params: List[Tuple[str, str]] = []
|
|
1701
|
+
_files: Dict[
|
|
1702
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
1703
|
+
] = {}
|
|
1704
|
+
_body_params: Optional[bytes] = None
|
|
1705
|
+
|
|
1706
|
+
# process the path parameters
|
|
1707
|
+
# process the query parameters
|
|
1708
|
+
# process the header parameters
|
|
1709
|
+
# process the form parameters
|
|
1710
|
+
if pdf_file is not None:
|
|
1711
|
+
_files['pdf_file'] = pdf_file
|
|
1712
|
+
if callback_url is not None:
|
|
1713
|
+
_form_params.append(('callback_url', callback_url))
|
|
1714
|
+
if webhook_mode is not None:
|
|
1715
|
+
_form_params.append(('webhook_mode', webhook_mode))
|
|
1716
|
+
if reason is not None:
|
|
1717
|
+
_form_params.append(('reason', reason))
|
|
1718
|
+
if location is not None:
|
|
1719
|
+
_form_params.append(('location', location))
|
|
1720
|
+
if contact is not None:
|
|
1721
|
+
_form_params.append(('contact', contact))
|
|
1722
|
+
if field_name is not None:
|
|
1723
|
+
_form_params.append(('field_name', field_name))
|
|
1724
|
+
if use_pades_lt is not None:
|
|
1725
|
+
_form_params.append(('use_pades_lt', use_pades_lt))
|
|
1726
|
+
if use_timestamp is not None:
|
|
1727
|
+
_form_params.append(('use_timestamp', use_timestamp))
|
|
1728
|
+
# process the body parameter
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
# set the HTTP header `Accept`
|
|
1732
|
+
if 'Accept' not in _header_params:
|
|
1733
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
1734
|
+
[
|
|
1735
|
+
'application/json'
|
|
1736
|
+
]
|
|
1737
|
+
)
|
|
1738
|
+
|
|
1739
|
+
# set the HTTP header `Content-Type`
|
|
1740
|
+
if _content_type:
|
|
1741
|
+
_header_params['Content-Type'] = _content_type
|
|
1742
|
+
else:
|
|
1743
|
+
_default_content_type = (
|
|
1744
|
+
self.api_client.select_header_content_type(
|
|
1745
|
+
[
|
|
1746
|
+
'multipart/form-data'
|
|
1747
|
+
]
|
|
1748
|
+
)
|
|
1749
|
+
)
|
|
1750
|
+
if _default_content_type is not None:
|
|
1751
|
+
_header_params['Content-Type'] = _default_content_type
|
|
1752
|
+
|
|
1753
|
+
# authentication setting
|
|
1754
|
+
_auth_settings: List[str] = [
|
|
1755
|
+
'HTTPBearer'
|
|
1756
|
+
]
|
|
1757
|
+
|
|
1758
|
+
return self.api_client.param_serialize(
|
|
1759
|
+
method='POST',
|
|
1760
|
+
resource_path='/api/v1/processing/sign-pdf-async',
|
|
1761
|
+
path_params=_path_params,
|
|
1762
|
+
query_params=_query_params,
|
|
1763
|
+
header_params=_header_params,
|
|
1764
|
+
body=_body_params,
|
|
1765
|
+
post_params=_form_params,
|
|
1766
|
+
files=_files,
|
|
1767
|
+
auth_settings=_auth_settings,
|
|
1768
|
+
collection_formats=_collection_formats,
|
|
1769
|
+
_host=_host,
|
|
1770
|
+
_request_auth=_request_auth
|
|
1771
|
+
)
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
@validate_call
|
|
1777
|
+
def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post(
|
|
1778
|
+
self,
|
|
1779
|
+
submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
|
|
1780
|
+
_request_timeout: Union[
|
|
1781
|
+
None,
|
|
1782
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1783
|
+
Tuple[
|
|
1784
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1785
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1786
|
+
]
|
|
1787
|
+
] = None,
|
|
1788
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1789
|
+
_content_type: Optional[StrictStr] = None,
|
|
1790
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1791
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1792
|
+
) -> SubmitCompleteInvoiceResponse:
|
|
1793
|
+
"""Submit a complete invoice (generation + signature + submission)
|
|
1794
|
+
|
|
1795
|
+
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`)
|
|
1796
|
+
|
|
1797
|
+
:param submit_complete_invoice_request: (required)
|
|
1798
|
+
:type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
|
|
1799
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1800
|
+
number provided, it will be total request
|
|
1801
|
+
timeout. It can also be a pair (tuple) of
|
|
1802
|
+
(connection, read) timeouts.
|
|
1803
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1804
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1805
|
+
request; this effectively ignores the
|
|
1806
|
+
authentication in the spec for a single request.
|
|
1807
|
+
:type _request_auth: dict, optional
|
|
1808
|
+
:param _content_type: force content-type for the request.
|
|
1809
|
+
:type _content_type: str, Optional
|
|
1810
|
+
:param _headers: set to override the headers for a single
|
|
1811
|
+
request; this effectively ignores the headers
|
|
1812
|
+
in the spec for a single request.
|
|
1813
|
+
:type _headers: dict, optional
|
|
1814
|
+
:param _host_index: set to override the host_index for a single
|
|
1815
|
+
request; this effectively ignores the host_index
|
|
1816
|
+
in the spec for a single request.
|
|
1817
|
+
:type _host_index: int, optional
|
|
1818
|
+
:return: Returns the result object.
|
|
1819
|
+
""" # noqa: E501
|
|
1820
|
+
|
|
1821
|
+
_param = self._submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
|
|
1822
|
+
submit_complete_invoice_request=submit_complete_invoice_request,
|
|
1823
|
+
_request_auth=_request_auth,
|
|
1824
|
+
_content_type=_content_type,
|
|
1825
|
+
_headers=_headers,
|
|
1826
|
+
_host_index=_host_index
|
|
1827
|
+
)
|
|
1828
|
+
|
|
1829
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1830
|
+
'200': "SubmitCompleteInvoiceResponse",
|
|
1831
|
+
'422': "HTTPValidationError",
|
|
1832
|
+
'401': "APIError",
|
|
1833
|
+
}
|
|
1834
|
+
response_data = self.api_client.call_api(
|
|
1835
|
+
*_param,
|
|
1836
|
+
_request_timeout=_request_timeout
|
|
1837
|
+
)
|
|
1838
|
+
response_data.read()
|
|
1839
|
+
return self.api_client.response_deserialize(
|
|
1840
|
+
response_data=response_data,
|
|
1841
|
+
response_types_map=_response_types_map,
|
|
1842
|
+
).data
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
@validate_call
|
|
1846
|
+
def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(
|
|
1847
|
+
self,
|
|
1848
|
+
submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
|
|
1849
|
+
_request_timeout: Union[
|
|
1850
|
+
None,
|
|
1851
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1852
|
+
Tuple[
|
|
1853
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1854
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1855
|
+
]
|
|
1856
|
+
] = None,
|
|
1857
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1858
|
+
_content_type: Optional[StrictStr] = None,
|
|
1859
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1860
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1861
|
+
) -> ApiResponse[SubmitCompleteInvoiceResponse]:
|
|
1862
|
+
"""Submit a complete invoice (generation + signature + submission)
|
|
1863
|
+
|
|
1864
|
+
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`)
|
|
1865
|
+
|
|
1866
|
+
:param submit_complete_invoice_request: (required)
|
|
1867
|
+
:type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
|
|
1868
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1869
|
+
number provided, it will be total request
|
|
1870
|
+
timeout. It can also be a pair (tuple) of
|
|
1871
|
+
(connection, read) timeouts.
|
|
1872
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1873
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1874
|
+
request; this effectively ignores the
|
|
1875
|
+
authentication in the spec for a single request.
|
|
1876
|
+
:type _request_auth: dict, optional
|
|
1877
|
+
:param _content_type: force content-type for the request.
|
|
1878
|
+
:type _content_type: str, Optional
|
|
1879
|
+
:param _headers: set to override the headers for a single
|
|
1880
|
+
request; this effectively ignores the headers
|
|
1881
|
+
in the spec for a single request.
|
|
1882
|
+
:type _headers: dict, optional
|
|
1883
|
+
:param _host_index: set to override the host_index for a single
|
|
1884
|
+
request; this effectively ignores the host_index
|
|
1885
|
+
in the spec for a single request.
|
|
1886
|
+
:type _host_index: int, optional
|
|
1887
|
+
:return: Returns the result object.
|
|
1888
|
+
""" # noqa: E501
|
|
1889
|
+
|
|
1890
|
+
_param = self._submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
|
|
1891
|
+
submit_complete_invoice_request=submit_complete_invoice_request,
|
|
1892
|
+
_request_auth=_request_auth,
|
|
1893
|
+
_content_type=_content_type,
|
|
1894
|
+
_headers=_headers,
|
|
1895
|
+
_host_index=_host_index
|
|
1896
|
+
)
|
|
1897
|
+
|
|
1898
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1899
|
+
'200': "SubmitCompleteInvoiceResponse",
|
|
1900
|
+
'422': "HTTPValidationError",
|
|
1901
|
+
'401': "APIError",
|
|
1902
|
+
}
|
|
1903
|
+
response_data = self.api_client.call_api(
|
|
1904
|
+
*_param,
|
|
1905
|
+
_request_timeout=_request_timeout
|
|
1906
|
+
)
|
|
1907
|
+
response_data.read()
|
|
1908
|
+
return self.api_client.response_deserialize(
|
|
1909
|
+
response_data=response_data,
|
|
1910
|
+
response_types_map=_response_types_map,
|
|
1911
|
+
)
|
|
1912
|
+
|
|
1913
|
+
|
|
1914
|
+
@validate_call
|
|
1915
|
+
def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_without_preload_content(
|
|
1916
|
+
self,
|
|
1917
|
+
submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
|
|
1918
|
+
_request_timeout: Union[
|
|
1919
|
+
None,
|
|
1920
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1921
|
+
Tuple[
|
|
1922
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1923
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1924
|
+
]
|
|
1925
|
+
] = None,
|
|
1926
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1927
|
+
_content_type: Optional[StrictStr] = None,
|
|
1928
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1929
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1930
|
+
) -> RESTResponseType:
|
|
1931
|
+
"""Submit a complete invoice (generation + signature + submission)
|
|
1932
|
+
|
|
1933
|
+
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`)
|
|
1934
|
+
|
|
1935
|
+
:param submit_complete_invoice_request: (required)
|
|
1936
|
+
:type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
|
|
1937
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1938
|
+
number provided, it will be total request
|
|
1939
|
+
timeout. It can also be a pair (tuple) of
|
|
1940
|
+
(connection, read) timeouts.
|
|
1941
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1942
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1943
|
+
request; this effectively ignores the
|
|
1944
|
+
authentication in the spec for a single request.
|
|
1945
|
+
:type _request_auth: dict, optional
|
|
1946
|
+
:param _content_type: force content-type for the request.
|
|
1947
|
+
:type _content_type: str, Optional
|
|
1948
|
+
:param _headers: set to override the headers for a single
|
|
1949
|
+
request; this effectively ignores the headers
|
|
1950
|
+
in the spec for a single request.
|
|
1951
|
+
:type _headers: dict, optional
|
|
1952
|
+
:param _host_index: set to override the host_index for a single
|
|
1953
|
+
request; this effectively ignores the host_index
|
|
1954
|
+
in the spec for a single request.
|
|
1955
|
+
:type _host_index: int, optional
|
|
1956
|
+
:return: Returns the result object.
|
|
1957
|
+
""" # noqa: E501
|
|
1958
|
+
|
|
1959
|
+
_param = self._submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
|
|
1960
|
+
submit_complete_invoice_request=submit_complete_invoice_request,
|
|
1961
|
+
_request_auth=_request_auth,
|
|
1962
|
+
_content_type=_content_type,
|
|
1963
|
+
_headers=_headers,
|
|
1964
|
+
_host_index=_host_index
|
|
1965
|
+
)
|
|
1966
|
+
|
|
1967
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1968
|
+
'200': "SubmitCompleteInvoiceResponse",
|
|
1969
|
+
'422': "HTTPValidationError",
|
|
1970
|
+
'401': "APIError",
|
|
1971
|
+
}
|
|
1972
|
+
response_data = self.api_client.call_api(
|
|
1973
|
+
*_param,
|
|
1974
|
+
_request_timeout=_request_timeout
|
|
1975
|
+
)
|
|
1976
|
+
return response_data.response
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
def _submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_serialize(
|
|
1980
|
+
self,
|
|
1981
|
+
submit_complete_invoice_request,
|
|
1982
|
+
_request_auth,
|
|
1983
|
+
_content_type,
|
|
1984
|
+
_headers,
|
|
1985
|
+
_host_index,
|
|
1986
|
+
) -> RequestSerialized:
|
|
1987
|
+
|
|
1988
|
+
_host = None
|
|
1989
|
+
|
|
1990
|
+
_collection_formats: Dict[str, str] = {
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
_path_params: Dict[str, str] = {}
|
|
1994
|
+
_query_params: List[Tuple[str, str]] = []
|
|
1995
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
1996
|
+
_form_params: List[Tuple[str, str]] = []
|
|
1997
|
+
_files: Dict[
|
|
1998
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
1999
|
+
] = {}
|
|
2000
|
+
_body_params: Optional[bytes] = None
|
|
2001
|
+
|
|
2002
|
+
# process the path parameters
|
|
2003
|
+
# process the query parameters
|
|
2004
|
+
# process the header parameters
|
|
2005
|
+
# process the form parameters
|
|
2006
|
+
# process the body parameter
|
|
2007
|
+
if submit_complete_invoice_request is not None:
|
|
2008
|
+
_body_params = submit_complete_invoice_request
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
# set the HTTP header `Accept`
|
|
2012
|
+
if 'Accept' not in _header_params:
|
|
2013
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
2014
|
+
[
|
|
2015
|
+
'application/json'
|
|
2016
|
+
]
|
|
2017
|
+
)
|
|
2018
|
+
|
|
2019
|
+
# set the HTTP header `Content-Type`
|
|
2020
|
+
if _content_type:
|
|
2021
|
+
_header_params['Content-Type'] = _content_type
|
|
2022
|
+
else:
|
|
2023
|
+
_default_content_type = (
|
|
2024
|
+
self.api_client.select_header_content_type(
|
|
2025
|
+
[
|
|
2026
|
+
'application/json'
|
|
2027
|
+
]
|
|
2028
|
+
)
|
|
2029
|
+
)
|
|
2030
|
+
if _default_content_type is not None:
|
|
2031
|
+
_header_params['Content-Type'] = _default_content_type
|
|
2032
|
+
|
|
2033
|
+
# authentication setting
|
|
2034
|
+
_auth_settings: List[str] = [
|
|
2035
|
+
'HTTPBearer'
|
|
2036
|
+
]
|
|
2037
|
+
|
|
2038
|
+
return self.api_client.param_serialize(
|
|
2039
|
+
method='POST',
|
|
2040
|
+
resource_path='/api/v1/processing/invoices/submit-complete',
|
|
2041
|
+
path_params=_path_params,
|
|
2042
|
+
query_params=_query_params,
|
|
2043
|
+
header_params=_header_params,
|
|
2044
|
+
body=_body_params,
|
|
2045
|
+
post_params=_form_params,
|
|
2046
|
+
files=_files,
|
|
2047
|
+
auth_settings=_auth_settings,
|
|
2048
|
+
collection_formats=_collection_formats,
|
|
2049
|
+
_host=_host,
|
|
2050
|
+
_request_auth=_request_auth
|
|
2051
|
+
)
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
|
|
2056
|
+
@validate_call
|
|
2057
|
+
def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post(
|
|
2058
|
+
self,
|
|
2059
|
+
submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
|
|
2060
|
+
callback_url: Annotated[Optional[StrictStr], Field(description="Webhook URL for async notification when submission completes.")] = None,
|
|
2061
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
2062
|
+
_request_timeout: Union[
|
|
2063
|
+
None,
|
|
2064
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2065
|
+
Tuple[
|
|
2066
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2067
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2068
|
+
]
|
|
2069
|
+
] = None,
|
|
2070
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2071
|
+
_content_type: Optional[StrictStr] = None,
|
|
2072
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2073
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2074
|
+
) -> TaskResponse:
|
|
2075
|
+
"""Submit a complete invoice (asynchronous with Celery)
|
|
2076
|
+
|
|
2077
|
+
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 **Webhook notification (recommended):** Instead of polling, add `?callback_url=https://your-server.com/webhook` to receive automatic notification: - `event_type`: `submission.completed`, `submission.failed`, or `submission.partial` - `data.submission_result`: Complete submission result - `X-Webhook-Signature` header for HMAC verification **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
|
|
2078
|
+
|
|
2079
|
+
:param submit_complete_invoice_request: (required)
|
|
2080
|
+
:type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
|
|
2081
|
+
:param callback_url: Webhook URL for async notification when submission completes.
|
|
2082
|
+
:type callback_url: str
|
|
2083
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
2084
|
+
:type webhook_mode: str
|
|
2085
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2086
|
+
number provided, it will be total request
|
|
2087
|
+
timeout. It can also be a pair (tuple) of
|
|
2088
|
+
(connection, read) timeouts.
|
|
2089
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2090
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2091
|
+
request; this effectively ignores the
|
|
2092
|
+
authentication in the spec for a single request.
|
|
2093
|
+
:type _request_auth: dict, optional
|
|
2094
|
+
:param _content_type: force content-type for the request.
|
|
2095
|
+
:type _content_type: str, Optional
|
|
2096
|
+
:param _headers: set to override the headers for a single
|
|
2097
|
+
request; this effectively ignores the headers
|
|
2098
|
+
in the spec for a single request.
|
|
2099
|
+
:type _headers: dict, optional
|
|
2100
|
+
:param _host_index: set to override the host_index for a single
|
|
2101
|
+
request; this effectively ignores the host_index
|
|
2102
|
+
in the spec for a single request.
|
|
2103
|
+
:type _host_index: int, optional
|
|
2104
|
+
:return: Returns the result object.
|
|
2105
|
+
""" # noqa: E501
|
|
2106
|
+
|
|
2107
|
+
_param = self._submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
|
|
2108
|
+
submit_complete_invoice_request=submit_complete_invoice_request,
|
|
2109
|
+
callback_url=callback_url,
|
|
2110
|
+
webhook_mode=webhook_mode,
|
|
2111
|
+
_request_auth=_request_auth,
|
|
2112
|
+
_content_type=_content_type,
|
|
2113
|
+
_headers=_headers,
|
|
2114
|
+
_host_index=_host_index
|
|
2115
|
+
)
|
|
2116
|
+
|
|
2117
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2118
|
+
'202': "TaskResponse",
|
|
2119
|
+
'422': "HTTPValidationError",
|
|
2120
|
+
'401': "APIError",
|
|
2121
|
+
}
|
|
2122
|
+
response_data = self.api_client.call_api(
|
|
2123
|
+
*_param,
|
|
2124
|
+
_request_timeout=_request_timeout
|
|
2125
|
+
)
|
|
2126
|
+
response_data.read()
|
|
2127
|
+
return self.api_client.response_deserialize(
|
|
2128
|
+
response_data=response_data,
|
|
2129
|
+
response_types_map=_response_types_map,
|
|
2130
|
+
).data
|
|
2131
|
+
|
|
2132
|
+
|
|
2133
|
+
@validate_call
|
|
2134
|
+
def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(
|
|
2135
|
+
self,
|
|
2136
|
+
submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
|
|
2137
|
+
callback_url: Annotated[Optional[StrictStr], Field(description="Webhook URL for async notification when submission completes.")] = None,
|
|
2138
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
2139
|
+
_request_timeout: Union[
|
|
2140
|
+
None,
|
|
2141
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2142
|
+
Tuple[
|
|
2143
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2144
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2145
|
+
]
|
|
2146
|
+
] = None,
|
|
2147
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2148
|
+
_content_type: Optional[StrictStr] = None,
|
|
2149
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2150
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2151
|
+
) -> ApiResponse[TaskResponse]:
|
|
2152
|
+
"""Submit a complete invoice (asynchronous with Celery)
|
|
2153
|
+
|
|
2154
|
+
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 **Webhook notification (recommended):** Instead of polling, add `?callback_url=https://your-server.com/webhook` to receive automatic notification: - `event_type`: `submission.completed`, `submission.failed`, or `submission.partial` - `data.submission_result`: Complete submission result - `X-Webhook-Signature` header for HMAC verification **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
|
|
2155
|
+
|
|
2156
|
+
:param submit_complete_invoice_request: (required)
|
|
2157
|
+
:type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
|
|
2158
|
+
:param callback_url: Webhook URL for async notification when submission completes.
|
|
2159
|
+
:type callback_url: str
|
|
2160
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
2161
|
+
:type webhook_mode: str
|
|
2162
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2163
|
+
number provided, it will be total request
|
|
2164
|
+
timeout. It can also be a pair (tuple) of
|
|
2165
|
+
(connection, read) timeouts.
|
|
2166
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2167
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2168
|
+
request; this effectively ignores the
|
|
2169
|
+
authentication in the spec for a single request.
|
|
2170
|
+
:type _request_auth: dict, optional
|
|
2171
|
+
:param _content_type: force content-type for the request.
|
|
2172
|
+
:type _content_type: str, Optional
|
|
2173
|
+
:param _headers: set to override the headers for a single
|
|
2174
|
+
request; this effectively ignores the headers
|
|
2175
|
+
in the spec for a single request.
|
|
2176
|
+
:type _headers: dict, optional
|
|
2177
|
+
:param _host_index: set to override the host_index for a single
|
|
2178
|
+
request; this effectively ignores the host_index
|
|
2179
|
+
in the spec for a single request.
|
|
2180
|
+
:type _host_index: int, optional
|
|
2181
|
+
:return: Returns the result object.
|
|
2182
|
+
""" # noqa: E501
|
|
2183
|
+
|
|
2184
|
+
_param = self._submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
|
|
2185
|
+
submit_complete_invoice_request=submit_complete_invoice_request,
|
|
2186
|
+
callback_url=callback_url,
|
|
2187
|
+
webhook_mode=webhook_mode,
|
|
2188
|
+
_request_auth=_request_auth,
|
|
2189
|
+
_content_type=_content_type,
|
|
2190
|
+
_headers=_headers,
|
|
2191
|
+
_host_index=_host_index
|
|
2192
|
+
)
|
|
2193
|
+
|
|
2194
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2195
|
+
'202': "TaskResponse",
|
|
2196
|
+
'422': "HTTPValidationError",
|
|
2197
|
+
'401': "APIError",
|
|
2198
|
+
}
|
|
2199
|
+
response_data = self.api_client.call_api(
|
|
2200
|
+
*_param,
|
|
2201
|
+
_request_timeout=_request_timeout
|
|
2202
|
+
)
|
|
2203
|
+
response_data.read()
|
|
2204
|
+
return self.api_client.response_deserialize(
|
|
2205
|
+
response_data=response_data,
|
|
2206
|
+
response_types_map=_response_types_map,
|
|
2207
|
+
)
|
|
2208
|
+
|
|
2209
|
+
|
|
2210
|
+
@validate_call
|
|
2211
|
+
def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_without_preload_content(
|
|
2212
|
+
self,
|
|
2213
|
+
submit_complete_invoice_request: SubmitCompleteInvoiceRequest,
|
|
2214
|
+
callback_url: Annotated[Optional[StrictStr], Field(description="Webhook URL for async notification when submission completes.")] = None,
|
|
2215
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
2216
|
+
_request_timeout: Union[
|
|
2217
|
+
None,
|
|
2218
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2219
|
+
Tuple[
|
|
2220
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2221
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2222
|
+
]
|
|
2223
|
+
] = None,
|
|
2224
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2225
|
+
_content_type: Optional[StrictStr] = None,
|
|
2226
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2227
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2228
|
+
) -> RESTResponseType:
|
|
2229
|
+
"""Submit a complete invoice (asynchronous with Celery)
|
|
2230
|
+
|
|
2231
|
+
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 **Webhook notification (recommended):** Instead of polling, add `?callback_url=https://your-server.com/webhook` to receive automatic notification: - `event_type`: `submission.completed`, `submission.failed`, or `submission.partial` - `data.submission_result`: Complete submission result - `X-Webhook-Signature` header for HMAC verification **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
|
|
2232
|
+
|
|
2233
|
+
:param submit_complete_invoice_request: (required)
|
|
2234
|
+
:type submit_complete_invoice_request: SubmitCompleteInvoiceRequest
|
|
2235
|
+
:param callback_url: Webhook URL for async notification when submission completes.
|
|
2236
|
+
:type callback_url: str
|
|
2237
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
2238
|
+
:type webhook_mode: str
|
|
2239
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2240
|
+
number provided, it will be total request
|
|
2241
|
+
timeout. It can also be a pair (tuple) of
|
|
2242
|
+
(connection, read) timeouts.
|
|
2243
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2244
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2245
|
+
request; this effectively ignores the
|
|
2246
|
+
authentication in the spec for a single request.
|
|
2247
|
+
:type _request_auth: dict, optional
|
|
2248
|
+
:param _content_type: force content-type for the request.
|
|
2249
|
+
:type _content_type: str, Optional
|
|
2250
|
+
:param _headers: set to override the headers for a single
|
|
2251
|
+
request; this effectively ignores the headers
|
|
2252
|
+
in the spec for a single request.
|
|
2253
|
+
:type _headers: dict, optional
|
|
2254
|
+
:param _host_index: set to override the host_index for a single
|
|
2255
|
+
request; this effectively ignores the host_index
|
|
2256
|
+
in the spec for a single request.
|
|
2257
|
+
:type _host_index: int, optional
|
|
2258
|
+
:return: Returns the result object.
|
|
2259
|
+
""" # noqa: E501
|
|
2260
|
+
|
|
2261
|
+
_param = self._submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
|
|
2262
|
+
submit_complete_invoice_request=submit_complete_invoice_request,
|
|
2263
|
+
callback_url=callback_url,
|
|
2264
|
+
webhook_mode=webhook_mode,
|
|
2265
|
+
_request_auth=_request_auth,
|
|
2266
|
+
_content_type=_content_type,
|
|
2267
|
+
_headers=_headers,
|
|
2268
|
+
_host_index=_host_index
|
|
2269
|
+
)
|
|
2270
|
+
|
|
2271
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2272
|
+
'202': "TaskResponse",
|
|
2273
|
+
'422': "HTTPValidationError",
|
|
2274
|
+
'401': "APIError",
|
|
2275
|
+
}
|
|
2276
|
+
response_data = self.api_client.call_api(
|
|
2277
|
+
*_param,
|
|
2278
|
+
_request_timeout=_request_timeout
|
|
2279
|
+
)
|
|
2280
|
+
return response_data.response
|
|
2281
|
+
|
|
2282
|
+
|
|
2283
|
+
def _submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_serialize(
|
|
2284
|
+
self,
|
|
2285
|
+
submit_complete_invoice_request,
|
|
2286
|
+
callback_url,
|
|
2287
|
+
webhook_mode,
|
|
2288
|
+
_request_auth,
|
|
2289
|
+
_content_type,
|
|
2290
|
+
_headers,
|
|
2291
|
+
_host_index,
|
|
2292
|
+
) -> RequestSerialized:
|
|
2293
|
+
|
|
2294
|
+
_host = None
|
|
2295
|
+
|
|
2296
|
+
_collection_formats: Dict[str, str] = {
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
_path_params: Dict[str, str] = {}
|
|
2300
|
+
_query_params: List[Tuple[str, str]] = []
|
|
2301
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
2302
|
+
_form_params: List[Tuple[str, str]] = []
|
|
2303
|
+
_files: Dict[
|
|
2304
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
2305
|
+
] = {}
|
|
2306
|
+
_body_params: Optional[bytes] = None
|
|
2307
|
+
|
|
2308
|
+
# process the path parameters
|
|
2309
|
+
# process the query parameters
|
|
2310
|
+
if callback_url is not None:
|
|
2311
|
+
|
|
2312
|
+
_query_params.append(('callback_url', callback_url))
|
|
2313
|
+
|
|
2314
|
+
if webhook_mode is not None:
|
|
2315
|
+
|
|
2316
|
+
_query_params.append(('webhook_mode', webhook_mode))
|
|
2317
|
+
|
|
2318
|
+
# process the header parameters
|
|
2319
|
+
# process the form parameters
|
|
2320
|
+
# process the body parameter
|
|
2321
|
+
if submit_complete_invoice_request is not None:
|
|
2322
|
+
_body_params = submit_complete_invoice_request
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
# set the HTTP header `Accept`
|
|
2326
|
+
if 'Accept' not in _header_params:
|
|
2327
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
2328
|
+
[
|
|
2329
|
+
'application/json'
|
|
2330
|
+
]
|
|
2331
|
+
)
|
|
2332
|
+
|
|
2333
|
+
# set the HTTP header `Content-Type`
|
|
2334
|
+
if _content_type:
|
|
2335
|
+
_header_params['Content-Type'] = _content_type
|
|
2336
|
+
else:
|
|
2337
|
+
_default_content_type = (
|
|
2338
|
+
self.api_client.select_header_content_type(
|
|
2339
|
+
[
|
|
2340
|
+
'application/json'
|
|
2341
|
+
]
|
|
2342
|
+
)
|
|
2343
|
+
)
|
|
2344
|
+
if _default_content_type is not None:
|
|
2345
|
+
_header_params['Content-Type'] = _default_content_type
|
|
2346
|
+
|
|
2347
|
+
# authentication setting
|
|
2348
|
+
_auth_settings: List[str] = [
|
|
2349
|
+
'HTTPBearer'
|
|
2350
|
+
]
|
|
2351
|
+
|
|
2352
|
+
return self.api_client.param_serialize(
|
|
2353
|
+
method='POST',
|
|
2354
|
+
resource_path='/api/v1/processing/invoices/submit-complete-async',
|
|
2355
|
+
path_params=_path_params,
|
|
2356
|
+
query_params=_query_params,
|
|
2357
|
+
header_params=_header_params,
|
|
2358
|
+
body=_body_params,
|
|
2359
|
+
post_params=_form_params,
|
|
2360
|
+
files=_files,
|
|
2361
|
+
auth_settings=_auth_settings,
|
|
2362
|
+
collection_formats=_collection_formats,
|
|
2363
|
+
_host=_host,
|
|
2364
|
+
_request_auth=_request_auth
|
|
2365
|
+
)
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
@validate_call
|
|
2371
|
+
def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post(
|
|
2372
|
+
self,
|
|
2373
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
|
|
2374
|
+
profile: Optional[Any] = None,
|
|
2375
|
+
use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.")] = None,
|
|
2376
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
2377
|
+
_request_timeout: Union[
|
|
2378
|
+
None,
|
|
2379
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2380
|
+
Tuple[
|
|
2381
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2382
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2383
|
+
]
|
|
2384
|
+
] = None,
|
|
2385
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2386
|
+
_content_type: Optional[StrictStr] = None,
|
|
2387
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2388
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2389
|
+
) -> PDFValidationResultAPI:
|
|
2390
|
+
"""Validate a complete Factur-X PDF
|
|
2391
|
+
|
|
2392
|
+
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)
|
|
2393
|
+
|
|
2394
|
+
:param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
|
|
2395
|
+
:type pdf_file: bytearray
|
|
2396
|
+
:param profile:
|
|
2397
|
+
:type profile: APIProfile
|
|
2398
|
+
:param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
|
|
2399
|
+
:type use_verapdf: bool
|
|
2400
|
+
:param skip_br_fr:
|
|
2401
|
+
:type skip_br_fr: bool
|
|
2402
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2403
|
+
number provided, it will be total request
|
|
2404
|
+
timeout. It can also be a pair (tuple) of
|
|
2405
|
+
(connection, read) timeouts.
|
|
2406
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2407
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2408
|
+
request; this effectively ignores the
|
|
2409
|
+
authentication in the spec for a single request.
|
|
2410
|
+
:type _request_auth: dict, optional
|
|
2411
|
+
:param _content_type: force content-type for the request.
|
|
2412
|
+
:type _content_type: str, Optional
|
|
2413
|
+
:param _headers: set to override the headers for a single
|
|
2414
|
+
request; this effectively ignores the headers
|
|
2415
|
+
in the spec for a single request.
|
|
2416
|
+
:type _headers: dict, optional
|
|
2417
|
+
:param _host_index: set to override the host_index for a single
|
|
2418
|
+
request; this effectively ignores the host_index
|
|
2419
|
+
in the spec for a single request.
|
|
2420
|
+
:type _host_index: int, optional
|
|
2421
|
+
:return: Returns the result object.
|
|
2422
|
+
""" # noqa: E501
|
|
2423
|
+
|
|
2424
|
+
_param = self._validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
|
|
2425
|
+
pdf_file=pdf_file,
|
|
2426
|
+
profile=profile,
|
|
2427
|
+
use_verapdf=use_verapdf,
|
|
2428
|
+
skip_br_fr=skip_br_fr,
|
|
2429
|
+
_request_auth=_request_auth,
|
|
2430
|
+
_content_type=_content_type,
|
|
2431
|
+
_headers=_headers,
|
|
2432
|
+
_host_index=_host_index
|
|
2433
|
+
)
|
|
2434
|
+
|
|
2435
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2436
|
+
'200': "PDFValidationResultAPI",
|
|
2437
|
+
'400': None,
|
|
2438
|
+
'422': "HTTPValidationError",
|
|
2439
|
+
'401': "APIError",
|
|
2440
|
+
}
|
|
2441
|
+
response_data = self.api_client.call_api(
|
|
2442
|
+
*_param,
|
|
2443
|
+
_request_timeout=_request_timeout
|
|
2444
|
+
)
|
|
2445
|
+
response_data.read()
|
|
2446
|
+
return self.api_client.response_deserialize(
|
|
2447
|
+
response_data=response_data,
|
|
2448
|
+
response_types_map=_response_types_map,
|
|
2449
|
+
).data
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
@validate_call
|
|
2453
|
+
def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(
|
|
2454
|
+
self,
|
|
2455
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
|
|
2456
|
+
profile: Optional[Any] = None,
|
|
2457
|
+
use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.")] = None,
|
|
2458
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
2459
|
+
_request_timeout: Union[
|
|
2460
|
+
None,
|
|
2461
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2462
|
+
Tuple[
|
|
2463
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2464
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2465
|
+
]
|
|
2466
|
+
] = None,
|
|
2467
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2468
|
+
_content_type: Optional[StrictStr] = None,
|
|
2469
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2470
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2471
|
+
) -> ApiResponse[PDFValidationResultAPI]:
|
|
2472
|
+
"""Validate a complete Factur-X PDF
|
|
2473
|
+
|
|
2474
|
+
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)
|
|
2475
|
+
|
|
2476
|
+
:param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
|
|
2477
|
+
:type pdf_file: bytearray
|
|
2478
|
+
:param profile:
|
|
2479
|
+
:type profile: APIProfile
|
|
2480
|
+
:param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
|
|
2481
|
+
:type use_verapdf: bool
|
|
2482
|
+
:param skip_br_fr:
|
|
2483
|
+
:type skip_br_fr: bool
|
|
2484
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2485
|
+
number provided, it will be total request
|
|
2486
|
+
timeout. It can also be a pair (tuple) of
|
|
2487
|
+
(connection, read) timeouts.
|
|
2488
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2489
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2490
|
+
request; this effectively ignores the
|
|
2491
|
+
authentication in the spec for a single request.
|
|
2492
|
+
:type _request_auth: dict, optional
|
|
2493
|
+
:param _content_type: force content-type for the request.
|
|
2494
|
+
:type _content_type: str, Optional
|
|
2495
|
+
:param _headers: set to override the headers for a single
|
|
2496
|
+
request; this effectively ignores the headers
|
|
2497
|
+
in the spec for a single request.
|
|
2498
|
+
:type _headers: dict, optional
|
|
2499
|
+
:param _host_index: set to override the host_index for a single
|
|
2500
|
+
request; this effectively ignores the host_index
|
|
2501
|
+
in the spec for a single request.
|
|
2502
|
+
:type _host_index: int, optional
|
|
2503
|
+
:return: Returns the result object.
|
|
2504
|
+
""" # noqa: E501
|
|
2505
|
+
|
|
2506
|
+
_param = self._validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
|
|
2507
|
+
pdf_file=pdf_file,
|
|
2508
|
+
profile=profile,
|
|
2509
|
+
use_verapdf=use_verapdf,
|
|
2510
|
+
skip_br_fr=skip_br_fr,
|
|
2511
|
+
_request_auth=_request_auth,
|
|
2512
|
+
_content_type=_content_type,
|
|
2513
|
+
_headers=_headers,
|
|
2514
|
+
_host_index=_host_index
|
|
2515
|
+
)
|
|
2516
|
+
|
|
2517
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2518
|
+
'200': "PDFValidationResultAPI",
|
|
2519
|
+
'400': None,
|
|
2520
|
+
'422': "HTTPValidationError",
|
|
2521
|
+
'401': "APIError",
|
|
2522
|
+
}
|
|
2523
|
+
response_data = self.api_client.call_api(
|
|
2524
|
+
*_param,
|
|
2525
|
+
_request_timeout=_request_timeout
|
|
2526
|
+
)
|
|
2527
|
+
response_data.read()
|
|
2528
|
+
return self.api_client.response_deserialize(
|
|
2529
|
+
response_data=response_data,
|
|
2530
|
+
response_types_map=_response_types_map,
|
|
2531
|
+
)
|
|
2532
|
+
|
|
2533
|
+
|
|
2534
|
+
@validate_call
|
|
2535
|
+
def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_without_preload_content(
|
|
2536
|
+
self,
|
|
2537
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
|
|
2538
|
+
profile: Optional[Any] = None,
|
|
2539
|
+
use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.")] = None,
|
|
2540
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
2541
|
+
_request_timeout: Union[
|
|
2542
|
+
None,
|
|
2543
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2544
|
+
Tuple[
|
|
2545
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2546
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2547
|
+
]
|
|
2548
|
+
] = None,
|
|
2549
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2550
|
+
_content_type: Optional[StrictStr] = None,
|
|
2551
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2552
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2553
|
+
) -> RESTResponseType:
|
|
2554
|
+
"""Validate a complete Factur-X PDF
|
|
2555
|
+
|
|
2556
|
+
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)
|
|
2557
|
+
|
|
2558
|
+
:param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
|
|
2559
|
+
:type pdf_file: bytearray
|
|
2560
|
+
:param profile:
|
|
2561
|
+
:type profile: APIProfile
|
|
2562
|
+
:param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
|
|
2563
|
+
:type use_verapdf: bool
|
|
2564
|
+
:param skip_br_fr:
|
|
2565
|
+
:type skip_br_fr: bool
|
|
2566
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2567
|
+
number provided, it will be total request
|
|
2568
|
+
timeout. It can also be a pair (tuple) of
|
|
2569
|
+
(connection, read) timeouts.
|
|
2570
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2571
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2572
|
+
request; this effectively ignores the
|
|
2573
|
+
authentication in the spec for a single request.
|
|
2574
|
+
:type _request_auth: dict, optional
|
|
2575
|
+
:param _content_type: force content-type for the request.
|
|
2576
|
+
:type _content_type: str, Optional
|
|
2577
|
+
:param _headers: set to override the headers for a single
|
|
2578
|
+
request; this effectively ignores the headers
|
|
2579
|
+
in the spec for a single request.
|
|
2580
|
+
:type _headers: dict, optional
|
|
2581
|
+
:param _host_index: set to override the host_index for a single
|
|
2582
|
+
request; this effectively ignores the host_index
|
|
2583
|
+
in the spec for a single request.
|
|
2584
|
+
:type _host_index: int, optional
|
|
2585
|
+
:return: Returns the result object.
|
|
2586
|
+
""" # noqa: E501
|
|
2587
|
+
|
|
2588
|
+
_param = self._validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
|
|
2589
|
+
pdf_file=pdf_file,
|
|
2590
|
+
profile=profile,
|
|
2591
|
+
use_verapdf=use_verapdf,
|
|
2592
|
+
skip_br_fr=skip_br_fr,
|
|
2593
|
+
_request_auth=_request_auth,
|
|
2594
|
+
_content_type=_content_type,
|
|
2595
|
+
_headers=_headers,
|
|
2596
|
+
_host_index=_host_index
|
|
2597
|
+
)
|
|
2598
|
+
|
|
2599
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2600
|
+
'200': "PDFValidationResultAPI",
|
|
2601
|
+
'400': None,
|
|
2602
|
+
'422': "HTTPValidationError",
|
|
2603
|
+
'401': "APIError",
|
|
2604
|
+
}
|
|
2605
|
+
response_data = self.api_client.call_api(
|
|
2606
|
+
*_param,
|
|
2607
|
+
_request_timeout=_request_timeout
|
|
2608
|
+
)
|
|
2609
|
+
return response_data.response
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
def _validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_serialize(
|
|
2613
|
+
self,
|
|
2614
|
+
pdf_file,
|
|
2615
|
+
profile,
|
|
2616
|
+
use_verapdf,
|
|
2617
|
+
skip_br_fr,
|
|
2618
|
+
_request_auth,
|
|
2619
|
+
_content_type,
|
|
2620
|
+
_headers,
|
|
2621
|
+
_host_index,
|
|
2622
|
+
) -> RequestSerialized:
|
|
2623
|
+
|
|
2624
|
+
_host = None
|
|
2625
|
+
|
|
2626
|
+
_collection_formats: Dict[str, str] = {
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
_path_params: Dict[str, str] = {}
|
|
2630
|
+
_query_params: List[Tuple[str, str]] = []
|
|
2631
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
2632
|
+
_form_params: List[Tuple[str, str]] = []
|
|
2633
|
+
_files: Dict[
|
|
2634
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
2635
|
+
] = {}
|
|
2636
|
+
_body_params: Optional[bytes] = None
|
|
2637
|
+
|
|
2638
|
+
# process the path parameters
|
|
2639
|
+
# process the query parameters
|
|
2640
|
+
# process the header parameters
|
|
2641
|
+
# process the form parameters
|
|
2642
|
+
if pdf_file is not None:
|
|
2643
|
+
_files['pdf_file'] = pdf_file
|
|
2644
|
+
if profile is not None:
|
|
2645
|
+
_form_params.append(('profile', profile))
|
|
2646
|
+
if use_verapdf is not None:
|
|
2647
|
+
_form_params.append(('use_verapdf', use_verapdf))
|
|
2648
|
+
if skip_br_fr is not None:
|
|
2649
|
+
_form_params.append(('skip_br_fr', skip_br_fr))
|
|
2650
|
+
# process the body parameter
|
|
2651
|
+
|
|
2652
|
+
|
|
2653
|
+
# set the HTTP header `Accept`
|
|
2654
|
+
if 'Accept' not in _header_params:
|
|
2655
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
2656
|
+
[
|
|
2657
|
+
'application/json'
|
|
2658
|
+
]
|
|
2659
|
+
)
|
|
2660
|
+
|
|
2661
|
+
# set the HTTP header `Content-Type`
|
|
2662
|
+
if _content_type:
|
|
2663
|
+
_header_params['Content-Type'] = _content_type
|
|
2664
|
+
else:
|
|
2665
|
+
_default_content_type = (
|
|
2666
|
+
self.api_client.select_header_content_type(
|
|
2667
|
+
[
|
|
2668
|
+
'multipart/form-data'
|
|
2669
|
+
]
|
|
2670
|
+
)
|
|
2671
|
+
)
|
|
2672
|
+
if _default_content_type is not None:
|
|
2673
|
+
_header_params['Content-Type'] = _default_content_type
|
|
2674
|
+
|
|
2675
|
+
# authentication setting
|
|
2676
|
+
_auth_settings: List[str] = [
|
|
2677
|
+
'HTTPBearer'
|
|
2678
|
+
]
|
|
2679
|
+
|
|
2680
|
+
return self.api_client.param_serialize(
|
|
2681
|
+
method='POST',
|
|
2682
|
+
resource_path='/api/v1/processing/validate-facturx-pdf',
|
|
2683
|
+
path_params=_path_params,
|
|
2684
|
+
query_params=_query_params,
|
|
2685
|
+
header_params=_header_params,
|
|
2686
|
+
body=_body_params,
|
|
2687
|
+
post_params=_form_params,
|
|
2688
|
+
files=_files,
|
|
2689
|
+
auth_settings=_auth_settings,
|
|
2690
|
+
collection_formats=_collection_formats,
|
|
2691
|
+
_host=_host,
|
|
2692
|
+
_request_auth=_request_auth
|
|
2693
|
+
)
|
|
2694
|
+
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
@validate_call
|
|
2699
|
+
def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post(
|
|
2700
|
+
self,
|
|
2701
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
|
|
2702
|
+
profile: Optional[Any] = None,
|
|
2703
|
+
use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.")] = None,
|
|
2704
|
+
callback_url: Optional[StrictStr] = None,
|
|
2705
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
2706
|
+
_request_timeout: Union[
|
|
2707
|
+
None,
|
|
2708
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2709
|
+
Tuple[
|
|
2710
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2711
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2712
|
+
]
|
|
2713
|
+
] = None,
|
|
2714
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2715
|
+
_content_type: Optional[StrictStr] = None,
|
|
2716
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2717
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2718
|
+
) -> TaskResponse:
|
|
2719
|
+
"""Validate a Factur-X PDF (asynchronous with polling)
|
|
2720
|
+
|
|
2721
|
+
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 ## Webhook notification (recommended) Instead of polling, you can receive a webhook notification when validation completes: ``` callback_url=https://your-server.com/webhook webhook_mode=download_url # Optional: get download URL instead of base64 ``` The webhook will POST a JSON payload with: - `event_type`: `validation.completed` or `validation.failed` - `data.is_compliant`: Whether the PDF is Factur-X compliant - `data.detected_profile`: The detected Factur-X profile - `X-Webhook-Signature` header for HMAC verification ## 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
|
|
2722
|
+
|
|
2723
|
+
:param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
|
|
2724
|
+
:type pdf_file: bytearray
|
|
2725
|
+
:param profile:
|
|
2726
|
+
:type profile: APIProfile
|
|
2727
|
+
:param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
|
|
2728
|
+
:type use_verapdf: bool
|
|
2729
|
+
:param callback_url:
|
|
2730
|
+
:type callback_url: str
|
|
2731
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
2732
|
+
:type webhook_mode: str
|
|
2733
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2734
|
+
number provided, it will be total request
|
|
2735
|
+
timeout. It can also be a pair (tuple) of
|
|
2736
|
+
(connection, read) timeouts.
|
|
2737
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2738
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2739
|
+
request; this effectively ignores the
|
|
2740
|
+
authentication in the spec for a single request.
|
|
2741
|
+
:type _request_auth: dict, optional
|
|
2742
|
+
:param _content_type: force content-type for the request.
|
|
2743
|
+
:type _content_type: str, Optional
|
|
2744
|
+
:param _headers: set to override the headers for a single
|
|
2745
|
+
request; this effectively ignores the headers
|
|
2746
|
+
in the spec for a single request.
|
|
2747
|
+
:type _headers: dict, optional
|
|
2748
|
+
:param _host_index: set to override the host_index for a single
|
|
2749
|
+
request; this effectively ignores the host_index
|
|
2750
|
+
in the spec for a single request.
|
|
2751
|
+
:type _host_index: int, optional
|
|
2752
|
+
:return: Returns the result object.
|
|
2753
|
+
""" # noqa: E501
|
|
2754
|
+
|
|
2755
|
+
_param = self._validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
|
|
2756
|
+
pdf_file=pdf_file,
|
|
2757
|
+
profile=profile,
|
|
2758
|
+
use_verapdf=use_verapdf,
|
|
2759
|
+
callback_url=callback_url,
|
|
2760
|
+
webhook_mode=webhook_mode,
|
|
2761
|
+
_request_auth=_request_auth,
|
|
2762
|
+
_content_type=_content_type,
|
|
2763
|
+
_headers=_headers,
|
|
2764
|
+
_host_index=_host_index
|
|
2765
|
+
)
|
|
2766
|
+
|
|
2767
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2768
|
+
'202': "TaskResponse",
|
|
2769
|
+
'400': None,
|
|
2770
|
+
'422': "HTTPValidationError",
|
|
2771
|
+
'401': "APIError",
|
|
2772
|
+
}
|
|
2773
|
+
response_data = self.api_client.call_api(
|
|
2774
|
+
*_param,
|
|
2775
|
+
_request_timeout=_request_timeout
|
|
2776
|
+
)
|
|
2777
|
+
response_data.read()
|
|
2778
|
+
return self.api_client.response_deserialize(
|
|
2779
|
+
response_data=response_data,
|
|
2780
|
+
response_types_map=_response_types_map,
|
|
2781
|
+
).data
|
|
2782
|
+
|
|
2783
|
+
|
|
2784
|
+
@validate_call
|
|
2785
|
+
def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(
|
|
2786
|
+
self,
|
|
2787
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
|
|
2788
|
+
profile: Optional[Any] = None,
|
|
2789
|
+
use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.")] = None,
|
|
2790
|
+
callback_url: Optional[StrictStr] = None,
|
|
2791
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
2792
|
+
_request_timeout: Union[
|
|
2793
|
+
None,
|
|
2794
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2795
|
+
Tuple[
|
|
2796
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2797
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2798
|
+
]
|
|
2799
|
+
] = None,
|
|
2800
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2801
|
+
_content_type: Optional[StrictStr] = None,
|
|
2802
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2803
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2804
|
+
) -> ApiResponse[TaskResponse]:
|
|
2805
|
+
"""Validate a Factur-X PDF (asynchronous with polling)
|
|
2806
|
+
|
|
2807
|
+
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 ## Webhook notification (recommended) Instead of polling, you can receive a webhook notification when validation completes: ``` callback_url=https://your-server.com/webhook webhook_mode=download_url # Optional: get download URL instead of base64 ``` The webhook will POST a JSON payload with: - `event_type`: `validation.completed` or `validation.failed` - `data.is_compliant`: Whether the PDF is Factur-X compliant - `data.detected_profile`: The detected Factur-X profile - `X-Webhook-Signature` header for HMAC verification ## 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
|
|
2808
|
+
|
|
2809
|
+
:param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
|
|
2810
|
+
:type pdf_file: bytearray
|
|
2811
|
+
:param profile:
|
|
2812
|
+
:type profile: APIProfile
|
|
2813
|
+
:param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
|
|
2814
|
+
:type use_verapdf: bool
|
|
2815
|
+
:param callback_url:
|
|
2816
|
+
:type callback_url: str
|
|
2817
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
2818
|
+
:type webhook_mode: str
|
|
2819
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2820
|
+
number provided, it will be total request
|
|
2821
|
+
timeout. It can also be a pair (tuple) of
|
|
2822
|
+
(connection, read) timeouts.
|
|
2823
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2824
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2825
|
+
request; this effectively ignores the
|
|
2826
|
+
authentication in the spec for a single request.
|
|
2827
|
+
:type _request_auth: dict, optional
|
|
2828
|
+
:param _content_type: force content-type for the request.
|
|
2829
|
+
:type _content_type: str, Optional
|
|
2830
|
+
:param _headers: set to override the headers for a single
|
|
2831
|
+
request; this effectively ignores the headers
|
|
2832
|
+
in the spec for a single request.
|
|
2833
|
+
:type _headers: dict, optional
|
|
2834
|
+
:param _host_index: set to override the host_index for a single
|
|
2835
|
+
request; this effectively ignores the host_index
|
|
2836
|
+
in the spec for a single request.
|
|
2837
|
+
:type _host_index: int, optional
|
|
2838
|
+
:return: Returns the result object.
|
|
2839
|
+
""" # noqa: E501
|
|
2840
|
+
|
|
2841
|
+
_param = self._validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
|
|
2842
|
+
pdf_file=pdf_file,
|
|
2843
|
+
profile=profile,
|
|
2844
|
+
use_verapdf=use_verapdf,
|
|
2845
|
+
callback_url=callback_url,
|
|
2846
|
+
webhook_mode=webhook_mode,
|
|
2847
|
+
_request_auth=_request_auth,
|
|
2848
|
+
_content_type=_content_type,
|
|
2849
|
+
_headers=_headers,
|
|
2850
|
+
_host_index=_host_index
|
|
2851
|
+
)
|
|
2852
|
+
|
|
2853
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2854
|
+
'202': "TaskResponse",
|
|
2855
|
+
'400': None,
|
|
2856
|
+
'422': "HTTPValidationError",
|
|
2857
|
+
'401': "APIError",
|
|
2858
|
+
}
|
|
2859
|
+
response_data = self.api_client.call_api(
|
|
2860
|
+
*_param,
|
|
2861
|
+
_request_timeout=_request_timeout
|
|
2862
|
+
)
|
|
2863
|
+
response_data.read()
|
|
2864
|
+
return self.api_client.response_deserialize(
|
|
2865
|
+
response_data=response_data,
|
|
2866
|
+
response_types_map=_response_types_map,
|
|
2867
|
+
)
|
|
2868
|
+
|
|
2869
|
+
|
|
2870
|
+
@validate_call
|
|
2871
|
+
def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_without_preload_content(
|
|
2872
|
+
self,
|
|
2873
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X PDF file to validate (.pdf format).")],
|
|
2874
|
+
profile: Optional[Any] = None,
|
|
2875
|
+
use_verapdf: Annotated[Optional[StrictBool], Field(description="Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.")] = None,
|
|
2876
|
+
callback_url: Optional[StrictStr] = None,
|
|
2877
|
+
webhook_mode: Annotated[Optional[StrictStr], Field(description="Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)")] = None,
|
|
2878
|
+
_request_timeout: Union[
|
|
2879
|
+
None,
|
|
2880
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2881
|
+
Tuple[
|
|
2882
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2883
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
2884
|
+
]
|
|
2885
|
+
] = None,
|
|
2886
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2887
|
+
_content_type: Optional[StrictStr] = None,
|
|
2888
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2889
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2890
|
+
) -> RESTResponseType:
|
|
2891
|
+
"""Validate a Factur-X PDF (asynchronous with polling)
|
|
2892
|
+
|
|
2893
|
+
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 ## Webhook notification (recommended) Instead of polling, you can receive a webhook notification when validation completes: ``` callback_url=https://your-server.com/webhook webhook_mode=download_url # Optional: get download URL instead of base64 ``` The webhook will POST a JSON payload with: - `event_type`: `validation.completed` or `validation.failed` - `data.is_compliant`: Whether the PDF is Factur-X compliant - `data.detected_profile`: The detected Factur-X profile - `X-Webhook-Signature` header for HMAC verification ## 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
|
|
2894
|
+
|
|
2895
|
+
:param pdf_file: Factur-X PDF file to validate (.pdf format). (required)
|
|
2896
|
+
:type pdf_file: bytearray
|
|
2897
|
+
:param profile:
|
|
2898
|
+
:type profile: APIProfile
|
|
2899
|
+
:param use_verapdf: Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
|
|
2900
|
+
:type use_verapdf: bool
|
|
2901
|
+
:param callback_url:
|
|
2902
|
+
:type callback_url: str
|
|
2903
|
+
:param webhook_mode: Webhook content delivery: 'inline' (base64 in payload) or 'download_url' (temporary URL, 1h TTL)
|
|
2904
|
+
:type webhook_mode: str
|
|
2905
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2906
|
+
number provided, it will be total request
|
|
2907
|
+
timeout. It can also be a pair (tuple) of
|
|
2908
|
+
(connection, read) timeouts.
|
|
2909
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2910
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2911
|
+
request; this effectively ignores the
|
|
2912
|
+
authentication in the spec for a single request.
|
|
2913
|
+
:type _request_auth: dict, optional
|
|
2914
|
+
:param _content_type: force content-type for the request.
|
|
2915
|
+
:type _content_type: str, Optional
|
|
2916
|
+
:param _headers: set to override the headers for a single
|
|
2917
|
+
request; this effectively ignores the headers
|
|
2918
|
+
in the spec for a single request.
|
|
2919
|
+
:type _headers: dict, optional
|
|
2920
|
+
:param _host_index: set to override the host_index for a single
|
|
2921
|
+
request; this effectively ignores the host_index
|
|
2922
|
+
in the spec for a single request.
|
|
2923
|
+
:type _host_index: int, optional
|
|
2924
|
+
:return: Returns the result object.
|
|
2925
|
+
""" # noqa: E501
|
|
2926
|
+
|
|
2927
|
+
_param = self._validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
|
|
2928
|
+
pdf_file=pdf_file,
|
|
2929
|
+
profile=profile,
|
|
2930
|
+
use_verapdf=use_verapdf,
|
|
2931
|
+
callback_url=callback_url,
|
|
2932
|
+
webhook_mode=webhook_mode,
|
|
2933
|
+
_request_auth=_request_auth,
|
|
2934
|
+
_content_type=_content_type,
|
|
2935
|
+
_headers=_headers,
|
|
2936
|
+
_host_index=_host_index
|
|
2937
|
+
)
|
|
2938
|
+
|
|
2939
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2940
|
+
'202': "TaskResponse",
|
|
2941
|
+
'400': None,
|
|
2942
|
+
'422': "HTTPValidationError",
|
|
2943
|
+
'401': "APIError",
|
|
2944
|
+
}
|
|
2945
|
+
response_data = self.api_client.call_api(
|
|
2946
|
+
*_param,
|
|
2947
|
+
_request_timeout=_request_timeout
|
|
2948
|
+
)
|
|
2949
|
+
return response_data.response
|
|
2950
|
+
|
|
2951
|
+
|
|
2952
|
+
def _validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_serialize(
|
|
2953
|
+
self,
|
|
2954
|
+
pdf_file,
|
|
2955
|
+
profile,
|
|
2956
|
+
use_verapdf,
|
|
2957
|
+
callback_url,
|
|
2958
|
+
webhook_mode,
|
|
2959
|
+
_request_auth,
|
|
2960
|
+
_content_type,
|
|
2961
|
+
_headers,
|
|
2962
|
+
_host_index,
|
|
2963
|
+
) -> RequestSerialized:
|
|
2964
|
+
|
|
2965
|
+
_host = None
|
|
2966
|
+
|
|
2967
|
+
_collection_formats: Dict[str, str] = {
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
_path_params: Dict[str, str] = {}
|
|
2971
|
+
_query_params: List[Tuple[str, str]] = []
|
|
2972
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
2973
|
+
_form_params: List[Tuple[str, str]] = []
|
|
2974
|
+
_files: Dict[
|
|
2975
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
2976
|
+
] = {}
|
|
2977
|
+
_body_params: Optional[bytes] = None
|
|
2978
|
+
|
|
2979
|
+
# process the path parameters
|
|
2980
|
+
# process the query parameters
|
|
2981
|
+
# process the header parameters
|
|
2982
|
+
# process the form parameters
|
|
2983
|
+
if pdf_file is not None:
|
|
2984
|
+
_files['pdf_file'] = pdf_file
|
|
2985
|
+
if profile is not None:
|
|
2986
|
+
_form_params.append(('profile', profile))
|
|
2987
|
+
if use_verapdf is not None:
|
|
2988
|
+
_form_params.append(('use_verapdf', use_verapdf))
|
|
2989
|
+
if callback_url is not None:
|
|
2990
|
+
_form_params.append(('callback_url', callback_url))
|
|
2991
|
+
if webhook_mode is not None:
|
|
2992
|
+
_form_params.append(('webhook_mode', webhook_mode))
|
|
2993
|
+
# process the body parameter
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
# set the HTTP header `Accept`
|
|
2997
|
+
if 'Accept' not in _header_params:
|
|
2998
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
2999
|
+
[
|
|
3000
|
+
'application/json'
|
|
3001
|
+
]
|
|
3002
|
+
)
|
|
3003
|
+
|
|
3004
|
+
# set the HTTP header `Content-Type`
|
|
3005
|
+
if _content_type:
|
|
3006
|
+
_header_params['Content-Type'] = _content_type
|
|
3007
|
+
else:
|
|
3008
|
+
_default_content_type = (
|
|
3009
|
+
self.api_client.select_header_content_type(
|
|
3010
|
+
[
|
|
3011
|
+
'multipart/form-data'
|
|
3012
|
+
]
|
|
3013
|
+
)
|
|
3014
|
+
)
|
|
3015
|
+
if _default_content_type is not None:
|
|
3016
|
+
_header_params['Content-Type'] = _default_content_type
|
|
3017
|
+
|
|
3018
|
+
# authentication setting
|
|
3019
|
+
_auth_settings: List[str] = [
|
|
3020
|
+
'HTTPBearer'
|
|
3021
|
+
]
|
|
3022
|
+
|
|
3023
|
+
return self.api_client.param_serialize(
|
|
3024
|
+
method='POST',
|
|
3025
|
+
resource_path='/api/v1/processing/validate-facturx-async',
|
|
3026
|
+
path_params=_path_params,
|
|
3027
|
+
query_params=_query_params,
|
|
3028
|
+
header_params=_header_params,
|
|
3029
|
+
body=_body_params,
|
|
3030
|
+
post_params=_form_params,
|
|
3031
|
+
files=_files,
|
|
3032
|
+
auth_settings=_auth_settings,
|
|
3033
|
+
collection_formats=_collection_formats,
|
|
3034
|
+
_host=_host,
|
|
3035
|
+
_request_auth=_request_auth
|
|
3036
|
+
)
|
|
3037
|
+
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
|
|
3041
|
+
@validate_call
|
|
3042
|
+
def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post(
|
|
3043
|
+
self,
|
|
3044
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to validate (will be analyzed to detect and validate signatures)")],
|
|
3045
|
+
_request_timeout: Union[
|
|
3046
|
+
None,
|
|
3047
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3048
|
+
Tuple[
|
|
3049
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3050
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
3051
|
+
]
|
|
3052
|
+
] = None,
|
|
3053
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
3054
|
+
_content_type: Optional[StrictStr] = None,
|
|
3055
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
3056
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
3057
|
+
) -> object:
|
|
3058
|
+
"""Validate electronic signatures of a PDF
|
|
3059
|
+
|
|
3060
|
+
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.
|
|
3061
|
+
|
|
3062
|
+
:param pdf_file: PDF file to validate (will be analyzed to detect and validate signatures) (required)
|
|
3063
|
+
:type pdf_file: bytearray
|
|
3064
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
3065
|
+
number provided, it will be total request
|
|
3066
|
+
timeout. It can also be a pair (tuple) of
|
|
3067
|
+
(connection, read) timeouts.
|
|
3068
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
3069
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
3070
|
+
request; this effectively ignores the
|
|
3071
|
+
authentication in the spec for a single request.
|
|
3072
|
+
:type _request_auth: dict, optional
|
|
3073
|
+
:param _content_type: force content-type for the request.
|
|
3074
|
+
:type _content_type: str, Optional
|
|
3075
|
+
:param _headers: set to override the headers for a single
|
|
3076
|
+
request; this effectively ignores the headers
|
|
3077
|
+
in the spec for a single request.
|
|
3078
|
+
:type _headers: dict, optional
|
|
3079
|
+
:param _host_index: set to override the host_index for a single
|
|
3080
|
+
request; this effectively ignores the host_index
|
|
3081
|
+
in the spec for a single request.
|
|
3082
|
+
:type _host_index: int, optional
|
|
3083
|
+
:return: Returns the result object.
|
|
3084
|
+
""" # noqa: E501
|
|
3085
|
+
|
|
3086
|
+
_param = self._validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
|
|
3087
|
+
pdf_file=pdf_file,
|
|
3088
|
+
_request_auth=_request_auth,
|
|
3089
|
+
_content_type=_content_type,
|
|
3090
|
+
_headers=_headers,
|
|
3091
|
+
_host_index=_host_index
|
|
3092
|
+
)
|
|
3093
|
+
|
|
3094
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
3095
|
+
'200': "object",
|
|
3096
|
+
'400': None,
|
|
3097
|
+
'422': "HTTPValidationError",
|
|
3098
|
+
'401': "APIError",
|
|
3099
|
+
}
|
|
3100
|
+
response_data = self.api_client.call_api(
|
|
3101
|
+
*_param,
|
|
3102
|
+
_request_timeout=_request_timeout
|
|
3103
|
+
)
|
|
3104
|
+
response_data.read()
|
|
3105
|
+
return self.api_client.response_deserialize(
|
|
3106
|
+
response_data=response_data,
|
|
3107
|
+
response_types_map=_response_types_map,
|
|
3108
|
+
).data
|
|
3109
|
+
|
|
3110
|
+
|
|
3111
|
+
@validate_call
|
|
3112
|
+
def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(
|
|
3113
|
+
self,
|
|
3114
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to validate (will be analyzed to detect and validate signatures)")],
|
|
3115
|
+
_request_timeout: Union[
|
|
3116
|
+
None,
|
|
3117
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3118
|
+
Tuple[
|
|
3119
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3120
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
3121
|
+
]
|
|
3122
|
+
] = None,
|
|
3123
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
3124
|
+
_content_type: Optional[StrictStr] = None,
|
|
3125
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
3126
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
3127
|
+
) -> ApiResponse[object]:
|
|
3128
|
+
"""Validate electronic signatures of a PDF
|
|
3129
|
+
|
|
3130
|
+
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.
|
|
3131
|
+
|
|
3132
|
+
:param pdf_file: PDF file to validate (will be analyzed to detect and validate signatures) (required)
|
|
3133
|
+
:type pdf_file: bytearray
|
|
3134
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
3135
|
+
number provided, it will be total request
|
|
3136
|
+
timeout. It can also be a pair (tuple) of
|
|
3137
|
+
(connection, read) timeouts.
|
|
3138
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
3139
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
3140
|
+
request; this effectively ignores the
|
|
3141
|
+
authentication in the spec for a single request.
|
|
3142
|
+
:type _request_auth: dict, optional
|
|
3143
|
+
:param _content_type: force content-type for the request.
|
|
3144
|
+
:type _content_type: str, Optional
|
|
3145
|
+
:param _headers: set to override the headers for a single
|
|
3146
|
+
request; this effectively ignores the headers
|
|
3147
|
+
in the spec for a single request.
|
|
3148
|
+
:type _headers: dict, optional
|
|
3149
|
+
:param _host_index: set to override the host_index for a single
|
|
3150
|
+
request; this effectively ignores the host_index
|
|
3151
|
+
in the spec for a single request.
|
|
3152
|
+
:type _host_index: int, optional
|
|
3153
|
+
:return: Returns the result object.
|
|
3154
|
+
""" # noqa: E501
|
|
3155
|
+
|
|
3156
|
+
_param = self._validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
|
|
3157
|
+
pdf_file=pdf_file,
|
|
3158
|
+
_request_auth=_request_auth,
|
|
3159
|
+
_content_type=_content_type,
|
|
3160
|
+
_headers=_headers,
|
|
3161
|
+
_host_index=_host_index
|
|
3162
|
+
)
|
|
3163
|
+
|
|
3164
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
3165
|
+
'200': "object",
|
|
3166
|
+
'400': None,
|
|
3167
|
+
'422': "HTTPValidationError",
|
|
3168
|
+
'401': "APIError",
|
|
3169
|
+
}
|
|
3170
|
+
response_data = self.api_client.call_api(
|
|
3171
|
+
*_param,
|
|
3172
|
+
_request_timeout=_request_timeout
|
|
3173
|
+
)
|
|
3174
|
+
response_data.read()
|
|
3175
|
+
return self.api_client.response_deserialize(
|
|
3176
|
+
response_data=response_data,
|
|
3177
|
+
response_types_map=_response_types_map,
|
|
3178
|
+
)
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
@validate_call
|
|
3182
|
+
def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_without_preload_content(
|
|
3183
|
+
self,
|
|
3184
|
+
pdf_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="PDF file to validate (will be analyzed to detect and validate signatures)")],
|
|
3185
|
+
_request_timeout: Union[
|
|
3186
|
+
None,
|
|
3187
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3188
|
+
Tuple[
|
|
3189
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3190
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
3191
|
+
]
|
|
3192
|
+
] = None,
|
|
3193
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
3194
|
+
_content_type: Optional[StrictStr] = None,
|
|
3195
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
3196
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
3197
|
+
) -> RESTResponseType:
|
|
3198
|
+
"""Validate electronic signatures of a PDF
|
|
3199
|
+
|
|
3200
|
+
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.
|
|
3201
|
+
|
|
3202
|
+
:param pdf_file: PDF file to validate (will be analyzed to detect and validate signatures) (required)
|
|
3203
|
+
:type pdf_file: bytearray
|
|
3204
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
3205
|
+
number provided, it will be total request
|
|
3206
|
+
timeout. It can also be a pair (tuple) of
|
|
3207
|
+
(connection, read) timeouts.
|
|
3208
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
3209
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
3210
|
+
request; this effectively ignores the
|
|
3211
|
+
authentication in the spec for a single request.
|
|
3212
|
+
:type _request_auth: dict, optional
|
|
3213
|
+
:param _content_type: force content-type for the request.
|
|
3214
|
+
:type _content_type: str, Optional
|
|
3215
|
+
:param _headers: set to override the headers for a single
|
|
3216
|
+
request; this effectively ignores the headers
|
|
3217
|
+
in the spec for a single request.
|
|
3218
|
+
:type _headers: dict, optional
|
|
3219
|
+
:param _host_index: set to override the host_index for a single
|
|
3220
|
+
request; this effectively ignores the host_index
|
|
3221
|
+
in the spec for a single request.
|
|
3222
|
+
:type _host_index: int, optional
|
|
3223
|
+
:return: Returns the result object.
|
|
3224
|
+
""" # noqa: E501
|
|
3225
|
+
|
|
3226
|
+
_param = self._validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
|
|
3227
|
+
pdf_file=pdf_file,
|
|
3228
|
+
_request_auth=_request_auth,
|
|
3229
|
+
_content_type=_content_type,
|
|
3230
|
+
_headers=_headers,
|
|
3231
|
+
_host_index=_host_index
|
|
3232
|
+
)
|
|
3233
|
+
|
|
3234
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
3235
|
+
'200': "object",
|
|
3236
|
+
'400': None,
|
|
3237
|
+
'422': "HTTPValidationError",
|
|
3238
|
+
'401': "APIError",
|
|
3239
|
+
}
|
|
3240
|
+
response_data = self.api_client.call_api(
|
|
3241
|
+
*_param,
|
|
3242
|
+
_request_timeout=_request_timeout
|
|
3243
|
+
)
|
|
3244
|
+
return response_data.response
|
|
3245
|
+
|
|
3246
|
+
|
|
3247
|
+
def _validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_serialize(
|
|
3248
|
+
self,
|
|
3249
|
+
pdf_file,
|
|
3250
|
+
_request_auth,
|
|
3251
|
+
_content_type,
|
|
3252
|
+
_headers,
|
|
3253
|
+
_host_index,
|
|
3254
|
+
) -> RequestSerialized:
|
|
3255
|
+
|
|
3256
|
+
_host = None
|
|
3257
|
+
|
|
3258
|
+
_collection_formats: Dict[str, str] = {
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
_path_params: Dict[str, str] = {}
|
|
3262
|
+
_query_params: List[Tuple[str, str]] = []
|
|
3263
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
3264
|
+
_form_params: List[Tuple[str, str]] = []
|
|
3265
|
+
_files: Dict[
|
|
3266
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
3267
|
+
] = {}
|
|
3268
|
+
_body_params: Optional[bytes] = None
|
|
3269
|
+
|
|
3270
|
+
# process the path parameters
|
|
3271
|
+
# process the query parameters
|
|
3272
|
+
# process the header parameters
|
|
3273
|
+
# process the form parameters
|
|
3274
|
+
if pdf_file is not None:
|
|
3275
|
+
_files['pdf_file'] = pdf_file
|
|
3276
|
+
# process the body parameter
|
|
3277
|
+
|
|
3278
|
+
|
|
3279
|
+
# set the HTTP header `Accept`
|
|
3280
|
+
if 'Accept' not in _header_params:
|
|
3281
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
3282
|
+
[
|
|
3283
|
+
'application/json'
|
|
3284
|
+
]
|
|
3285
|
+
)
|
|
3286
|
+
|
|
3287
|
+
# set the HTTP header `Content-Type`
|
|
3288
|
+
if _content_type:
|
|
3289
|
+
_header_params['Content-Type'] = _content_type
|
|
3290
|
+
else:
|
|
3291
|
+
_default_content_type = (
|
|
3292
|
+
self.api_client.select_header_content_type(
|
|
3293
|
+
[
|
|
3294
|
+
'multipart/form-data'
|
|
3295
|
+
]
|
|
3296
|
+
)
|
|
3297
|
+
)
|
|
3298
|
+
if _default_content_type is not None:
|
|
3299
|
+
_header_params['Content-Type'] = _default_content_type
|
|
3300
|
+
|
|
3301
|
+
# authentication setting
|
|
3302
|
+
_auth_settings: List[str] = [
|
|
3303
|
+
'HTTPBearer'
|
|
3304
|
+
]
|
|
3305
|
+
|
|
3306
|
+
return self.api_client.param_serialize(
|
|
3307
|
+
method='POST',
|
|
3308
|
+
resource_path='/api/v1/processing/validate-pdf-signature',
|
|
3309
|
+
path_params=_path_params,
|
|
3310
|
+
query_params=_query_params,
|
|
3311
|
+
header_params=_header_params,
|
|
3312
|
+
body=_body_params,
|
|
3313
|
+
post_params=_form_params,
|
|
3314
|
+
files=_files,
|
|
3315
|
+
auth_settings=_auth_settings,
|
|
3316
|
+
collection_formats=_collection_formats,
|
|
3317
|
+
_host=_host,
|
|
3318
|
+
_request_auth=_request_auth
|
|
3319
|
+
)
|
|
3320
|
+
|
|
3321
|
+
|
|
3322
|
+
|
|
3323
|
+
|
|
3324
|
+
@validate_call
|
|
3325
|
+
def validate_xml_api_v1_processing_validate_xml_post(
|
|
3326
|
+
self,
|
|
3327
|
+
xml_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X XML file to validate (.xml format).")],
|
|
3328
|
+
profile: Annotated[Optional[Any], Field(description="Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
|
|
3329
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
3330
|
+
_request_timeout: Union[
|
|
3331
|
+
None,
|
|
3332
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3333
|
+
Tuple[
|
|
3334
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3335
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
3336
|
+
]
|
|
3337
|
+
] = None,
|
|
3338
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
3339
|
+
_content_type: Optional[StrictStr] = None,
|
|
3340
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
3341
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
3342
|
+
) -> ValidationSuccessResponse:
|
|
3343
|
+
"""Validate an existing Factur-X XML
|
|
3344
|
+
|
|
3345
|
+
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
|
|
3346
|
+
|
|
3347
|
+
:param xml_file: Factur-X XML file to validate (.xml format). (required)
|
|
3348
|
+
:type xml_file: bytearray
|
|
3349
|
+
:param profile: Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
3350
|
+
:type profile: APIProfile
|
|
3351
|
+
:param skip_br_fr:
|
|
3352
|
+
:type skip_br_fr: bool
|
|
3353
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
3354
|
+
number provided, it will be total request
|
|
3355
|
+
timeout. It can also be a pair (tuple) of
|
|
3356
|
+
(connection, read) timeouts.
|
|
3357
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
3358
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
3359
|
+
request; this effectively ignores the
|
|
3360
|
+
authentication in the spec for a single request.
|
|
3361
|
+
:type _request_auth: dict, optional
|
|
3362
|
+
:param _content_type: force content-type for the request.
|
|
3363
|
+
:type _content_type: str, Optional
|
|
3364
|
+
:param _headers: set to override the headers for a single
|
|
3365
|
+
request; this effectively ignores the headers
|
|
3366
|
+
in the spec for a single request.
|
|
3367
|
+
:type _headers: dict, optional
|
|
3368
|
+
:param _host_index: set to override the host_index for a single
|
|
3369
|
+
request; this effectively ignores the host_index
|
|
3370
|
+
in the spec for a single request.
|
|
3371
|
+
:type _host_index: int, optional
|
|
3372
|
+
:return: Returns the result object.
|
|
3373
|
+
""" # noqa: E501
|
|
3374
|
+
|
|
3375
|
+
_param = self._validate_xml_api_v1_processing_validate_xml_post_serialize(
|
|
3376
|
+
xml_file=xml_file,
|
|
3377
|
+
profile=profile,
|
|
3378
|
+
skip_br_fr=skip_br_fr,
|
|
3379
|
+
_request_auth=_request_auth,
|
|
3380
|
+
_content_type=_content_type,
|
|
3381
|
+
_headers=_headers,
|
|
3382
|
+
_host_index=_host_index
|
|
3383
|
+
)
|
|
3384
|
+
|
|
3385
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
3386
|
+
'200': "ValidationSuccessResponse",
|
|
3387
|
+
'400': "ValidationErrorResponse",
|
|
3388
|
+
'422': "HTTPValidationError",
|
|
3389
|
+
'401': "APIError",
|
|
3390
|
+
}
|
|
3391
|
+
response_data = self.api_client.call_api(
|
|
3392
|
+
*_param,
|
|
3393
|
+
_request_timeout=_request_timeout
|
|
3394
|
+
)
|
|
3395
|
+
response_data.read()
|
|
3396
|
+
return self.api_client.response_deserialize(
|
|
3397
|
+
response_data=response_data,
|
|
3398
|
+
response_types_map=_response_types_map,
|
|
3399
|
+
).data
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
@validate_call
|
|
3403
|
+
def validate_xml_api_v1_processing_validate_xml_post_with_http_info(
|
|
3404
|
+
self,
|
|
3405
|
+
xml_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X XML file to validate (.xml format).")],
|
|
3406
|
+
profile: Annotated[Optional[Any], Field(description="Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
|
|
3407
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
3408
|
+
_request_timeout: Union[
|
|
3409
|
+
None,
|
|
3410
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3411
|
+
Tuple[
|
|
3412
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3413
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
3414
|
+
]
|
|
3415
|
+
] = None,
|
|
3416
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
3417
|
+
_content_type: Optional[StrictStr] = None,
|
|
3418
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
3419
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
3420
|
+
) -> ApiResponse[ValidationSuccessResponse]:
|
|
3421
|
+
"""Validate an existing Factur-X XML
|
|
3422
|
+
|
|
3423
|
+
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
|
|
3424
|
+
|
|
3425
|
+
:param xml_file: Factur-X XML file to validate (.xml format). (required)
|
|
3426
|
+
:type xml_file: bytearray
|
|
3427
|
+
:param profile: Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
3428
|
+
:type profile: APIProfile
|
|
3429
|
+
:param skip_br_fr:
|
|
3430
|
+
:type skip_br_fr: bool
|
|
3431
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
3432
|
+
number provided, it will be total request
|
|
3433
|
+
timeout. It can also be a pair (tuple) of
|
|
3434
|
+
(connection, read) timeouts.
|
|
3435
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
3436
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
3437
|
+
request; this effectively ignores the
|
|
3438
|
+
authentication in the spec for a single request.
|
|
3439
|
+
:type _request_auth: dict, optional
|
|
3440
|
+
:param _content_type: force content-type for the request.
|
|
3441
|
+
:type _content_type: str, Optional
|
|
3442
|
+
:param _headers: set to override the headers for a single
|
|
3443
|
+
request; this effectively ignores the headers
|
|
3444
|
+
in the spec for a single request.
|
|
3445
|
+
:type _headers: dict, optional
|
|
3446
|
+
:param _host_index: set to override the host_index for a single
|
|
3447
|
+
request; this effectively ignores the host_index
|
|
3448
|
+
in the spec for a single request.
|
|
3449
|
+
:type _host_index: int, optional
|
|
3450
|
+
:return: Returns the result object.
|
|
3451
|
+
""" # noqa: E501
|
|
3452
|
+
|
|
3453
|
+
_param = self._validate_xml_api_v1_processing_validate_xml_post_serialize(
|
|
3454
|
+
xml_file=xml_file,
|
|
3455
|
+
profile=profile,
|
|
3456
|
+
skip_br_fr=skip_br_fr,
|
|
3457
|
+
_request_auth=_request_auth,
|
|
3458
|
+
_content_type=_content_type,
|
|
3459
|
+
_headers=_headers,
|
|
3460
|
+
_host_index=_host_index
|
|
3461
|
+
)
|
|
3462
|
+
|
|
3463
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
3464
|
+
'200': "ValidationSuccessResponse",
|
|
3465
|
+
'400': "ValidationErrorResponse",
|
|
3466
|
+
'422': "HTTPValidationError",
|
|
3467
|
+
'401': "APIError",
|
|
3468
|
+
}
|
|
3469
|
+
response_data = self.api_client.call_api(
|
|
3470
|
+
*_param,
|
|
3471
|
+
_request_timeout=_request_timeout
|
|
3472
|
+
)
|
|
3473
|
+
response_data.read()
|
|
3474
|
+
return self.api_client.response_deserialize(
|
|
3475
|
+
response_data=response_data,
|
|
3476
|
+
response_types_map=_response_types_map,
|
|
3477
|
+
)
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
@validate_call
|
|
3481
|
+
def validate_xml_api_v1_processing_validate_xml_post_without_preload_content(
|
|
3482
|
+
self,
|
|
3483
|
+
xml_file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="Factur-X XML file to validate (.xml format).")],
|
|
3484
|
+
profile: Annotated[Optional[Any], Field(description="Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).")] = None,
|
|
3485
|
+
skip_br_fr: Optional[StrictBool] = None,
|
|
3486
|
+
_request_timeout: Union[
|
|
3487
|
+
None,
|
|
3488
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3489
|
+
Tuple[
|
|
3490
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
3491
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
3492
|
+
]
|
|
3493
|
+
] = None,
|
|
3494
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
3495
|
+
_content_type: Optional[StrictStr] = None,
|
|
3496
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
3497
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
3498
|
+
) -> RESTResponseType:
|
|
3499
|
+
"""Validate an existing Factur-X XML
|
|
3500
|
+
|
|
3501
|
+
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
|
|
3502
|
+
|
|
3503
|
+
:param xml_file: Factur-X XML file to validate (.xml format). (required)
|
|
3504
|
+
:type xml_file: bytearray
|
|
3505
|
+
:param profile: Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
3506
|
+
:type profile: APIProfile
|
|
3507
|
+
:param skip_br_fr:
|
|
3508
|
+
:type skip_br_fr: bool
|
|
3509
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
3510
|
+
number provided, it will be total request
|
|
3511
|
+
timeout. It can also be a pair (tuple) of
|
|
3512
|
+
(connection, read) timeouts.
|
|
3513
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
3514
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
3515
|
+
request; this effectively ignores the
|
|
3516
|
+
authentication in the spec for a single request.
|
|
3517
|
+
:type _request_auth: dict, optional
|
|
3518
|
+
:param _content_type: force content-type for the request.
|
|
3519
|
+
:type _content_type: str, Optional
|
|
3520
|
+
:param _headers: set to override the headers for a single
|
|
3521
|
+
request; this effectively ignores the headers
|
|
3522
|
+
in the spec for a single request.
|
|
3523
|
+
:type _headers: dict, optional
|
|
3524
|
+
:param _host_index: set to override the host_index for a single
|
|
3525
|
+
request; this effectively ignores the host_index
|
|
3526
|
+
in the spec for a single request.
|
|
3527
|
+
:type _host_index: int, optional
|
|
3528
|
+
:return: Returns the result object.
|
|
3529
|
+
""" # noqa: E501
|
|
3530
|
+
|
|
3531
|
+
_param = self._validate_xml_api_v1_processing_validate_xml_post_serialize(
|
|
3532
|
+
xml_file=xml_file,
|
|
3533
|
+
profile=profile,
|
|
3534
|
+
skip_br_fr=skip_br_fr,
|
|
3535
|
+
_request_auth=_request_auth,
|
|
3536
|
+
_content_type=_content_type,
|
|
3537
|
+
_headers=_headers,
|
|
3538
|
+
_host_index=_host_index
|
|
3539
|
+
)
|
|
3540
|
+
|
|
3541
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
3542
|
+
'200': "ValidationSuccessResponse",
|
|
3543
|
+
'400': "ValidationErrorResponse",
|
|
3544
|
+
'422': "HTTPValidationError",
|
|
3545
|
+
'401': "APIError",
|
|
3546
|
+
}
|
|
3547
|
+
response_data = self.api_client.call_api(
|
|
3548
|
+
*_param,
|
|
3549
|
+
_request_timeout=_request_timeout
|
|
3550
|
+
)
|
|
3551
|
+
return response_data.response
|
|
3552
|
+
|
|
3553
|
+
|
|
3554
|
+
def _validate_xml_api_v1_processing_validate_xml_post_serialize(
|
|
3555
|
+
self,
|
|
3556
|
+
xml_file,
|
|
3557
|
+
profile,
|
|
3558
|
+
skip_br_fr,
|
|
3559
|
+
_request_auth,
|
|
3560
|
+
_content_type,
|
|
3561
|
+
_headers,
|
|
3562
|
+
_host_index,
|
|
3563
|
+
) -> RequestSerialized:
|
|
3564
|
+
|
|
3565
|
+
_host = None
|
|
3566
|
+
|
|
3567
|
+
_collection_formats: Dict[str, str] = {
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
_path_params: Dict[str, str] = {}
|
|
3571
|
+
_query_params: List[Tuple[str, str]] = []
|
|
3572
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
3573
|
+
_form_params: List[Tuple[str, str]] = []
|
|
3574
|
+
_files: Dict[
|
|
3575
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
3576
|
+
] = {}
|
|
3577
|
+
_body_params: Optional[bytes] = None
|
|
3578
|
+
|
|
3579
|
+
# process the path parameters
|
|
3580
|
+
# process the query parameters
|
|
3581
|
+
# process the header parameters
|
|
3582
|
+
# process the form parameters
|
|
3583
|
+
if xml_file is not None:
|
|
3584
|
+
_files['xml_file'] = xml_file
|
|
3585
|
+
if profile is not None:
|
|
3586
|
+
_form_params.append(('profile', profile))
|
|
3587
|
+
if skip_br_fr is not None:
|
|
3588
|
+
_form_params.append(('skip_br_fr', skip_br_fr))
|
|
3589
|
+
# process the body parameter
|
|
3590
|
+
|
|
3591
|
+
|
|
3592
|
+
# set the HTTP header `Accept`
|
|
3593
|
+
if 'Accept' not in _header_params:
|
|
3594
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
3595
|
+
[
|
|
3596
|
+
'application/json'
|
|
3597
|
+
]
|
|
3598
|
+
)
|
|
3599
|
+
|
|
3600
|
+
# set the HTTP header `Content-Type`
|
|
3601
|
+
if _content_type:
|
|
3602
|
+
_header_params['Content-Type'] = _content_type
|
|
3603
|
+
else:
|
|
3604
|
+
_default_content_type = (
|
|
3605
|
+
self.api_client.select_header_content_type(
|
|
3606
|
+
[
|
|
3607
|
+
'multipart/form-data'
|
|
3608
|
+
]
|
|
3609
|
+
)
|
|
3610
|
+
)
|
|
3611
|
+
if _default_content_type is not None:
|
|
3612
|
+
_header_params['Content-Type'] = _default_content_type
|
|
3613
|
+
|
|
3614
|
+
# authentication setting
|
|
3615
|
+
_auth_settings: List[str] = [
|
|
3616
|
+
'HTTPBearer'
|
|
3617
|
+
]
|
|
3618
|
+
|
|
3619
|
+
return self.api_client.param_serialize(
|
|
3620
|
+
method='POST',
|
|
3621
|
+
resource_path='/api/v1/processing/validate-xml',
|
|
3622
|
+
path_params=_path_params,
|
|
3623
|
+
query_params=_query_params,
|
|
3624
|
+
header_params=_header_params,
|
|
3625
|
+
body=_body_params,
|
|
3626
|
+
post_params=_form_params,
|
|
3627
|
+
files=_files,
|
|
3628
|
+
auth_settings=_auth_settings,
|
|
3629
|
+
collection_formats=_collection_formats,
|
|
3630
|
+
_host=_host,
|
|
3631
|
+
_request_auth=_request_auth
|
|
3632
|
+
)
|
|
3633
|
+
|
|
3634
|
+
|