factpulse 2.0.37__py3-none-any.whl → 3.0.7__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 +265 -197
- factpulse/api/__init__.py +5 -4
- factpulse/api/afnorpdppa_api.py +34 -34
- factpulse/api/afnorpdppa_directory_service_api.py +59 -59
- factpulse/api/afnorpdppa_flow_service_api.py +23 -23
- factpulse/api/chorus_pro_api.py +211 -211
- factpulse/api/document_conversion_api.py +1506 -0
- factpulse/api/{sant_api.py → health_api.py} +22 -22
- factpulse/api/invoice_processing_api.py +3437 -0
- factpulse/api/{vrification_pdfxml_api.py → pdfxml_verification_api.py} +240 -240
- factpulse/api/{utilisateur_api.py → user_api.py} +17 -17
- factpulse/api_client.py +3 -3
- factpulse/configuration.py +3 -3
- factpulse/exceptions.py +2 -2
- factpulse/models/__init__.py +128 -95
- factpulse/models/acknowledgment_status.py +38 -0
- factpulse/models/additional_document.py +115 -0
- factpulse/models/afnor_credentials.py +106 -0
- factpulse/models/afnor_destination.py +127 -0
- factpulse/models/afnor_health_check_response.py +91 -0
- factpulse/models/afnor_result.py +105 -0
- factpulse/models/allowance_charge.py +147 -0
- factpulse/models/allowance_reason_code.py +42 -0
- factpulse/models/allowance_total_amount.py +145 -0
- factpulse/models/amount.py +139 -0
- factpulse/models/amount_due.py +139 -0
- factpulse/models/api_error.py +5 -5
- factpulse/models/async_task_status.py +97 -0
- factpulse/models/base_amount.py +145 -0
- factpulse/models/bounding_box_schema.py +10 -10
- factpulse/models/celery_status.py +40 -0
- factpulse/models/certificate_info_response.py +24 -24
- factpulse/models/charge_total_amount.py +145 -0
- factpulse/models/chorus_pro_destination.py +108 -0
- factpulse/models/chorus_pro_result.py +101 -0
- factpulse/models/contact.py +113 -0
- factpulse/models/convert_error_response.py +105 -0
- factpulse/models/convert_pending_input_response.py +114 -0
- factpulse/models/convert_resume_request.py +87 -0
- factpulse/models/convert_success_response.py +126 -0
- factpulse/models/convert_validation_failed_response.py +120 -0
- factpulse/models/delivery_party.py +121 -0
- factpulse/models/destination.py +27 -27
- factpulse/models/document_type_info.py +91 -0
- factpulse/models/electronic_address.py +90 -0
- factpulse/models/enriched_invoice_info.py +133 -0
- factpulse/models/error_level.py +2 -2
- factpulse/models/error_source.py +2 -2
- factpulse/models/extraction_info.py +93 -0
- factpulse/models/factur_x_invoice.py +320 -0
- factpulse/models/factur_x_profile.py +39 -0
- factpulse/models/factur_xpdf_info.py +91 -0
- factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.py +95 -0
- factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.py +115 -0
- factpulse/models/field_status.py +40 -0
- factpulse/models/file_info.py +94 -0
- factpulse/models/files_info.py +106 -0
- factpulse/models/flow_direction.py +37 -0
- factpulse/models/flow_profile.py +38 -0
- factpulse/models/flow_summary.py +131 -0
- factpulse/models/flow_syntax.py +40 -0
- factpulse/models/flow_type.py +40 -0
- factpulse/models/generate_certificate_request.py +26 -26
- factpulse/models/generate_certificate_response.py +15 -15
- factpulse/models/get_chorus_pro_id_request.py +100 -0
- factpulse/models/get_chorus_pro_id_response.py +98 -0
- factpulse/models/get_invoice_request.py +98 -0
- factpulse/models/get_invoice_response.py +142 -0
- factpulse/models/get_structure_request.py +100 -0
- factpulse/models/get_structure_response.py +142 -0
- factpulse/models/global_allowance_amount.py +139 -0
- factpulse/models/gross_unit_price.py +145 -0
- factpulse/models/http_validation_error.py +2 -2
- factpulse/models/incoming_invoice.py +196 -0
- factpulse/models/incoming_supplier.py +144 -0
- factpulse/models/invoice_format.py +38 -0
- factpulse/models/invoice_line.py +354 -0
- factpulse/models/invoice_line_allowance_amount.py +145 -0
- factpulse/models/invoice_note.py +94 -0
- factpulse/models/invoice_references.py +194 -0
- factpulse/models/invoice_status.py +96 -0
- factpulse/models/invoice_totals.py +177 -0
- factpulse/models/invoice_totals_prepayment.py +145 -0
- factpulse/models/invoice_type_code.py +51 -0
- factpulse/models/invoicing_framework.py +110 -0
- factpulse/models/invoicing_framework_code.py +39 -0
- factpulse/models/line_net_amount.py +145 -0
- factpulse/models/line_total_amount.py +145 -0
- factpulse/models/mandatory_note_schema.py +124 -0
- factpulse/models/manual_rate.py +139 -0
- factpulse/models/manual_vat_rate.py +139 -0
- factpulse/models/missing_field.py +107 -0
- factpulse/models/operation_nature.py +49 -0
- factpulse/models/output_format.py +37 -0
- factpulse/models/page_dimensions_schema.py +89 -0
- factpulse/models/payee.py +168 -0
- factpulse/models/payment_card.py +99 -0
- factpulse/models/payment_means.py +41 -0
- factpulse/models/pdf_validation_result_api.py +169 -0
- factpulse/models/pdp_credentials.py +15 -15
- factpulse/models/percentage.py +145 -0
- factpulse/models/postal_address.py +134 -0
- factpulse/models/price_allowance_amount.py +145 -0
- factpulse/models/price_basis_quantity.py +145 -0
- factpulse/models/processing_options.py +94 -0
- factpulse/models/product_characteristic.py +89 -0
- factpulse/models/product_classification.py +101 -0
- factpulse/models/quantity.py +139 -0
- factpulse/models/recipient.py +167 -0
- factpulse/models/rounding_amount.py +145 -0
- factpulse/models/scheme_id.py +10 -4
- factpulse/models/search_flow_request.py +143 -0
- factpulse/models/search_flow_response.py +101 -0
- factpulse/models/search_services_response.py +101 -0
- factpulse/models/search_structure_request.py +119 -0
- factpulse/models/search_structure_response.py +101 -0
- factpulse/models/signature_info.py +6 -6
- factpulse/models/signature_info_api.py +122 -0
- factpulse/models/signature_parameters.py +133 -0
- factpulse/models/simplified_invoice_data.py +124 -0
- factpulse/models/structure_info.py +14 -14
- factpulse/models/structure_parameters.py +91 -0
- factpulse/models/structure_service.py +93 -0
- factpulse/models/submission_mode.py +38 -0
- factpulse/models/submit_complete_invoice_request.py +116 -0
- factpulse/models/submit_complete_invoice_response.py +145 -0
- factpulse/models/submit_flow_request.py +123 -0
- factpulse/models/submit_flow_response.py +109 -0
- factpulse/models/submit_gross_amount.py +139 -0
- factpulse/models/submit_invoice_request.py +176 -0
- factpulse/models/submit_invoice_response.py +103 -0
- factpulse/models/submit_net_amount.py +139 -0
- factpulse/models/submit_vat_amount.py +139 -0
- factpulse/models/supplementary_attachment.py +95 -0
- factpulse/models/supplier.py +225 -0
- factpulse/models/task_response.py +87 -0
- factpulse/models/tax_representative.py +95 -0
- factpulse/models/taxable_amount.py +139 -0
- factpulse/models/total_gross_amount.py +139 -0
- factpulse/models/total_net_amount.py +139 -0
- factpulse/models/total_vat_amount.py +139 -0
- factpulse/models/unit_net_price.py +139 -0
- factpulse/models/unit_of_measure.py +41 -0
- factpulse/models/validation_error.py +2 -2
- factpulse/models/validation_error_detail.py +6 -6
- factpulse/models/validation_error_loc_inner.py +2 -2
- factpulse/models/validation_error_response.py +87 -0
- factpulse/models/validation_info.py +105 -0
- factpulse/models/validation_success_response.py +87 -0
- factpulse/models/vat_accounting_code.py +39 -0
- factpulse/models/vat_amount.py +139 -0
- factpulse/models/vat_category.py +44 -0
- factpulse/models/vat_line.py +140 -0
- factpulse/models/vat_point_date_code.py +38 -0
- factpulse/models/vat_rate.py +145 -0
- factpulse/models/verification_success_response.py +135 -0
- factpulse/models/verified_field_schema.py +129 -0
- factpulse/rest.py +2 -2
- factpulse-3.0.7.dist-info/METADATA +292 -0
- factpulse-3.0.7.dist-info/RECORD +168 -0
- factpulse_helpers/__init__.py +34 -34
- factpulse_helpers/client.py +1019 -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/chorus_pro_credentials.py +0 -95
- 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-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.7.dist-info}/WHEEL +0 -0
- {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/licenses/LICENSE +0 -0
- {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
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://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from factpulse.models.invoice_type_code import InvoiceTypeCode
|
|
23
|
+
from factpulse.models.payment_means import PaymentMeans
|
|
24
|
+
from factpulse.models.vat_accounting_code import VATAccountingCode
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class InvoiceReferences(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Contains various invoice references (currency, type, etc.).
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
business_process_id: Optional[StrictStr] = None
|
|
33
|
+
invoice_currency: Optional[StrictStr] = Field(default='EUR', description="Invoice currency code (BT-5). ISO 4217.")
|
|
34
|
+
payment_means: PaymentMeans = Field(description="Payment means type code (BT-81).")
|
|
35
|
+
payment_means_text: Optional[StrictStr] = None
|
|
36
|
+
invoice_type: InvoiceTypeCode
|
|
37
|
+
vat_accounting_code: VATAccountingCode = Field(description="VAT accounting code.")
|
|
38
|
+
buyer_reference: Optional[StrictStr] = None
|
|
39
|
+
contract_reference: Optional[StrictStr] = None
|
|
40
|
+
purchase_order_reference: Optional[StrictStr] = None
|
|
41
|
+
seller_order_reference: Optional[StrictStr] = None
|
|
42
|
+
receiving_advice_reference: Optional[StrictStr] = None
|
|
43
|
+
despatch_advice_reference: Optional[StrictStr] = None
|
|
44
|
+
tender_reference: Optional[StrictStr] = None
|
|
45
|
+
preceding_invoice_reference: Optional[StrictStr] = None
|
|
46
|
+
preceding_invoice_date: Optional[StrictStr] = None
|
|
47
|
+
project_reference: Optional[StrictStr] = None
|
|
48
|
+
project_name: Optional[StrictStr] = None
|
|
49
|
+
vat_exemption_reason: Optional[StrictStr] = None
|
|
50
|
+
__properties: ClassVar[List[str]] = ["business_process_id", "invoice_currency", "payment_means", "payment_means_text", "invoice_type", "vat_accounting_code", "buyer_reference", "contract_reference", "purchase_order_reference", "seller_order_reference", "receiving_advice_reference", "despatch_advice_reference", "tender_reference", "preceding_invoice_reference", "preceding_invoice_date", "project_reference", "project_name", "vat_exemption_reason"]
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
populate_by_name=True,
|
|
54
|
+
validate_assignment=True,
|
|
55
|
+
protected_namespaces=(),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def to_str(self) -> str:
|
|
60
|
+
"""Returns the string representation of the model using alias"""
|
|
61
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
62
|
+
|
|
63
|
+
def to_json(self) -> str:
|
|
64
|
+
"""Returns the JSON representation of the model using alias"""
|
|
65
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
66
|
+
return json.dumps(self.to_dict())
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
|
+
"""Create an instance of InvoiceReferences from a JSON string"""
|
|
71
|
+
return cls.from_dict(json.loads(json_str))
|
|
72
|
+
|
|
73
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
74
|
+
"""Return the dictionary representation of the model using alias.
|
|
75
|
+
|
|
76
|
+
This has the following differences from calling pydantic's
|
|
77
|
+
`self.model_dump(by_alias=True)`:
|
|
78
|
+
|
|
79
|
+
* `None` is only added to the output dict for nullable fields that
|
|
80
|
+
were set at model initialization. Other fields with value `None`
|
|
81
|
+
are ignored.
|
|
82
|
+
"""
|
|
83
|
+
excluded_fields: Set[str] = set([
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
_dict = self.model_dump(
|
|
87
|
+
by_alias=True,
|
|
88
|
+
exclude=excluded_fields,
|
|
89
|
+
exclude_none=True,
|
|
90
|
+
)
|
|
91
|
+
# set to None if business_process_id (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.business_process_id is None and "business_process_id" in self.model_fields_set:
|
|
94
|
+
_dict['business_process_id'] = None
|
|
95
|
+
|
|
96
|
+
# set to None if payment_means_text (nullable) is None
|
|
97
|
+
# and model_fields_set contains the field
|
|
98
|
+
if self.payment_means_text is None and "payment_means_text" in self.model_fields_set:
|
|
99
|
+
_dict['payment_means_text'] = None
|
|
100
|
+
|
|
101
|
+
# set to None if buyer_reference (nullable) is None
|
|
102
|
+
# and model_fields_set contains the field
|
|
103
|
+
if self.buyer_reference is None and "buyer_reference" in self.model_fields_set:
|
|
104
|
+
_dict['buyer_reference'] = None
|
|
105
|
+
|
|
106
|
+
# set to None if contract_reference (nullable) is None
|
|
107
|
+
# and model_fields_set contains the field
|
|
108
|
+
if self.contract_reference is None and "contract_reference" in self.model_fields_set:
|
|
109
|
+
_dict['contract_reference'] = None
|
|
110
|
+
|
|
111
|
+
# set to None if purchase_order_reference (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.purchase_order_reference is None and "purchase_order_reference" in self.model_fields_set:
|
|
114
|
+
_dict['purchase_order_reference'] = None
|
|
115
|
+
|
|
116
|
+
# set to None if seller_order_reference (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.seller_order_reference is None and "seller_order_reference" in self.model_fields_set:
|
|
119
|
+
_dict['seller_order_reference'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if receiving_advice_reference (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.receiving_advice_reference is None and "receiving_advice_reference" in self.model_fields_set:
|
|
124
|
+
_dict['receiving_advice_reference'] = None
|
|
125
|
+
|
|
126
|
+
# set to None if despatch_advice_reference (nullable) is None
|
|
127
|
+
# and model_fields_set contains the field
|
|
128
|
+
if self.despatch_advice_reference is None and "despatch_advice_reference" in self.model_fields_set:
|
|
129
|
+
_dict['despatch_advice_reference'] = None
|
|
130
|
+
|
|
131
|
+
# set to None if tender_reference (nullable) is None
|
|
132
|
+
# and model_fields_set contains the field
|
|
133
|
+
if self.tender_reference is None and "tender_reference" in self.model_fields_set:
|
|
134
|
+
_dict['tender_reference'] = None
|
|
135
|
+
|
|
136
|
+
# set to None if preceding_invoice_reference (nullable) is None
|
|
137
|
+
# and model_fields_set contains the field
|
|
138
|
+
if self.preceding_invoice_reference is None and "preceding_invoice_reference" in self.model_fields_set:
|
|
139
|
+
_dict['preceding_invoice_reference'] = None
|
|
140
|
+
|
|
141
|
+
# set to None if preceding_invoice_date (nullable) is None
|
|
142
|
+
# and model_fields_set contains the field
|
|
143
|
+
if self.preceding_invoice_date is None and "preceding_invoice_date" in self.model_fields_set:
|
|
144
|
+
_dict['preceding_invoice_date'] = None
|
|
145
|
+
|
|
146
|
+
# set to None if project_reference (nullable) is None
|
|
147
|
+
# and model_fields_set contains the field
|
|
148
|
+
if self.project_reference is None and "project_reference" in self.model_fields_set:
|
|
149
|
+
_dict['project_reference'] = None
|
|
150
|
+
|
|
151
|
+
# set to None if project_name (nullable) is None
|
|
152
|
+
# and model_fields_set contains the field
|
|
153
|
+
if self.project_name is None and "project_name" in self.model_fields_set:
|
|
154
|
+
_dict['project_name'] = None
|
|
155
|
+
|
|
156
|
+
# set to None if vat_exemption_reason (nullable) is None
|
|
157
|
+
# and model_fields_set contains the field
|
|
158
|
+
if self.vat_exemption_reason is None and "vat_exemption_reason" in self.model_fields_set:
|
|
159
|
+
_dict['vat_exemption_reason'] = None
|
|
160
|
+
|
|
161
|
+
return _dict
|
|
162
|
+
|
|
163
|
+
@classmethod
|
|
164
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
165
|
+
"""Create an instance of InvoiceReferences from a dict"""
|
|
166
|
+
if obj is None:
|
|
167
|
+
return None
|
|
168
|
+
|
|
169
|
+
if not isinstance(obj, dict):
|
|
170
|
+
return cls.model_validate(obj)
|
|
171
|
+
|
|
172
|
+
_obj = cls.model_validate({
|
|
173
|
+
"business_process_id": obj.get("business_process_id"),
|
|
174
|
+
"invoice_currency": obj.get("invoice_currency") if obj.get("invoice_currency") is not None else 'EUR',
|
|
175
|
+
"payment_means": obj.get("payment_means"),
|
|
176
|
+
"payment_means_text": obj.get("payment_means_text"),
|
|
177
|
+
"invoice_type": obj.get("invoice_type"),
|
|
178
|
+
"vat_accounting_code": obj.get("vat_accounting_code"),
|
|
179
|
+
"buyer_reference": obj.get("buyer_reference"),
|
|
180
|
+
"contract_reference": obj.get("contract_reference"),
|
|
181
|
+
"purchase_order_reference": obj.get("purchase_order_reference"),
|
|
182
|
+
"seller_order_reference": obj.get("seller_order_reference"),
|
|
183
|
+
"receiving_advice_reference": obj.get("receiving_advice_reference"),
|
|
184
|
+
"despatch_advice_reference": obj.get("despatch_advice_reference"),
|
|
185
|
+
"tender_reference": obj.get("tender_reference"),
|
|
186
|
+
"preceding_invoice_reference": obj.get("preceding_invoice_reference"),
|
|
187
|
+
"preceding_invoice_date": obj.get("preceding_invoice_date"),
|
|
188
|
+
"project_reference": obj.get("project_reference"),
|
|
189
|
+
"project_name": obj.get("project_name"),
|
|
190
|
+
"vat_exemption_reason": obj.get("vat_exemption_reason")
|
|
191
|
+
})
|
|
192
|
+
return _obj
|
|
193
|
+
|
|
194
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
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://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class InvoiceStatus(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Chorus Pro invoice status.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
code: StrictStr = Field(description="Status code (SOUMISE, VALIDEE, REJETEE, SUSPENDUE, MANDATEE, MISE_EN_PAIEMENT, etc.)")
|
|
30
|
+
label: StrictStr = Field(description="Status label")
|
|
31
|
+
var_date: Optional[StrictStr] = Field(default=None, alias="date")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["code", "label", "date"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of InvoiceStatus from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# set to None if var_date (nullable) is None
|
|
74
|
+
# and model_fields_set contains the field
|
|
75
|
+
if self.var_date is None and "var_date" in self.model_fields_set:
|
|
76
|
+
_dict['date'] = None
|
|
77
|
+
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of InvoiceStatus from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"code": obj.get("code"),
|
|
91
|
+
"label": obj.get("label"),
|
|
92
|
+
"date": obj.get("date")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,177 @@
|
|
|
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://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from factpulse.models.allowance_total_amount import AllowanceTotalAmount
|
|
23
|
+
from factpulse.models.amount_due import AmountDue
|
|
24
|
+
from factpulse.models.charge_total_amount import ChargeTotalAmount
|
|
25
|
+
from factpulse.models.global_allowance_amount import GlobalAllowanceAmount
|
|
26
|
+
from factpulse.models.invoice_totals_prepayment import InvoiceTotalsPrepayment
|
|
27
|
+
from factpulse.models.line_total_amount import LineTotalAmount
|
|
28
|
+
from factpulse.models.rounding_amount import RoundingAmount
|
|
29
|
+
from factpulse.models.total_gross_amount import TotalGrossAmount
|
|
30
|
+
from factpulse.models.total_net_amount import TotalNetAmount
|
|
31
|
+
from factpulse.models.total_vat_amount import TotalVATAmount
|
|
32
|
+
from typing import Optional, Set
|
|
33
|
+
from typing_extensions import Self
|
|
34
|
+
|
|
35
|
+
class InvoiceTotals(BaseModel):
|
|
36
|
+
"""
|
|
37
|
+
Contains all invoice total amounts (BG-22).
|
|
38
|
+
""" # noqa: E501
|
|
39
|
+
line_total_amount: Optional[LineTotalAmount] = None
|
|
40
|
+
allowance_total_amount: Optional[AllowanceTotalAmount] = None
|
|
41
|
+
charge_total_amount: Optional[ChargeTotalAmount] = None
|
|
42
|
+
total_net_amount: TotalNetAmount
|
|
43
|
+
vat_amount: TotalVATAmount
|
|
44
|
+
total_gross_amount: TotalGrossAmount
|
|
45
|
+
prepayment: Optional[InvoiceTotalsPrepayment] = None
|
|
46
|
+
rounding_amount: Optional[RoundingAmount] = None
|
|
47
|
+
amount_due: AmountDue
|
|
48
|
+
global_allowance_amount: Optional[GlobalAllowanceAmount] = Field(default=None, alias="globalAllowanceAmount")
|
|
49
|
+
global_allowance_reason: Optional[StrictStr] = Field(default=None, alias="globalAllowanceReason")
|
|
50
|
+
__properties: ClassVar[List[str]] = ["line_total_amount", "allowance_total_amount", "charge_total_amount", "total_net_amount", "vat_amount", "total_gross_amount", "prepayment", "rounding_amount", "amount_due", "globalAllowanceAmount", "globalAllowanceReason"]
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
populate_by_name=True,
|
|
54
|
+
validate_assignment=True,
|
|
55
|
+
protected_namespaces=(),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def to_str(self) -> str:
|
|
60
|
+
"""Returns the string representation of the model using alias"""
|
|
61
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
62
|
+
|
|
63
|
+
def to_json(self) -> str:
|
|
64
|
+
"""Returns the JSON representation of the model using alias"""
|
|
65
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
66
|
+
return json.dumps(self.to_dict())
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
|
+
"""Create an instance of InvoiceTotals from a JSON string"""
|
|
71
|
+
return cls.from_dict(json.loads(json_str))
|
|
72
|
+
|
|
73
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
74
|
+
"""Return the dictionary representation of the model using alias.
|
|
75
|
+
|
|
76
|
+
This has the following differences from calling pydantic's
|
|
77
|
+
`self.model_dump(by_alias=True)`:
|
|
78
|
+
|
|
79
|
+
* `None` is only added to the output dict for nullable fields that
|
|
80
|
+
were set at model initialization. Other fields with value `None`
|
|
81
|
+
are ignored.
|
|
82
|
+
"""
|
|
83
|
+
excluded_fields: Set[str] = set([
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
_dict = self.model_dump(
|
|
87
|
+
by_alias=True,
|
|
88
|
+
exclude=excluded_fields,
|
|
89
|
+
exclude_none=True,
|
|
90
|
+
)
|
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of line_total_amount
|
|
92
|
+
if self.line_total_amount:
|
|
93
|
+
_dict['line_total_amount'] = self.line_total_amount.to_dict()
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of allowance_total_amount
|
|
95
|
+
if self.allowance_total_amount:
|
|
96
|
+
_dict['allowance_total_amount'] = self.allowance_total_amount.to_dict()
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of charge_total_amount
|
|
98
|
+
if self.charge_total_amount:
|
|
99
|
+
_dict['charge_total_amount'] = self.charge_total_amount.to_dict()
|
|
100
|
+
# override the default output from pydantic by calling `to_dict()` of total_net_amount
|
|
101
|
+
if self.total_net_amount:
|
|
102
|
+
_dict['total_net_amount'] = self.total_net_amount.to_dict()
|
|
103
|
+
# override the default output from pydantic by calling `to_dict()` of vat_amount
|
|
104
|
+
if self.vat_amount:
|
|
105
|
+
_dict['vat_amount'] = self.vat_amount.to_dict()
|
|
106
|
+
# override the default output from pydantic by calling `to_dict()` of total_gross_amount
|
|
107
|
+
if self.total_gross_amount:
|
|
108
|
+
_dict['total_gross_amount'] = self.total_gross_amount.to_dict()
|
|
109
|
+
# override the default output from pydantic by calling `to_dict()` of prepayment
|
|
110
|
+
if self.prepayment:
|
|
111
|
+
_dict['prepayment'] = self.prepayment.to_dict()
|
|
112
|
+
# override the default output from pydantic by calling `to_dict()` of rounding_amount
|
|
113
|
+
if self.rounding_amount:
|
|
114
|
+
_dict['rounding_amount'] = self.rounding_amount.to_dict()
|
|
115
|
+
# override the default output from pydantic by calling `to_dict()` of amount_due
|
|
116
|
+
if self.amount_due:
|
|
117
|
+
_dict['amount_due'] = self.amount_due.to_dict()
|
|
118
|
+
# override the default output from pydantic by calling `to_dict()` of global_allowance_amount
|
|
119
|
+
if self.global_allowance_amount:
|
|
120
|
+
_dict['globalAllowanceAmount'] = self.global_allowance_amount.to_dict()
|
|
121
|
+
# set to None if line_total_amount (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.line_total_amount is None and "line_total_amount" in self.model_fields_set:
|
|
124
|
+
_dict['line_total_amount'] = None
|
|
125
|
+
|
|
126
|
+
# set to None if allowance_total_amount (nullable) is None
|
|
127
|
+
# and model_fields_set contains the field
|
|
128
|
+
if self.allowance_total_amount is None and "allowance_total_amount" in self.model_fields_set:
|
|
129
|
+
_dict['allowance_total_amount'] = None
|
|
130
|
+
|
|
131
|
+
# set to None if charge_total_amount (nullable) is None
|
|
132
|
+
# and model_fields_set contains the field
|
|
133
|
+
if self.charge_total_amount is None and "charge_total_amount" in self.model_fields_set:
|
|
134
|
+
_dict['charge_total_amount'] = None
|
|
135
|
+
|
|
136
|
+
# set to None if prepayment (nullable) is None
|
|
137
|
+
# and model_fields_set contains the field
|
|
138
|
+
if self.prepayment is None and "prepayment" in self.model_fields_set:
|
|
139
|
+
_dict['prepayment'] = None
|
|
140
|
+
|
|
141
|
+
# set to None if rounding_amount (nullable) is None
|
|
142
|
+
# and model_fields_set contains the field
|
|
143
|
+
if self.rounding_amount is None and "rounding_amount" in self.model_fields_set:
|
|
144
|
+
_dict['rounding_amount'] = None
|
|
145
|
+
|
|
146
|
+
# set to None if global_allowance_reason (nullable) is None
|
|
147
|
+
# and model_fields_set contains the field
|
|
148
|
+
if self.global_allowance_reason is None and "global_allowance_reason" in self.model_fields_set:
|
|
149
|
+
_dict['globalAllowanceReason'] = None
|
|
150
|
+
|
|
151
|
+
return _dict
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
155
|
+
"""Create an instance of InvoiceTotals from a dict"""
|
|
156
|
+
if obj is None:
|
|
157
|
+
return None
|
|
158
|
+
|
|
159
|
+
if not isinstance(obj, dict):
|
|
160
|
+
return cls.model_validate(obj)
|
|
161
|
+
|
|
162
|
+
_obj = cls.model_validate({
|
|
163
|
+
"line_total_amount": LineTotalAmount.from_dict(obj["line_total_amount"]) if obj.get("line_total_amount") is not None else None,
|
|
164
|
+
"allowance_total_amount": AllowanceTotalAmount.from_dict(obj["allowance_total_amount"]) if obj.get("allowance_total_amount") is not None else None,
|
|
165
|
+
"charge_total_amount": ChargeTotalAmount.from_dict(obj["charge_total_amount"]) if obj.get("charge_total_amount") is not None else None,
|
|
166
|
+
"total_net_amount": TotalNetAmount.from_dict(obj["total_net_amount"]) if obj.get("total_net_amount") is not None else None,
|
|
167
|
+
"vat_amount": TotalVATAmount.from_dict(obj["vat_amount"]) if obj.get("vat_amount") is not None else None,
|
|
168
|
+
"total_gross_amount": TotalGrossAmount.from_dict(obj["total_gross_amount"]) if obj.get("total_gross_amount") is not None else None,
|
|
169
|
+
"prepayment": InvoiceTotalsPrepayment.from_dict(obj["prepayment"]) if obj.get("prepayment") is not None else None,
|
|
170
|
+
"rounding_amount": RoundingAmount.from_dict(obj["rounding_amount"]) if obj.get("rounding_amount") is not None else None,
|
|
171
|
+
"amount_due": AmountDue.from_dict(obj["amount_due"]) if obj.get("amount_due") is not None else None,
|
|
172
|
+
"globalAllowanceAmount": GlobalAllowanceAmount.from_dict(obj["globalAllowanceAmount"]) if obj.get("globalAllowanceAmount") is not None else None,
|
|
173
|
+
"globalAllowanceReason": obj.get("globalAllowanceReason")
|
|
174
|
+
})
|
|
175
|
+
return _obj
|
|
176
|
+
|
|
177
|
+
|
|
@@ -0,0 +1,145 @@
|
|
|
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://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
from inspect import getfullargspec
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
|
|
21
|
+
from typing import Optional, Union
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
from pydantic import Field
|
|
26
|
+
|
|
27
|
+
INVOICETOTALSPREPAYMENT_ANY_OF_SCHEMAS = ["float", "str"]
|
|
28
|
+
|
|
29
|
+
class InvoiceTotalsPrepayment(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
Sum of amounts already paid (BT-113). Can be negative for correction invoices.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
# data type: float
|
|
35
|
+
anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
|
|
36
|
+
# data type: str
|
|
37
|
+
anyof_schema_2_validator: Optional[Annotated[str, Field(strict=True)]] = None
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
actual_instance: Optional[Union[float, str]] = None
|
|
40
|
+
else:
|
|
41
|
+
actual_instance: Any = None
|
|
42
|
+
any_of_schemas: Set[str] = { "float", "str" }
|
|
43
|
+
|
|
44
|
+
model_config = {
|
|
45
|
+
"validate_assignment": True,
|
|
46
|
+
"protected_namespaces": (),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
50
|
+
if args:
|
|
51
|
+
if len(args) > 1:
|
|
52
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
53
|
+
if kwargs:
|
|
54
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
55
|
+
super().__init__(actual_instance=args[0])
|
|
56
|
+
else:
|
|
57
|
+
super().__init__(**kwargs)
|
|
58
|
+
|
|
59
|
+
@field_validator('actual_instance')
|
|
60
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
61
|
+
if v is None:
|
|
62
|
+
return v
|
|
63
|
+
|
|
64
|
+
instance = InvoiceTotalsPrepayment.model_construct()
|
|
65
|
+
error_messages = []
|
|
66
|
+
# validate data type: float
|
|
67
|
+
try:
|
|
68
|
+
instance.anyof_schema_1_validator = v
|
|
69
|
+
return v
|
|
70
|
+
except (ValidationError, ValueError) as e:
|
|
71
|
+
error_messages.append(str(e))
|
|
72
|
+
# validate data type: str
|
|
73
|
+
try:
|
|
74
|
+
instance.anyof_schema_2_validator = v
|
|
75
|
+
return v
|
|
76
|
+
except (ValidationError, ValueError) as e:
|
|
77
|
+
error_messages.append(str(e))
|
|
78
|
+
if error_messages:
|
|
79
|
+
# no match
|
|
80
|
+
raise ValueError("No match found when setting the actual_instance in InvoiceTotalsPrepayment with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
81
|
+
else:
|
|
82
|
+
return v
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
86
|
+
return cls.from_json(json.dumps(obj))
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_json(cls, json_str: str) -> Self:
|
|
90
|
+
"""Returns the object represented by the json string"""
|
|
91
|
+
instance = cls.model_construct()
|
|
92
|
+
if json_str is None:
|
|
93
|
+
return instance
|
|
94
|
+
|
|
95
|
+
error_messages = []
|
|
96
|
+
# deserialize data into float
|
|
97
|
+
try:
|
|
98
|
+
# validation
|
|
99
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
100
|
+
# assign value to actual_instance
|
|
101
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
|
102
|
+
return instance
|
|
103
|
+
except (ValidationError, ValueError) as e:
|
|
104
|
+
error_messages.append(str(e))
|
|
105
|
+
# deserialize data into str
|
|
106
|
+
try:
|
|
107
|
+
# validation
|
|
108
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
|
109
|
+
# assign value to actual_instance
|
|
110
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
|
111
|
+
return instance
|
|
112
|
+
except (ValidationError, ValueError) as e:
|
|
113
|
+
error_messages.append(str(e))
|
|
114
|
+
|
|
115
|
+
if error_messages:
|
|
116
|
+
# no match
|
|
117
|
+
raise ValueError("No match found when deserializing the JSON string into InvoiceTotalsPrepayment with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
118
|
+
else:
|
|
119
|
+
return instance
|
|
120
|
+
|
|
121
|
+
def to_json(self) -> str:
|
|
122
|
+
"""Returns the JSON representation of the actual instance"""
|
|
123
|
+
if self.actual_instance is None:
|
|
124
|
+
return "null"
|
|
125
|
+
|
|
126
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
127
|
+
return self.actual_instance.to_json()
|
|
128
|
+
else:
|
|
129
|
+
return json.dumps(self.actual_instance)
|
|
130
|
+
|
|
131
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]:
|
|
132
|
+
"""Returns the dict representation of the actual instance"""
|
|
133
|
+
if self.actual_instance is None:
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
137
|
+
return self.actual_instance.to_dict()
|
|
138
|
+
else:
|
|
139
|
+
return self.actual_instance
|
|
140
|
+
|
|
141
|
+
def to_str(self) -> str:
|
|
142
|
+
"""Returns the string representation of the actual instance"""
|
|
143
|
+
return pprint.pformat(self.model_dump())
|
|
144
|
+
|
|
145
|
+
|