@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
68 lines (67 loc) • 2.06 kB
TypeScript
import { BaseValidator } from './base.validator.js';
import { ValidationLevel } from '../interfaces.js';
import type { ValidationResult } from '../interfaces.js';
/**
* Validator for Factur-X/ZUGFeRD invoice format
* Implements validation rules according to EN16931 and Factur-X specification
*/
export declare class FacturXValidator extends BaseValidator {
private static NS_RSMT;
private static NS_RAM;
private static NS_UDT;
private xmlDoc;
private profile;
constructor(xml: string);
/**
* Validates the Factur-X invoice against the specified level
* @param level Validation level
* @returns Validation result
*/
validate(level?: ValidationLevel): ValidationResult;
/**
* Validates XML against schema
* @returns True if schema validation passed
*/
protected validateSchema(): boolean;
/**
* Validates structure of the XML document
* @returns True if structure validation passed
*/
private validateStructure;
/**
* Validates business rules
* @returns True if business rule validation passed
*/
protected validateBusinessRules(): boolean;
/**
* Detects Factur-X profile from the XML
*/
private detectProfile;
/**
* Validates amount calculations in the invoice
* @returns True if amount validation passed
*/
private validateAmounts;
/**
* Validates mutually exclusive fields
* @returns True if validation passed
*/
private validateMutuallyExclusiveFields;
/**
* Validates seller VAT identifier requirements
* @returns True if validation passed
*/
private validateSellerVatIdentifier;
/**
* Helper method to check if a node exists
* @param xpathExpression XPath to check
* @returns True if node exists
*/
private exists;
/**
* Helper method to get a number value from XPath
* @param xpathExpression XPath to get number from
* @returns Number value or NaN if not found
*/
private getNumberValue;
}