@factpulse/sdk 3.0.7 → 3.0.9
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.
- package/.openapi-generator/FILES +2 -2
- package/CHANGELOG.md +3 -3
- package/api/invoice-processing-api.ts +34 -34
- package/dist/api/invoice-processing-api.d.ts +33 -33
- package/dist/api/invoice-processing-api.js +16 -16
- package/dist/esm/api/invoice-processing-api.d.ts +33 -33
- package/dist/esm/api/invoice-processing-api.js +16 -16
- package/dist/esm/models/{factur-xprofile.d.ts → apiprofile.d.ts} +3 -3
- package/dist/esm/models/{factur-xprofile.js → apiprofile.js} +2 -2
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +1 -1
- package/dist/esm/models/processing-options.d.ts +2 -2
- package/dist/models/{factur-xprofile.d.ts → apiprofile.d.ts} +3 -3
- package/dist/models/{factur-xprofile.js → apiprofile.js} +3 -3
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +1 -1
- package/dist/models/processing-options.d.ts +2 -2
- package/docs/{FacturXProfile.md → APIProfile.md} +2 -2
- package/docs/DocumentConversionApi.md +2 -2
- package/docs/InvoiceProcessingApi.md +8 -8
- package/docs/ProcessingOptions.md +1 -1
- package/models/{factur-xprofile.ts → apiprofile.ts} +3 -3
- package/models/index.ts +1 -1
- package/models/processing-options.ts +2 -2
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ export const InvoiceProcessingApiAxiosParamCreator = function (configuration) {
|
|
|
35
35
|
* Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"sender\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"recipient\": {\"siret\": \"35600000000048\"}, \"lines\": [ {\"description\": \"Service\", \"quantity\": 10, \"unitPrice\": 100.00, \"vatRate\": 20.0} ] } ``` **⚠️ Required fields (simplified format)**: - `number`: Unique invoice number - `sender.siret`: Sender\'s SIRET (14 digits) - `sender.iban`: Bank account IBAN (no public API to retrieve it) - `recipient.siret`: Recipient\'s SIRET - `lines[]`: At least one invoice line **What happens automatically with `auto_enrich=True`**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT = Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format=\'pdf\') - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a `task_id` (HTTP 202 Accepted) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires `source_pdf`) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status `completed`): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
|
|
36
36
|
* @summary Generate a Factur-X invoice
|
|
37
37
|
* @param {string} invoiceData Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
|
|
38
|
-
* @param {
|
|
38
|
+
* @param {APIProfile} [profile] Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
39
39
|
* @param {OutputFormat} [outputFormat] Output format: \\\'xml\\\' (XML only) or \\\'pdf\\\' (Factur-X PDF with embedded XML).
|
|
40
40
|
* @param {boolean} [autoEnrich] 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
|
|
41
41
|
* @param {File | null} [sourcePdf]
|
|
@@ -348,7 +348,7 @@ export const InvoiceProcessingApiAxiosParamCreator = function (configuration) {
|
|
|
348
348
|
* 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)
|
|
349
349
|
* @summary Validate a complete Factur-X PDF
|
|
350
350
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
351
|
-
* @param {
|
|
351
|
+
* @param {APIProfile | null} [profile]
|
|
352
352
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
|
|
353
353
|
* @param {*} [options] Override http request option.
|
|
354
354
|
* @throws {RequiredError}
|
|
@@ -394,7 +394,7 @@ export const InvoiceProcessingApiAxiosParamCreator = function (configuration) {
|
|
|
394
394
|
* Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a `task_id` (HTTP 202) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn\'t wait during validation ## When to use this mode? - **VeraPDF validation enabled** (`use_verapdf=True`): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs > 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile\'s Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use `GET /tasks/{task_id}/status` endpoint to retrieve the result. **Polling example**: ```python import requests import time # 1. Submit task response = requests.post(\"/validate-facturx-async\", files={\"pdf_file\": pdf_file}) task_id = response.json()[\"taskId\"] # 2. Poll every 2 seconds while True: status_response = requests.get(f\"/tasks/{task_id}/status\") status = status_response.json() if status[\"status\"] == \"SUCCESS\": result = status[\"result\"][\"validation_result\"] print(f\"Compliant: {result[\'is_compliant\']}\") break elif status[\"status\"] == \"FAILURE\": print(f\"Error: {status[\'result\'][\'errorMessage\']}\") break time.sleep(2) # Wait 2 seconds before next check ``` ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
|
|
395
395
|
* @summary Validate a Factur-X PDF (asynchronous with polling)
|
|
396
396
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
397
|
-
* @param {
|
|
397
|
+
* @param {APIProfile | null} [profile]
|
|
398
398
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
|
|
399
399
|
* @param {*} [options] Override http request option.
|
|
400
400
|
* @throws {RequiredError}
|
|
@@ -478,7 +478,7 @@ export const InvoiceProcessingApiAxiosParamCreator = function (configuration) {
|
|
|
478
478
|
* 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
|
|
479
479
|
* @summary Validate an existing Factur-X XML
|
|
480
480
|
* @param {File} xmlFile Factur-X XML file to validate (.xml format).
|
|
481
|
-
* @param {
|
|
481
|
+
* @param {APIProfile} [profile] Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
482
482
|
* @param {*} [options] Override http request option.
|
|
483
483
|
* @throws {RequiredError}
|
|
484
484
|
*/
|
|
@@ -528,7 +528,7 @@ export const InvoiceProcessingApiFp = function (configuration) {
|
|
|
528
528
|
* Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"sender\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"recipient\": {\"siret\": \"35600000000048\"}, \"lines\": [ {\"description\": \"Service\", \"quantity\": 10, \"unitPrice\": 100.00, \"vatRate\": 20.0} ] } ``` **⚠️ Required fields (simplified format)**: - `number`: Unique invoice number - `sender.siret`: Sender\'s SIRET (14 digits) - `sender.iban`: Bank account IBAN (no public API to retrieve it) - `recipient.siret`: Recipient\'s SIRET - `lines[]`: At least one invoice line **What happens automatically with `auto_enrich=True`**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT = Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format=\'pdf\') - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a `task_id` (HTTP 202 Accepted) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires `source_pdf`) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status `completed`): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
|
|
529
529
|
* @summary Generate a Factur-X invoice
|
|
530
530
|
* @param {string} invoiceData Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
|
|
531
|
-
* @param {
|
|
531
|
+
* @param {APIProfile} [profile] Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
532
532
|
* @param {OutputFormat} [outputFormat] Output format: \\\'xml\\\' (XML only) or \\\'pdf\\\' (Factur-X PDF with embedded XML).
|
|
533
533
|
* @param {boolean} [autoEnrich] 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
|
|
534
534
|
* @param {File | null} [sourcePdf]
|
|
@@ -656,7 +656,7 @@ export const InvoiceProcessingApiFp = function (configuration) {
|
|
|
656
656
|
* 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)
|
|
657
657
|
* @summary Validate a complete Factur-X PDF
|
|
658
658
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
659
|
-
* @param {
|
|
659
|
+
* @param {APIProfile | null} [profile]
|
|
660
660
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
|
|
661
661
|
* @param {*} [options] Override http request option.
|
|
662
662
|
* @throws {RequiredError}
|
|
@@ -674,7 +674,7 @@ export const InvoiceProcessingApiFp = function (configuration) {
|
|
|
674
674
|
* Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a `task_id` (HTTP 202) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn\'t wait during validation ## When to use this mode? - **VeraPDF validation enabled** (`use_verapdf=True`): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs > 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile\'s Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use `GET /tasks/{task_id}/status` endpoint to retrieve the result. **Polling example**: ```python import requests import time # 1. Submit task response = requests.post(\"/validate-facturx-async\", files={\"pdf_file\": pdf_file}) task_id = response.json()[\"taskId\"] # 2. Poll every 2 seconds while True: status_response = requests.get(f\"/tasks/{task_id}/status\") status = status_response.json() if status[\"status\"] == \"SUCCESS\": result = status[\"result\"][\"validation_result\"] print(f\"Compliant: {result[\'is_compliant\']}\") break elif status[\"status\"] == \"FAILURE\": print(f\"Error: {status[\'result\'][\'errorMessage\']}\") break time.sleep(2) # Wait 2 seconds before next check ``` ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
|
|
675
675
|
* @summary Validate a Factur-X PDF (asynchronous with polling)
|
|
676
676
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
677
|
-
* @param {
|
|
677
|
+
* @param {APIProfile | null} [profile]
|
|
678
678
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
|
|
679
679
|
* @param {*} [options] Override http request option.
|
|
680
680
|
* @throws {RequiredError}
|
|
@@ -708,7 +708,7 @@ export const InvoiceProcessingApiFp = function (configuration) {
|
|
|
708
708
|
* 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
|
|
709
709
|
* @summary Validate an existing Factur-X XML
|
|
710
710
|
* @param {File} xmlFile Factur-X XML file to validate (.xml format).
|
|
711
|
-
* @param {
|
|
711
|
+
* @param {APIProfile} [profile] Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
712
712
|
* @param {*} [options] Override http request option.
|
|
713
713
|
* @throws {RequiredError}
|
|
714
714
|
*/
|
|
@@ -733,7 +733,7 @@ export const InvoiceProcessingApiFactory = function (configuration, basePath, ax
|
|
|
733
733
|
* Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"sender\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"recipient\": {\"siret\": \"35600000000048\"}, \"lines\": [ {\"description\": \"Service\", \"quantity\": 10, \"unitPrice\": 100.00, \"vatRate\": 20.0} ] } ``` **⚠️ Required fields (simplified format)**: - `number`: Unique invoice number - `sender.siret`: Sender\'s SIRET (14 digits) - `sender.iban`: Bank account IBAN (no public API to retrieve it) - `recipient.siret`: Recipient\'s SIRET - `lines[]`: At least one invoice line **What happens automatically with `auto_enrich=True`**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT = Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format=\'pdf\') - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a `task_id` (HTTP 202 Accepted) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires `source_pdf`) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status `completed`): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
|
|
734
734
|
* @summary Generate a Factur-X invoice
|
|
735
735
|
* @param {string} invoiceData Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
|
|
736
|
-
* @param {
|
|
736
|
+
* @param {APIProfile} [profile] Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
737
737
|
* @param {OutputFormat} [outputFormat] Output format: \\\'xml\\\' (XML only) or \\\'pdf\\\' (Factur-X PDF with embedded XML).
|
|
738
738
|
* @param {boolean} [autoEnrich] 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
|
|
739
739
|
* @param {File | null} [sourcePdf]
|
|
@@ -819,7 +819,7 @@ export const InvoiceProcessingApiFactory = function (configuration, basePath, ax
|
|
|
819
819
|
* 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)
|
|
820
820
|
* @summary Validate a complete Factur-X PDF
|
|
821
821
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
822
|
-
* @param {
|
|
822
|
+
* @param {APIProfile | null} [profile]
|
|
823
823
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
|
|
824
824
|
* @param {*} [options] Override http request option.
|
|
825
825
|
* @throws {RequiredError}
|
|
@@ -831,7 +831,7 @@ export const InvoiceProcessingApiFactory = function (configuration, basePath, ax
|
|
|
831
831
|
* Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a `task_id` (HTTP 202) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn\'t wait during validation ## When to use this mode? - **VeraPDF validation enabled** (`use_verapdf=True`): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs > 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile\'s Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use `GET /tasks/{task_id}/status` endpoint to retrieve the result. **Polling example**: ```python import requests import time # 1. Submit task response = requests.post(\"/validate-facturx-async\", files={\"pdf_file\": pdf_file}) task_id = response.json()[\"taskId\"] # 2. Poll every 2 seconds while True: status_response = requests.get(f\"/tasks/{task_id}/status\") status = status_response.json() if status[\"status\"] == \"SUCCESS\": result = status[\"result\"][\"validation_result\"] print(f\"Compliant: {result[\'is_compliant\']}\") break elif status[\"status\"] == \"FAILURE\": print(f\"Error: {status[\'result\'][\'errorMessage\']}\") break time.sleep(2) # Wait 2 seconds before next check ``` ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
|
|
832
832
|
* @summary Validate a Factur-X PDF (asynchronous with polling)
|
|
833
833
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
834
|
-
* @param {
|
|
834
|
+
* @param {APIProfile | null} [profile]
|
|
835
835
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
|
|
836
836
|
* @param {*} [options] Override http request option.
|
|
837
837
|
* @throws {RequiredError}
|
|
@@ -853,7 +853,7 @@ export const InvoiceProcessingApiFactory = function (configuration, basePath, ax
|
|
|
853
853
|
* 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
|
|
854
854
|
* @summary Validate an existing Factur-X XML
|
|
855
855
|
* @param {File} xmlFile Factur-X XML file to validate (.xml format).
|
|
856
|
-
* @param {
|
|
856
|
+
* @param {APIProfile} [profile] Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
857
857
|
* @param {*} [options] Override http request option.
|
|
858
858
|
* @throws {RequiredError}
|
|
859
859
|
*/
|
|
@@ -870,7 +870,7 @@ export class InvoiceProcessingApi extends BaseAPI {
|
|
|
870
870
|
* Generates an electronic invoice in Factur-X format compliant with European standards. ## Applied Standards - **Factur-X** (France): FNFE-MPE standard (Forum National de la Facture Électronique) - **ZUGFeRD** (Germany): German format compatible with Factur-X - **EN 16931**: European semantic standard for electronic invoicing - **ISO 19005-3** (PDF/A-3): Long-term electronic archiving - **Cross Industry Invoice (CII)**: UN/CEFACT XML syntax ## 🆕 New: Simplified format with auto-enrichment (P0.1) You can now create an invoice by providing only: - An invoice number - A sender SIRET + **IBAN** (required) - A recipient SIRET - Invoice lines (description, quantity, net price) **Simplified format example**: ```json { \"number\": \"FACT-2025-001\", \"sender\": { \"siret\": \"92019522900017\", \"iban\": \"FR7630001007941234567890185\" }, \"recipient\": {\"siret\": \"35600000000048\"}, \"lines\": [ {\"description\": \"Service\", \"quantity\": 10, \"unitPrice\": 100.00, \"vatRate\": 20.0} ] } ``` **⚠️ Required fields (simplified format)**: - `number`: Unique invoice number - `sender.siret`: Sender\'s SIRET (14 digits) - `sender.iban`: Bank account IBAN (no public API to retrieve it) - `recipient.siret`: Recipient\'s SIRET - `lines[]`: At least one invoice line **What happens automatically with `auto_enrich=True`**: - ✅ Name enrichment from Chorus Pro API - ✅ Address enrichment from Business Search API (free, public) - ✅ Automatic intra-EU VAT calculation (FR + key + SIREN) - ✅ Chorus Pro ID retrieval for electronic invoicing - ✅ Net/VAT/Gross totals calculation - ✅ Date generation (today + 30-day due date) - ✅ Multi-rate VAT handling **Supported identifiers**: - SIRET (14 digits): Specific establishment ⭐ Recommended - SIREN (9 digits): Company (auto-selection of headquarters) - Special types: UE_HORS_FRANCE, RIDET, TAHITI, etc. ## Checks performed during generation ### 1. Data validation (Pydantic) - Data types (amounts as Decimal, ISO 8601 dates) - Formats (14-digit SIRET, 9-digit SIREN, IBAN) - Required fields per profile - Amount consistency (Net + VAT = Gross) ### 2. CII-compliant XML generation - Serialization according to Cross Industry Invoice XSD schema - Correct UN/CEFACT namespaces - Hierarchical structure respected - UTF-8 encoding without BOM ### 3. Schematron validation - Business rules for selected profile (MINIMUM, BASIC, EN16931, EXTENDED) - Element cardinality (required, optional, repeatable) - Calculation rules (totals, VAT, discounts) - European EN 16931 compliance ### 4. PDF/A-3 conversion (if output_format=\'pdf\') - Source PDF conversion to PDF/A-3 via Ghostscript - Factur-X XML embedding in PDF - Compliant XMP metadata - ICC sRGB color profile - Removal of forbidden elements (JavaScript, forms) ## How it works 1. **Submission**: Invoice is queued in Celery for asynchronous processing 2. **Immediate return**: You receive a `task_id` (HTTP 202 Accepted) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Output formats - **xml**: Generates only Factur-X XML (recommended for testing) - **pdf**: Generates PDF/A-3 with embedded XML (requires `source_pdf`) ## Factur-X profiles - **MINIMUM**: Minimal data (simplified invoice) - **BASIC**: Basic information (SMEs) - **EN16931**: European standard (recommended, compliant with directive 2014/55/EU) - **EXTENDED**: All available data (large accounts) ## What you get After successful processing (status `completed`): - **XML only**: Base64-encoded Factur-X compliant XML file - **PDF/A-3**: PDF with embedded XML, ready for sending/archiving - **Metadata**: Profile, Factur-X version, file size - **Validation**: Schematron compliance confirmation ## Validation Data is automatically validated according to detected format. On error, a 422 status is returned with invalid field details.
|
|
871
871
|
* @summary Generate a Factur-X invoice
|
|
872
872
|
* @param {string} invoiceData Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically!
|
|
873
|
-
* @param {
|
|
873
|
+
* @param {APIProfile} [profile] Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED.
|
|
874
874
|
* @param {OutputFormat} [outputFormat] Output format: \\\'xml\\\' (XML only) or \\\'pdf\\\' (Factur-X PDF with embedded XML).
|
|
875
875
|
* @param {boolean} [autoEnrich] 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only)
|
|
876
876
|
* @param {File | null} [sourcePdf]
|
|
@@ -956,7 +956,7 @@ export class InvoiceProcessingApi extends BaseAPI {
|
|
|
956
956
|
* 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)
|
|
957
957
|
* @summary Validate a complete Factur-X PDF
|
|
958
958
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
959
|
-
* @param {
|
|
959
|
+
* @param {APIProfile | null} [profile]
|
|
960
960
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation.
|
|
961
961
|
* @param {*} [options] Override http request option.
|
|
962
962
|
* @throws {RequiredError}
|
|
@@ -968,7 +968,7 @@ export class InvoiceProcessingApi extends BaseAPI {
|
|
|
968
968
|
* Validates a Factur-X PDF asynchronously with polling system. ## How it works 1. **Submission**: PDF is queued for asynchronous validation 2. **Immediate return**: You receive a `task_id` (HTTP 202) 3. **Tracking**: Use the `/tasks/{task_id}/status` endpoint to track progress ## Advantages of asynchronous mode - **No timeout**: Ideal for large PDFs or VeraPDF validation (which can take several seconds) - **Scalability**: Validations are processed by dedicated Celery workers - **Status tracking**: Allows you to monitor validation progress - **Non-blocking**: Your client doesn\'t wait during validation ## When to use this mode? - **VeraPDF validation enabled** (`use_verapdf=True`): Strict validation can take 2-10 seconds - **Large PDF files**: PDFs > 1 MB - **Batch processing**: Validating multiple invoices in parallel - **Asynchronous integration**: Your system supports polling ## Checks performed ### 1. Factur-X XML extraction and validation - Verifies presence of Factur-X compliant embedded XML file - Automatically detects profile used (MINIMUM, BASIC, EN16931, EXTENDED) - Validates XML against detected profile\'s Schematron rules ### 2. PDF/A compliance - **Without VeraPDF**: Basic metadata validation (fast, ~100ms) - **With VeraPDF**: Strict ISO 19005 validation (146+ rules, 2-10s) - Detects PDF/A version (PDF/A-1, PDF/A-3, etc.) - Detailed non-compliance reports ### 3. XMP metadata - Verifies presence of XMP metadata in PDF - Validates Factur-X metadata compliance (profile, version) - Extracts all available XMP metadata ### 4. Electronic signatures - Detects presence of electronic signatures or seals - Extracts information about each signature (signer, date, reason) - Counts number of signatures present ## Parameters - **pdf_file**: The Factur-X PDF file to validate - **profile**: Expected Factur-X profile (optional). If not specified, profile will be auto-detected from embedded XML file. - **use_verapdf**: Enable strict PDF/A validation with VeraPDF. ⚠️ **Warning**: VeraPDF can take 2-10 seconds depending on PDF size. Recommended only in asynchronous mode to avoid timeouts. ## Retrieving results After submission, use `GET /tasks/{task_id}/status` endpoint to retrieve the result. **Polling example**: ```python import requests import time # 1. Submit task response = requests.post(\"/validate-facturx-async\", files={\"pdf_file\": pdf_file}) task_id = response.json()[\"taskId\"] # 2. Poll every 2 seconds while True: status_response = requests.get(f\"/tasks/{task_id}/status\") status = status_response.json() if status[\"status\"] == \"SUCCESS\": result = status[\"result\"][\"validation_result\"] print(f\"Compliant: {result[\'is_compliant\']}\") break elif status[\"status\"] == \"FAILURE\": print(f\"Error: {status[\'result\'][\'errorMessage\']}\") break time.sleep(2) # Wait 2 seconds before next check ``` ## Use cases - Validate invoices before sending with VeraPDF (strict validation) - Process invoice batches in parallel - Integrate validation into an asynchronous pipeline - Validate large PDFs without timeout risk
|
|
969
969
|
* @summary Validate a Factur-X PDF (asynchronous with polling)
|
|
970
970
|
* @param {File} pdfFile Factur-X PDF file to validate (.pdf format).
|
|
971
|
-
* @param {
|
|
971
|
+
* @param {APIProfile | null} [profile]
|
|
972
972
|
* @param {boolean} [useVerapdf] Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds.
|
|
973
973
|
* @param {*} [options] Override http request option.
|
|
974
974
|
* @throws {RequiredError}
|
|
@@ -990,7 +990,7 @@ export class InvoiceProcessingApi extends BaseAPI {
|
|
|
990
990
|
* 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
|
|
991
991
|
* @summary Validate an existing Factur-X XML
|
|
992
992
|
* @param {File} xmlFile Factur-X XML file to validate (.xml format).
|
|
993
|
-
* @param {
|
|
993
|
+
* @param {APIProfile} [profile] Validation profile (MINIMUM, BASIC, EN16931, EXTENDED).
|
|
994
994
|
* @param {*} [options] Override http request option.
|
|
995
995
|
* @throws {RequiredError}
|
|
996
996
|
*/
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Factur-X profile for API responses. Note: Simplified compared to utils/facturx.ProfilFacturX which also contains XSLT configurations. This one is for the API.
|
|
14
14
|
*/
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const APIProfile: {
|
|
16
16
|
readonly Minimum: "MINIMUM";
|
|
17
17
|
readonly Basic: "BASIC";
|
|
18
18
|
readonly En16931: "EN16931";
|
|
19
19
|
readonly Extended: "EXTENDED";
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
21
|
+
export type APIProfile = typeof APIProfile[keyof typeof APIProfile];
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Factur-X profile for API responses. Note: Simplified compared to utils/facturx.ProfilFacturX which also contains XSLT configurations. This one is for the API.
|
|
16
16
|
*/
|
|
17
|
-
export const
|
|
17
|
+
export const APIProfile = {
|
|
18
18
|
Minimum: 'MINIMUM',
|
|
19
19
|
Basic: 'BASIC',
|
|
20
20
|
En16931: 'EN16931',
|
|
@@ -3,6 +3,7 @@ export * from './afnordestination';
|
|
|
3
3
|
export * from './afnorhealth-check-response';
|
|
4
4
|
export * from './afnorresult';
|
|
5
5
|
export * from './apierror';
|
|
6
|
+
export * from './apiprofile';
|
|
6
7
|
export * from './acknowledgment-status';
|
|
7
8
|
export * from './additional-document';
|
|
8
9
|
export * from './allowance-charge';
|
|
@@ -34,7 +35,6 @@ export * from './error-source';
|
|
|
34
35
|
export * from './extraction-info';
|
|
35
36
|
export * from './factur-xinvoice';
|
|
36
37
|
export * from './factur-xpdfinfo';
|
|
37
|
-
export * from './factur-xprofile';
|
|
38
38
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
39
39
|
export * from './facture-electronique-rest-api-schemas-processing-chorus-pro-credentials';
|
|
40
40
|
export * from './field-status';
|
package/dist/esm/models/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './afnordestination';
|
|
|
3
3
|
export * from './afnorhealth-check-response';
|
|
4
4
|
export * from './afnorresult';
|
|
5
5
|
export * from './apierror';
|
|
6
|
+
export * from './apiprofile';
|
|
6
7
|
export * from './acknowledgment-status';
|
|
7
8
|
export * from './additional-document';
|
|
8
9
|
export * from './allowance-charge';
|
|
@@ -34,7 +35,6 @@ export * from './error-source';
|
|
|
34
35
|
export * from './extraction-info';
|
|
35
36
|
export * from './factur-xinvoice';
|
|
36
37
|
export * from './factur-xpdfinfo';
|
|
37
|
-
export * from './factur-xprofile';
|
|
38
38
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
39
39
|
export * from './facture-electronique-rest-api-schemas-processing-chorus-pro-credentials';
|
|
40
40
|
export * from './field-status';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { APIProfile } from './apiprofile';
|
|
13
13
|
/**
|
|
14
14
|
* Processing options for generation and submission.
|
|
15
15
|
*/
|
|
@@ -17,7 +17,7 @@ export interface ProcessingOptions {
|
|
|
17
17
|
/**
|
|
18
18
|
* Factur-X profile to use
|
|
19
19
|
*/
|
|
20
|
-
'facturxProfile'?:
|
|
20
|
+
'facturxProfile'?: APIProfile;
|
|
21
21
|
/**
|
|
22
22
|
* Auto-enrich data (Company APIs, Chorus Pro, etc.)
|
|
23
23
|
*/
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Factur-X profile for API responses. Note: Simplified compared to utils/facturx.ProfilFacturX which also contains XSLT configurations. This one is for the API.
|
|
14
14
|
*/
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const APIProfile: {
|
|
16
16
|
readonly Minimum: "MINIMUM";
|
|
17
17
|
readonly Basic: "BASIC";
|
|
18
18
|
readonly En16931: "EN16931";
|
|
19
19
|
readonly Extended: "EXTENDED";
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
21
|
+
export type APIProfile = typeof APIProfile[keyof typeof APIProfile];
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* Do not edit the class manually.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.APIProfile = void 0;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Factur-X profile for API responses. Note: Simplified compared to utils/facturx.ProfilFacturX which also contains XSLT configurations. This one is for the API.
|
|
19
19
|
*/
|
|
20
|
-
exports.
|
|
20
|
+
exports.APIProfile = {
|
|
21
21
|
Minimum: 'MINIMUM',
|
|
22
22
|
Basic: 'BASIC',
|
|
23
23
|
En16931: 'EN16931',
|
package/dist/models/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './afnordestination';
|
|
|
3
3
|
export * from './afnorhealth-check-response';
|
|
4
4
|
export * from './afnorresult';
|
|
5
5
|
export * from './apierror';
|
|
6
|
+
export * from './apiprofile';
|
|
6
7
|
export * from './acknowledgment-status';
|
|
7
8
|
export * from './additional-document';
|
|
8
9
|
export * from './allowance-charge';
|
|
@@ -34,7 +35,6 @@ export * from './error-source';
|
|
|
34
35
|
export * from './extraction-info';
|
|
35
36
|
export * from './factur-xinvoice';
|
|
36
37
|
export * from './factur-xpdfinfo';
|
|
37
|
-
export * from './factur-xprofile';
|
|
38
38
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
39
39
|
export * from './facture-electronique-rest-api-schemas-processing-chorus-pro-credentials';
|
|
40
40
|
export * from './field-status';
|
package/dist/models/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./afnordestination"), exports);
|
|
|
19
19
|
__exportStar(require("./afnorhealth-check-response"), exports);
|
|
20
20
|
__exportStar(require("./afnorresult"), exports);
|
|
21
21
|
__exportStar(require("./apierror"), exports);
|
|
22
|
+
__exportStar(require("./apiprofile"), exports);
|
|
22
23
|
__exportStar(require("./acknowledgment-status"), exports);
|
|
23
24
|
__exportStar(require("./additional-document"), exports);
|
|
24
25
|
__exportStar(require("./allowance-charge"), exports);
|
|
@@ -50,7 +51,6 @@ __exportStar(require("./error-source"), exports);
|
|
|
50
51
|
__exportStar(require("./extraction-info"), exports);
|
|
51
52
|
__exportStar(require("./factur-xinvoice"), exports);
|
|
52
53
|
__exportStar(require("./factur-xpdfinfo"), exports);
|
|
53
|
-
__exportStar(require("./factur-xprofile"), exports);
|
|
54
54
|
__exportStar(require("./facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials"), exports);
|
|
55
55
|
__exportStar(require("./facture-electronique-rest-api-schemas-processing-chorus-pro-credentials"), exports);
|
|
56
56
|
__exportStar(require("./field-status"), exports);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { APIProfile } from './apiprofile';
|
|
13
13
|
/**
|
|
14
14
|
* Processing options for generation and submission.
|
|
15
15
|
*/
|
|
@@ -17,7 +17,7 @@ export interface ProcessingOptions {
|
|
|
17
17
|
/**
|
|
18
18
|
* Factur-X profile to use
|
|
19
19
|
*/
|
|
20
|
-
'facturxProfile'?:
|
|
20
|
+
'facturxProfile'?: APIProfile;
|
|
21
21
|
/**
|
|
22
22
|
* Auto-enrich data (Company APIs, Chorus Pro, etc.)
|
|
23
23
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# APIProfile
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Factur-X profile for API responses. Note: Simplified compared to utils/facturx.ProfilFacturX which also contains XSLT configurations. This one is for the API.
|
|
4
4
|
|
|
5
5
|
## Enum
|
|
6
6
|
|
|
@@ -63,7 +63,7 @@ const { status, data } = await apiInstance.convertDocumentApiV1ConvertPost(
|
|
|
63
63
|
### HTTP response details
|
|
64
64
|
| Status code | Description | Response headers |
|
|
65
65
|
|-------------|-------------|------------------|
|
|
66
|
-
|**200** |
|
|
66
|
+
|**200** | Successful Response | - |
|
|
67
67
|
|**202** | Données manquantes | - |
|
|
68
68
|
|**422** | Validation échouée | - |
|
|
69
69
|
|**400** | Fichier invalide | - |
|
|
@@ -289,7 +289,7 @@ const { status, data } = await apiInstance.resumeConversionApiV1ConvertConversio
|
|
|
289
289
|
### HTTP response details
|
|
290
290
|
| Status code | Description | Response headers |
|
|
291
291
|
|-------------|-------------|------------------|
|
|
292
|
-
|**200** |
|
|
292
|
+
|**200** | Successful Response | - |
|
|
293
293
|
|**404** | Conversion non trouvée ou expirée | - |
|
|
294
294
|
|**422** | Validation toujours en échec | - |
|
|
295
295
|
|
|
@@ -33,7 +33,7 @@ const configuration = new Configuration();
|
|
|
33
33
|
const apiInstance = new InvoiceProcessingApi(configuration);
|
|
34
34
|
|
|
35
35
|
let invoiceData: string; //Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! (default to undefined)
|
|
36
|
-
let profile:
|
|
36
|
+
let profile: APIProfile; //Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED. (optional) (default to undefined)
|
|
37
37
|
let outputFormat: OutputFormat; //Output format: \\\'xml\\\' (XML only) or \\\'pdf\\\' (Factur-X PDF with embedded XML). (optional) (default to undefined)
|
|
38
38
|
let autoEnrich: boolean; //🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only) (optional) (default to true)
|
|
39
39
|
let sourcePdf: File; // (optional) (default to undefined)
|
|
@@ -52,7 +52,7 @@ const { status, data } = await apiInstance.generateInvoiceApiV1ProcessingGenerat
|
|
|
52
52
|
|Name | Type | Description | Notes|
|
|
53
53
|
|------------- | ------------- | ------------- | -------------|
|
|
54
54
|
| **invoiceData** | [**string**] | Invoice data in JSON format. Two formats accepted: 1. **Classic format**: Complete FactureFacturX structure (all fields) 2. **Simplified format** (🆕 P0.1): Minimal structure with auto-enrichment Format is detected automatically! | defaults to undefined|
|
|
55
|
-
| **profile** | **
|
|
55
|
+
| **profile** | **APIProfile** | Factur-X profile: MINIMUM, BASIC, EN16931 or EXTENDED. | (optional) defaults to undefined|
|
|
56
56
|
| **outputFormat** | **OutputFormat** | Output format: \\\'xml\\\' (XML only) or \\\'pdf\\\' (Factur-X PDF with embedded XML). | (optional) defaults to undefined|
|
|
57
57
|
| **autoEnrich** | [**boolean**] | 🆕 Enable auto-enrichment from SIRET/SIREN (simplified format only) | (optional) defaults to true|
|
|
58
58
|
| **sourcePdf** | [**File**] | | (optional) defaults to undefined|
|
|
@@ -458,7 +458,7 @@ const configuration = new Configuration();
|
|
|
458
458
|
const apiInstance = new InvoiceProcessingApi(configuration);
|
|
459
459
|
|
|
460
460
|
let pdfFile: File; //Factur-X PDF file to validate (.pdf format). (default to undefined)
|
|
461
|
-
let profile:
|
|
461
|
+
let profile: APIProfile; // (optional) (default to undefined)
|
|
462
462
|
let useVerapdf: boolean; //Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation. (optional) (default to false)
|
|
463
463
|
|
|
464
464
|
const { status, data } = await apiInstance.validateFacturxPdfApiV1ProcessingValidateFacturxPdfPost(
|
|
@@ -473,7 +473,7 @@ const { status, data } = await apiInstance.validateFacturxPdfApiV1ProcessingVali
|
|
|
473
473
|
|Name | Type | Description | Notes|
|
|
474
474
|
|------------- | ------------- | ------------- | -------------|
|
|
475
475
|
| **pdfFile** | [**File**] | Factur-X PDF file to validate (.pdf format). | defaults to undefined|
|
|
476
|
-
| **profile** | **
|
|
476
|
+
| **profile** | **APIProfile** | | (optional) defaults to undefined|
|
|
477
477
|
| **useVerapdf** | [**boolean**] | Enable strict PDF/A validation with VeraPDF (recommended for production). If False, uses basic metadata validation. | (optional) defaults to false|
|
|
478
478
|
|
|
479
479
|
|
|
@@ -517,7 +517,7 @@ const configuration = new Configuration();
|
|
|
517
517
|
const apiInstance = new InvoiceProcessingApi(configuration);
|
|
518
518
|
|
|
519
519
|
let pdfFile: File; //Factur-X PDF file to validate (.pdf format). (default to undefined)
|
|
520
|
-
let profile:
|
|
520
|
+
let profile: APIProfile; // (optional) (default to undefined)
|
|
521
521
|
let useVerapdf: boolean; //Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds. (optional) (default to false)
|
|
522
522
|
|
|
523
523
|
const { status, data } = await apiInstance.validateFacturxPdfAsyncApiV1ProcessingValidateFacturxAsyncPost(
|
|
@@ -532,7 +532,7 @@ const { status, data } = await apiInstance.validateFacturxPdfAsyncApiV1Processin
|
|
|
532
532
|
|Name | Type | Description | Notes|
|
|
533
533
|
|------------- | ------------- | ------------- | -------------|
|
|
534
534
|
| **pdfFile** | [**File**] | Factur-X PDF file to validate (.pdf format). | defaults to undefined|
|
|
535
|
-
| **profile** | **
|
|
535
|
+
| **profile** | **APIProfile** | | (optional) defaults to undefined|
|
|
536
536
|
| **useVerapdf** | [**boolean**] | Enable strict PDF/A validation with VeraPDF (recommended for production). May take several seconds. | (optional) defaults to false|
|
|
537
537
|
|
|
538
538
|
|
|
@@ -629,7 +629,7 @@ const configuration = new Configuration();
|
|
|
629
629
|
const apiInstance = new InvoiceProcessingApi(configuration);
|
|
630
630
|
|
|
631
631
|
let xmlFile: File; //Factur-X XML file to validate (.xml format). (default to undefined)
|
|
632
|
-
let profile:
|
|
632
|
+
let profile: APIProfile; //Validation profile (MINIMUM, BASIC, EN16931, EXTENDED). (optional) (default to undefined)
|
|
633
633
|
|
|
634
634
|
const { status, data } = await apiInstance.validateXmlApiV1ProcessingValidateXmlPost(
|
|
635
635
|
xmlFile,
|
|
@@ -642,7 +642,7 @@ const { status, data } = await apiInstance.validateXmlApiV1ProcessingValidateXml
|
|
|
642
642
|
|Name | Type | Description | Notes|
|
|
643
643
|
|------------- | ------------- | ------------- | -------------|
|
|
644
644
|
| **xmlFile** | [**File**] | Factur-X XML file to validate (.xml format). | defaults to undefined|
|
|
645
|
-
| **profile** | **
|
|
645
|
+
| **profile** | **APIProfile** | Validation profile (MINIMUM, BASIC, EN16931, EXTENDED). | (optional) defaults to undefined|
|
|
646
646
|
|
|
647
647
|
|
|
648
648
|
### Return type
|
|
@@ -6,7 +6,7 @@ Processing options for generation and submission.
|
|
|
6
6
|
|
|
7
7
|
Name | Type | Description | Notes
|
|
8
8
|
------------ | ------------- | ------------- | -------------
|
|
9
|
-
**facturxProfile** | [**
|
|
9
|
+
**facturxProfile** | [**APIProfile**](APIProfile.md) | Factur-X profile to use | [optional] [default to undefined]
|
|
10
10
|
**autoEnrich** | **boolean** | Auto-enrich data (Company APIs, Chorus Pro, etc.) | [optional] [default to true]
|
|
11
11
|
**validateXml** | **boolean** | Validate Factur-X XML with Schematron | [optional] [default to true]
|
|
12
12
|
**verifyDestinationParameters** | **boolean** | Verify required parameters for destination (e.g., service_code for Chorus) | [optional] [default to true]
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Factur-X profile for API responses. Note: Simplified compared to utils/facturx.ProfilFacturX which also contains XSLT configurations. This one is for the API.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
export const
|
|
21
|
+
export const APIProfile = {
|
|
22
22
|
Minimum: 'MINIMUM',
|
|
23
23
|
Basic: 'BASIC',
|
|
24
24
|
En16931: 'EN16931',
|
|
25
25
|
Extended: 'EXTENDED'
|
|
26
26
|
} as const;
|
|
27
27
|
|
|
28
|
-
export type
|
|
28
|
+
export type APIProfile = typeof APIProfile[keyof typeof APIProfile];
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
package/models/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './afnordestination';
|
|
|
3
3
|
export * from './afnorhealth-check-response';
|
|
4
4
|
export * from './afnorresult';
|
|
5
5
|
export * from './apierror';
|
|
6
|
+
export * from './apiprofile';
|
|
6
7
|
export * from './acknowledgment-status';
|
|
7
8
|
export * from './additional-document';
|
|
8
9
|
export * from './allowance-charge';
|
|
@@ -34,7 +35,6 @@ export * from './error-source';
|
|
|
34
35
|
export * from './extraction-info';
|
|
35
36
|
export * from './factur-xinvoice';
|
|
36
37
|
export * from './factur-xpdfinfo';
|
|
37
|
-
export * from './factur-xprofile';
|
|
38
38
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
39
39
|
export * from './facture-electronique-rest-api-schemas-processing-chorus-pro-credentials';
|
|
40
40
|
export * from './field-status';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
// May contain unused imports in some cases
|
|
17
17
|
// @ts-ignore
|
|
18
|
-
import type {
|
|
18
|
+
import type { APIProfile } from './apiprofile';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Processing options for generation and submission.
|
|
@@ -24,7 +24,7 @@ export interface ProcessingOptions {
|
|
|
24
24
|
/**
|
|
25
25
|
* Factur-X profile to use
|
|
26
26
|
*/
|
|
27
|
-
'facturxProfile'?:
|
|
27
|
+
'facturxProfile'?: APIProfile;
|
|
28
28
|
/**
|
|
29
29
|
* Auto-enrich data (Company APIs, Chorus Pro, etc.)
|
|
30
30
|
*/
|