Class: FactPulse::InvoiceProcessingApi
- Inherits:
-
Object
- Object
- FactPulse::InvoiceProcessingApi
- Defined in:
- lib/factpulse/api/invoice_processing_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#generate_invoice_api_v1_processing_generate_invoice_post(invoice_data, opts = {}) ⇒ TaskResponse
Generate a Factur-X invoice Generates an electronic invoice in Factur-X format compliant with European standards.
-
#generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(invoice_data, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>
Generate a Factur-X invoice Generates an electronic invoice in Factur-X format compliant with European standards.
-
#generate_test_certificate_api_v1_processing_generate_test_certificate_post(generate_certificate_request, opts = {}) ⇒ GenerateCertificateResponse
Generate a self-signed X.509 test certificate Generates a self-signed X.509 certificate for PDF electronic signature testing.
-
#generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(generate_certificate_request, opts = {}) ⇒ Array<(GenerateCertificateResponse, Integer, Hash)>
Generate a self-signed X.509 test certificate Generates a self-signed X.509 certificate for PDF electronic signature testing.
-
#get_task_status_api_v1_processing_tasks_task_id_status_get(task_id, opts = {}) ⇒ AsyncTaskStatus
Get task generation status Retrieves the progress status of an invoice generation task.
-
#get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts = {}) ⇒ Array<(AsyncTaskStatus, Integer, Hash)>
Get task generation status Retrieves the progress status of an invoice generation task.
-
#initialize(api_client = ApiClient.default) ⇒ InvoiceProcessingApi
constructor
A new instance of InvoiceProcessingApi.
-
#sign_pdf_api_v1_processing_sign_pdf_post(pdf_file, opts = {}) ⇒ Object
Sign a PDF with client’s certificate (PAdES-B-LT) Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT).
-
#sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Sign a PDF with client's certificate (PAdES-B-LT) Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT).
-
#sign_pdf_async_api_v1_processing_sign_pdf_async_post(pdf_file, opts = {}) ⇒ Object
Sign a PDF asynchronously (Celery) Signs an uploaded PDF asynchronously via a Celery task.
-
#sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Sign a PDF asynchronously (Celery) Signs an uploaded PDF asynchronously via a Celery task.
-
#submit_complete_invoice_api_v1_processing_invoices_submit_complete_post(submit_complete_invoice_request, opts = {}) ⇒ SubmitCompleteInvoiceResponse
Submit a complete invoice (generation + signature + submission) Unified endpoint to submit a complete invoice to different destinations.
-
#submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(submit_complete_invoice_request, opts = {}) ⇒ Array<(SubmitCompleteInvoiceResponse, Integer, Hash)>
Submit a complete invoice (generation + signature + submission) Unified endpoint to submit a complete invoice to different destinations.
-
#submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post(submit_complete_invoice_request, opts = {}) ⇒ TaskResponse
Submit a complete invoice (asynchronous with Celery) Asynchronous version of the ‘/invoices/submit-complete` endpoint using Celery for background processing.
-
#submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(submit_complete_invoice_request, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>
Submit a complete invoice (asynchronous with Celery) Asynchronous version of the `/invoices/submit-complete` endpoint using Celery for background processing.
-
#validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post(pdf_file, opts = {}) ⇒ PDFValidationResultAPI
Validate a complete Factur-X PDF Validates a complete Factur-X PDF according to European and French standards.
-
#validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(PDFValidationResultAPI, Integer, Hash)>
Validate a complete Factur-X PDF Validates a complete Factur-X PDF according to European and French standards.
-
#validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post(pdf_file, opts = {}) ⇒ TaskResponse
Validate a Factur-X PDF (asynchronous with polling) Validates a Factur-X PDF asynchronously with polling system.
-
#validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>
Validate a Factur-X PDF (asynchronous with polling) Validates a Factur-X PDF asynchronously with polling system.
-
#validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post(pdf_file, opts = {}) ⇒ Object
Validate electronic signatures of a PDF Validates electronic signatures present in an uploaded PDF.
-
#validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Validate electronic signatures of a PDF Validates electronic signatures present in an uploaded PDF.
-
#validate_xml_api_v1_processing_validate_xml_post(xml_file, opts = {}) ⇒ ValidationSuccessResponse
Validate an existing Factur-X XML Validates a Factur-X XML file against Schematron business rules according to EN 16931 standard.
-
#validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts = {}) ⇒ Array<(ValidationSuccessResponse, Integer, Hash)>
Validate an existing Factur-X XML Validates a Factur-X XML file against Schematron business rules according to EN 16931 standard.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ InvoiceProcessingApi
Returns a new instance of InvoiceProcessingApi.
19 20 21 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#generate_invoice_api_v1_processing_generate_invoice_post(invoice_data, opts = {}) ⇒ TaskResponse
Generate a Factur-X invoice 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": "35600000000048", "lines": [ "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.
31 32 33 34 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 31 def generate_invoice_api_v1_processing_generate_invoice_post(invoice_data, opts = {}) data, _status_code, _headers = generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(invoice_data, opts) data end |
#generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(invoice_data, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>
Generate a Factur-X invoice 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": "35600000000048", "lines": [ "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.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 45 def generate_invoice_api_v1_processing_generate_invoice_post_with_http_info(invoice_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.generate_invoice_api_v1_processing_generate_invoice_post ...' end # verify the required parameter 'invoice_data' is set if @api_client.config.client_side_validation && invoice_data.nil? fail ArgumentError, "Missing the required parameter 'invoice_data' when calling InvoiceProcessingApi.generate_invoice_api_v1_processing_generate_invoice_post" end # resource path local_var_path = '/api/v1/processing/generate-invoice' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['invoice_data'] = invoice_data form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil? form_params['output_format'] = opts[:'output_format'] if !opts[:'output_format'].nil? form_params['auto_enrich'] = opts[:'auto_enrich'] if !opts[:'auto_enrich'].nil? form_params['source_pdf'] = opts[:'source_pdf'] if !opts[:'source_pdf'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TaskResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.generate_invoice_api_v1_processing_generate_invoice_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#generate_invoice_api_v1_processing_generate_invoice_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#generate_test_certificate_api_v1_processing_generate_test_certificate_post(generate_certificate_request, opts = {}) ⇒ GenerateCertificateResponse
Generate a self-signed X.509 test certificate Generates a self-signed X.509 certificate for PDF electronic signature testing. **⚠️ WARNING: TEST certificate only!** This certificate is: - ✅ Suitable for testing and development - ✅ Compatible with PDF signing (PAdES) - ✅ Compliant with eIDAS SES level (Simple Electronic Signature) - ❌ **NEVER usable in production** - ❌ **Not recognized** by browsers and PDF readers - ❌ **No legal value** ## eIDAS levels - SES (Simple): Self-signed certificate ← Generated by this endpoint - AdES (Advanced): Commercial CA certificate (Let’s Encrypt, etc.) - QES (Qualified): Qualified certificate from QTSP (CertEurope, Universign, etc.) ## Usage Once generated, the certificate can be: 1. **Saved in Django** (recommended): - Django Admin > Signing Certificates - Upload ‘certificate_pem` and `private_key_pem` 2. **Used directly**: - Sign a PDF with `/sign-pdf` - The certificate will be automatically used ## Example call “`bash curl -X POST "www.factpulse.fr/api/v1/processing/generate-test-certificate" \ -H "Authorization: Bearer eyJ0eXAi…" \ -H "Content-Type: application/json" \ -d ’{ "cn": "Test Client XYZ", "organization": "Client XYZ Ltd", "email": "[email protected]", "validity_days": 365 }‘ “` ## Use cases - PDF signature testing in development - Electronic signature POC - Training and demos - Automated integration tests ## Technical compliance Certificate generated with: - RSA key 2048 or 4096 bits - SHA-256 algorithm - Key Usage extensions: `digitalSignature`, `contentCommitment` (non-repudiation) - Extended Key Usage extensions: `codeSigning`, `emailProtection` - Validity: 1 day to 10 years (configurable) - Format: PEM (certificate and key) - Optional: PKCS#12 (.p12)
108 109 110 111 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 108 def generate_test_certificate_api_v1_processing_generate_test_certificate_post(generate_certificate_request, opts = {}) data, _status_code, _headers = generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(generate_certificate_request, opts) data end |
#generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(generate_certificate_request, opts = {}) ⇒ Array<(GenerateCertificateResponse, Integer, Hash)>
Generate a self-signed X.509 test certificate Generates a self-signed X.509 certificate for PDF electronic signature testing. **⚠️ WARNING: TEST certificate only!** This certificate is: - ✅ Suitable for testing and development - ✅ Compatible with PDF signing (PAdES) - ✅ Compliant with eIDAS SES level (Simple Electronic Signature) - ❌ **NEVER usable in production** - ❌ **Not recognized** by browsers and PDF readers - ❌ **No legal value** ## eIDAS levels - SES (Simple): Self-signed certificate ← Generated by this endpoint - AdES (Advanced): Commercial CA certificate (Let's Encrypt, etc.) - QES (Qualified): Qualified certificate from QTSP (CertEurope, Universign, etc.) ## Usage Once generated, the certificate can be: 1. **Saved in Django** (recommended): - Django Admin > Signing Certificates - Upload `certificate_pem` and `private_key_pem` 2. **Used directly**: - Sign a PDF with `/sign-pdf` - The certificate will be automatically used ## Example call ```bash curl -X POST "www.factpulse.fr/api/v1/processing/generate-test-certificate" \ -H "Authorization: Bearer eyJ0eXAi…" \ -H "Content-Type: application/json" \ -d '{ "cn": "Test Client XYZ", "organization": "Client XYZ Ltd", "email": "[email protected]", "validity_days": 365 }' ``` ## Use cases - PDF signature testing in development - Electronic signature POC - Training and demos - Automated integration tests ## Technical compliance Certificate generated with: - RSA key 2048 or 4096 bits - SHA-256 algorithm - Key Usage extensions: `digitalSignature`, `contentCommitment` (non-repudiation) - Extended Key Usage extensions: `codeSigning`, `emailProtection` - Validity: 1 day to 10 years (configurable) - Format: PEM (certificate and key) - Optional: PKCS#12 (.p12)
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 118 def generate_test_certificate_api_v1_processing_generate_test_certificate_post_with_http_info(generate_certificate_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.generate_test_certificate_api_v1_processing_generate_test_certificate_post ...' end # verify the required parameter 'generate_certificate_request' is set if @api_client.config.client_side_validation && generate_certificate_request.nil? fail ArgumentError, "Missing the required parameter 'generate_certificate_request' when calling InvoiceProcessingApi.generate_test_certificate_api_v1_processing_generate_test_certificate_post" end # resource path local_var_path = '/api/v1/processing/generate-test-certificate' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_certificate_request) # return_type return_type = opts[:debug_return_type] || 'GenerateCertificateResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.generate_test_certificate_api_v1_processing_generate_test_certificate_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#generate_test_certificate_api_v1_processing_generate_test_certificate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_task_status_api_v1_processing_tasks_task_id_status_get(task_id, opts = {}) ⇒ AsyncTaskStatus
Get task generation status Retrieves the progress status of an invoice generation task. ## Possible states The ‘status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status="SUCCESS"`, the `result` field contains: - `status`: "SUCCESS" or "ERROR" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
176 177 178 179 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 176 def get_task_status_api_v1_processing_tasks_task_id_status_get(task_id, opts = {}) data, _status_code, _headers = get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts) data end |
#get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts = {}) ⇒ Array<(AsyncTaskStatus, Integer, Hash)>
Get task generation status Retrieves the progress status of an invoice generation task. ## Possible states The `status` field uses the `CeleryStatus` enum with values: - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** See the `CeleryStatus` schema documentation for details. ## Business result When `status="SUCCESS"`, the `result` field contains: - `status`: "SUCCESS" or "ERROR" (business result) - `content_b64`: Base64 encoded content (if success) - `errorCode`, `errorMessage`, `details`: AFNOR format (if business error) ## Usage Poll this endpoint every 2-3 seconds until `status` is `SUCCESS` or `FAILURE`.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 186 def get_task_status_api_v1_processing_tasks_task_id_status_get_with_http_info(task_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.get_task_status_api_v1_processing_tasks_task_id_status_get ...' end # verify the required parameter 'task_id' is set if @api_client.config.client_side_validation && task_id.nil? fail ArgumentError, "Missing the required parameter 'task_id' when calling InvoiceProcessingApi.get_task_status_api_v1_processing_tasks_task_id_status_get" end # resource path local_var_path = '/api/v1/processing/tasks/{task_id}/status'.sub('{' + 'task_id' + '}', CGI.escape(task_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AsyncTaskStatus' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.get_task_status_api_v1_processing_tasks_task_id_status_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#get_task_status_api_v1_processing_tasks_task_id_status_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#sign_pdf_api_v1_processing_sign_pdf_post(pdf_file, opts = {}) ⇒ Object
Sign a PDF with client’s certificate (PAdES-B-LT) Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT). **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **eIDAS levels**: SES (self-signed), AdES (commercial CA), QES (PSCO - out of scope). Security: Double authentication X-Internal-Secret + JWT Bearer to retrieve the certificate. **⚠️ Legal disclaimer**: Generated signatures are electronic seals as defined by the eIDAS regulation. The level of legal validity depends on the certificate used (SES/AdES/QES). FactPulse does not provide QES qualified certificates - you must obtain a certificate from a PSCO (qualified Trust Service Provider) for maximum legal validity.
245 246 247 248 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 245 def sign_pdf_api_v1_processing_sign_pdf_post(pdf_file, opts = {}) data, _status_code, _headers = sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(pdf_file, opts) data end |
#sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Sign a PDF with client's certificate (PAdES-B-LT) Signs an uploaded PDF with the electronic certificate configured for the client (via client_uid from JWT). **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **eIDAS levels**: SES (self-signed), AdES (commercial CA), QES (PSCO - out of scope). Security: Double authentication X-Internal-Secret + JWT Bearer to retrieve the certificate. **⚠️ Legal disclaimer**: Generated signatures are electronic seals as defined by the eIDAS regulation. The level of legal validity depends on the certificate used (SES/AdES/QES). FactPulse does not provide QES qualified certificates - you must obtain a certificate from a PSCO (qualified Trust Service Provider) for maximum legal validity.
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 261 def sign_pdf_api_v1_processing_sign_pdf_post_with_http_info(pdf_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.sign_pdf_api_v1_processing_sign_pdf_post ...' end # verify the required parameter 'pdf_file' is set if @api_client.config.client_side_validation && pdf_file.nil? fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.sign_pdf_api_v1_processing_sign_pdf_post" end # resource path local_var_path = '/api/v1/processing/sign-pdf' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['pdf_file'] = pdf_file form_params['reason'] = opts[:'reason'] if !opts[:'reason'].nil? form_params['location'] = opts[:'location'] if !opts[:'location'].nil? form_params['contact'] = opts[:'contact'] if !opts[:'contact'].nil? form_params['field_name'] = opts[:'field_name'] if !opts[:'field_name'].nil? form_params['use_pades_lt'] = opts[:'use_pades_lt'] if !opts[:'use_pades_lt'].nil? form_params['use_timestamp'] = opts[:'use_timestamp'] if !opts[:'use_timestamp'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.sign_pdf_api_v1_processing_sign_pdf_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#sign_pdf_api_v1_processing_sign_pdf_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#sign_pdf_async_api_v1_processing_sign_pdf_async_post(pdf_file, opts = {}) ⇒ Object
Sign a PDF asynchronously (Celery) Signs an uploaded PDF asynchronously via a Celery task. **Difference with /sign-pdf**: - ‘/sign-pdf`: Synchronous signature (blocking until completion) - `/sign-pdf-async`: Asynchronous signature (returns immediately with task_id) **Async advantages**: - No timeout for large files - No blocking of FastAPI worker - Progress tracking via task_id - Ideal for batch processing **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **⚠️ Legal disclaimer**: Same as /sign-pdf (see that endpoint’s documentation).
332 333 334 335 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 332 def sign_pdf_async_api_v1_processing_sign_pdf_async_post(pdf_file, opts = {}) data, _status_code, _headers = sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(pdf_file, opts) data end |
#sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Sign a PDF asynchronously (Celery) Signs an uploaded PDF asynchronously via a Celery task. **Difference with /sign-pdf**: - `/sign-pdf`: Synchronous signature (blocking until completion) - `/sign-pdf-async`: Asynchronous signature (returns immediately with task_id) **Async advantages**: - No timeout for large files - No blocking of FastAPI worker - Progress tracking via task_id - Ideal for batch processing **Supported standards**: PAdES-B-B, PAdES-B-T (timestamping), PAdES-B-LT (long-term archiving). **⚠️ Legal disclaimer**: Same as /sign-pdf (see that endpoint's documentation).
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 348 def sign_pdf_async_api_v1_processing_sign_pdf_async_post_with_http_info(pdf_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.sign_pdf_async_api_v1_processing_sign_pdf_async_post ...' end # verify the required parameter 'pdf_file' is set if @api_client.config.client_side_validation && pdf_file.nil? fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.sign_pdf_async_api_v1_processing_sign_pdf_async_post" end # resource path local_var_path = '/api/v1/processing/sign-pdf-async' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['pdf_file'] = pdf_file form_params['reason'] = opts[:'reason'] if !opts[:'reason'].nil? form_params['location'] = opts[:'location'] if !opts[:'location'].nil? form_params['contact'] = opts[:'contact'] if !opts[:'contact'].nil? form_params['field_name'] = opts[:'field_name'] if !opts[:'field_name'].nil? form_params['use_pades_lt'] = opts[:'use_pades_lt'] if !opts[:'use_pades_lt'].nil? form_params['use_timestamp'] = opts[:'use_timestamp'] if !opts[:'use_timestamp'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.sign_pdf_async_api_v1_processing_sign_pdf_async_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#sign_pdf_async_api_v1_processing_sign_pdf_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#submit_complete_invoice_api_v1_processing_invoices_submit_complete_post(submit_complete_invoice_request, opts = {}) ⇒ SubmitCompleteInvoiceResponse
Submit a complete invoice (generation + signature + submission) Unified endpoint to submit a complete invoice to different destinations. **Automated workflow:** 1. Auto-enrichment (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. Submission: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Destination credentials - 2 modes available:** **Mode 1 - Retrieval via JWT (recommended):** - Credentials are retrieved automatically via the JWT ‘client_uid` - Do not provide the `credentials` field in `destination` - Zero-trust architecture: no secrets in the payload - Example: `"destination": "chorus_pro"` **Mode 2 - Credentials in the payload:** - Provide credentials directly in the payload - Useful for tests or third-party integrations - Example: `"destination": "chorus_pro", "credentials": {…}` **Electronic signature (optional) - 2 modes available:** **Mode 1 - Stored certificate (recommended):** - Certificate is retrieved automatically via the JWT `client_uid` - No key to provide in the payload - PAdES-B-LT signature with timestamp (eIDAS compliant) - Example: `"signature": "Factur-X compliance"` **Mode 2 - Keys in the payload (for tests):** - Provide `key_pem` and `cert_pem` directly - PEM format accepted: raw or base64 - Useful for tests or special cases without stored certificate - Example: `"signature": "—–BEGIN…", "cert_pem": "—–BEGIN…"` If `key_pem` and `cert_pem` are provided → Mode 2 Otherwise → Mode 1 (certificate retrieved via `client_uid`)
413 414 415 416 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 413 def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post(submit_complete_invoice_request, opts = {}) data, _status_code, _headers = submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(submit_complete_invoice_request, opts) data end |
#submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(submit_complete_invoice_request, opts = {}) ⇒ Array<(SubmitCompleteInvoiceResponse, Integer, Hash)>
Submit a complete invoice (generation + signature + submission) Unified endpoint to submit a complete invoice to different destinations. **Automated workflow:** 1. Auto-enrichment (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. Submission: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Destination credentials - 2 modes available:** **Mode 1 - Retrieval via JWT (recommended):** - Credentials are retrieved automatically via the JWT `client_uid` - Do not provide the `credentials` field in `destination` - Zero-trust architecture: no secrets in the payload - Example: `"destination": "chorus_pro"` **Mode 2 - Credentials in the payload:** - Provide credentials directly in the payload - Useful for tests or third-party integrations - Example: `"destination": "chorus_pro", "credentials": {…}` **Electronic signature (optional) - 2 modes available:** **Mode 1 - Stored certificate (recommended):** - Certificate is retrieved automatically via the JWT `client_uid` - No key to provide in the payload - PAdES-B-LT signature with timestamp (eIDAS compliant) - Example: `"signature": "Factur-X compliance"` **Mode 2 - Keys in the payload (for tests):** - Provide `key_pem` and `cert_pem` directly - PEM format accepted: raw or base64 - Useful for tests or special cases without stored certificate - Example: `"signature": "—–BEGIN…", "cert_pem": "—–BEGIN…"` If `key_pem` and `cert_pem` are provided → Mode 2 Otherwise → Mode 1 (certificate retrieved via `client_uid`)
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 423 def submit_complete_invoice_api_v1_processing_invoices_submit_complete_post_with_http_info(submit_complete_invoice_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.submit_complete_invoice_api_v1_processing_invoices_submit_complete_post ...' end # verify the required parameter 'submit_complete_invoice_request' is set if @api_client.config.client_side_validation && submit_complete_invoice_request.nil? fail ArgumentError, "Missing the required parameter 'submit_complete_invoice_request' when calling InvoiceProcessingApi.submit_complete_invoice_api_v1_processing_invoices_submit_complete_post" end # resource path local_var_path = '/api/v1/processing/invoices/submit-complete' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(submit_complete_invoice_request) # return_type return_type = opts[:debug_return_type] || 'SubmitCompleteInvoiceResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.submit_complete_invoice_api_v1_processing_invoices_submit_complete_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#submit_complete_invoice_api_v1_processing_invoices_submit_complete_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post(submit_complete_invoice_request, opts = {}) ⇒ TaskResponse
Submit a complete invoice (asynchronous with Celery) Asynchronous version of the ‘/invoices/submit-complete` endpoint using Celery for background processing. **Automated workflow (same as synchronous version):** 1. Auto-enrichment (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. Submission: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Differences with synchronous version:** - ✅ Non-blocking: Returns immediately with a `task_id` (HTTP 202 Accepted) - ✅ **Background processing**: Invoice is processed by a Celery worker - ✅ **Progress tracking**: Use `/tasks/task_id/status` to track status - ✅ **Ideal for high volumes**: Allows processing many invoices in parallel **How to use:** 1. Submission: Call this endpoint with your invoice data 2. **Immediate return**: You receive a `task_id` (e.g., "abc123-def456") 3. Tracking: Call `/tasks/task_id/status` to check progress 4. Result: When `status = "SUCCESS"`, the `result` field contains the complete response **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
481 482 483 484 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 481 def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post(submit_complete_invoice_request, opts = {}) data, _status_code, _headers = submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(submit_complete_invoice_request, opts) data end |
#submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(submit_complete_invoice_request, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>
Submit a complete invoice (asynchronous with Celery) Asynchronous version of the `/invoices/submit-complete` endpoint using Celery for background processing. **Automated workflow (same as synchronous version):** 1. Auto-enrichment (optional): retrieves data via public APIs and Chorus Pro/AFNOR 2. **Factur-X PDF generation**: creates a PDF/A-3 with embedded XML 3. **Electronic signature** (optional): signs the PDF with a certificate 4. Submission: sends to the chosen destination (Chorus Pro or AFNOR PDP) **Supported destinations:** - **Chorus Pro**: French B2G platform (invoices to public sector) - **AFNOR PDP**: Partner Dematerialization Platforms **Differences with synchronous version:** - ✅ Non-blocking: Returns immediately with a `task_id` (HTTP 202 Accepted) - ✅ **Background processing**: Invoice is processed by a Celery worker - ✅ **Progress tracking**: Use `/tasks/task_id/status` to track status - ✅ **Ideal for high volumes**: Allows processing many invoices in parallel **How to use:** 1. Submission: Call this endpoint with your invoice data 2. **Immediate return**: You receive a `task_id` (e.g., "abc123-def456") 3. Tracking: Call `/tasks/task_id/status` to check progress 4. Result: When `status = "SUCCESS"`, the `result` field contains the complete response **Credentials and signature**: Same modes as the synchronous version (JWT or payload).
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 491 def submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post_with_http_info(submit_complete_invoice_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post ...' end # verify the required parameter 'submit_complete_invoice_request' is set if @api_client.config.client_side_validation && submit_complete_invoice_request.nil? fail ArgumentError, "Missing the required parameter 'submit_complete_invoice_request' when calling InvoiceProcessingApi.submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post" end # resource path local_var_path = '/api/v1/processing/invoices/submit-complete-async' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(submit_complete_invoice_request) # return_type return_type = opts[:debug_return_type] || 'TaskResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#submit_complete_invoice_async_api_v1_processing_invoices_submit_complete_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post(pdf_file, opts = {}) ⇒ PDFValidationResultAPI
Validate a complete Factur-X PDF 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)
551 552 553 554 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 551 def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post(pdf_file, opts = {}) data, _status_code, _headers = validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(pdf_file, opts) data end |
#validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(PDFValidationResultAPI, Integer, Hash)>
Validate a complete Factur-X PDF 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)
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 563 def validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post_with_http_info(pdf_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post ...' end # verify the required parameter 'pdf_file' is set if @api_client.config.client_side_validation && pdf_file.nil? fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post" end # resource path local_var_path = '/api/v1/processing/validate-facturx-pdf' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['pdf_file'] = pdf_file form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil? form_params['use_verapdf'] = opts[:'use_verapdf'] if !opts[:'use_verapdf'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'PDFValidationResultAPI' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_facturx_pdf_api_v1_processing_validate_facturx_pdf_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post(pdf_file, opts = {}) ⇒ TaskResponse
Validate a Factur-X PDF (asynchronous with polling) 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) task_id = response.json() # 2. Poll every 2 seconds while True: status_response = requests.get(f"/tasks/task_id/status") status = status_response.json() if status == "SUCCESS": result = status["validation_result"] print(f"Compliant: 'is_compliant'") break elif status == "FAILURE": print(f"Error: [’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
626 627 628 629 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 626 def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post(pdf_file, opts = {}) data, _status_code, _headers = validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(pdf_file, opts) data end |
#validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>
Validate a Factur-X PDF (asynchronous with polling) 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) task_id = response.json() # 2. Poll every 2 seconds while True: status_response = requests.get(f"/tasks/task_id/status") status = status_response.json() if status == "SUCCESS": result = status["validation_result"] print(f"Compliant: FactPulse::InvoiceProcessingApi.&'is_compliant&'is_compliant'") break elif status == "FAILURE": print(f"Error: ['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
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 638 def validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post_with_http_info(pdf_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post ...' end # verify the required parameter 'pdf_file' is set if @api_client.config.client_side_validation && pdf_file.nil? fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post" end # resource path local_var_path = '/api/v1/processing/validate-facturx-async' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['pdf_file'] = pdf_file form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil? form_params['use_verapdf'] = opts[:'use_verapdf'] if !opts[:'use_verapdf'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TaskResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_facturx_pdf_async_api_v1_processing_validate_facturx_async_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post(pdf_file, opts = {}) ⇒ Object
Validate electronic signatures of a PDF Validates electronic signatures present in an uploaded PDF. **Verifications performed**: - Presence of signatures - Document integrity (not modified since signing) - Certificate validity - Chain of trust (if available) - Presence of timestamp (PAdES-B-T) - Validation data (PAdES-B-LT) **Supported standards**: PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note**: This validation is technical (cryptographic integrity). Legal validity depends on the eIDAS level of the certificate (SES/AdES/QES) and the context of use.
699 700 701 702 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 699 def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post(pdf_file, opts = {}) data, _status_code, _headers = validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(pdf_file, opts) data end |
#validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Validate electronic signatures of a PDF Validates electronic signatures present in an uploaded PDF. **Verifications performed**: - Presence of signatures - Document integrity (not modified since signing) - Certificate validity - Chain of trust (if available) - Presence of timestamp (PAdES-B-T) - Validation data (PAdES-B-LT) **Supported standards**: PAdES-B-B, PAdES-B-T, PAdES-B-LT, ISO 32000-2. **⚠️ Note**: This validation is technical (cryptographic integrity). Legal validity depends on the eIDAS level of the certificate (SES/AdES/QES) and the context of use.
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 709 def validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post_with_http_info(pdf_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post ...' end # verify the required parameter 'pdf_file' is set if @api_client.config.client_side_validation && pdf_file.nil? fail ArgumentError, "Missing the required parameter 'pdf_file' when calling InvoiceProcessingApi.validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post" end # resource path local_var_path = '/api/v1/processing/validate-pdf-signature' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['pdf_file'] = pdf_file # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_pdf_signature_endpoint_api_v1_processing_validate_pdf_signature_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_xml_api_v1_processing_validate_xml_post(xml_file, opts = {}) ⇒ ValidationSuccessResponse
Validate an existing Factur-X XML 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
769 770 771 772 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 769 def validate_xml_api_v1_processing_validate_xml_post(xml_file, opts = {}) data, _status_code, _headers = validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts) data end |
#validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts = {}) ⇒ Array<(ValidationSuccessResponse, Integer, Hash)>
Validate an existing Factur-X XML 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": [ " Invoice total (120.00) does not match calculated sum (100.00 + 20.00)", " 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
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'lib/factpulse/api/invoice_processing_api.rb', line 780 def validate_xml_api_v1_processing_validate_xml_post_with_http_info(xml_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InvoiceProcessingApi.validate_xml_api_v1_processing_validate_xml_post ...' end # verify the required parameter 'xml_file' is set if @api_client.config.client_side_validation && xml_file.nil? fail ArgumentError, "Missing the required parameter 'xml_file' when calling InvoiceProcessingApi.validate_xml_api_v1_processing_validate_xml_post" end # resource path local_var_path = '/api/v1/processing/validate-xml' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['xml_file'] = xml_file form_params['profile'] = opts[:'profile'] if !opts[:'profile'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ValidationSuccessResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InvoiceProcessingApi.validate_xml_api_v1_processing_validate_xml_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InvoiceProcessingApi#validate_xml_api_v1_processing_validate_xml_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |