@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
45 lines (44 loc) • 1.53 kB
TypeScript
import { ValidationLevel } from '../interfaces.js';
import type { ValidationResult, ValidationError } from '../interfaces.js';
/**
* Base validator class that defines common validation functionality
* for all invoice format validators
*/
export declare abstract class BaseValidator {
protected xml: string;
protected errors: ValidationError[];
constructor(xml: string);
/**
* Validates XML against the specified level of validation
* @param level Validation level (syntax, semantic, business)
* @returns Result of validation
*/
abstract validate(level?: ValidationLevel): ValidationResult;
/**
* Gets all validation errors found during validation
* @returns Array of validation errors
*/
getValidationErrors(): ValidationError[];
/**
* Checks if the document is valid
* @returns True if no validation errors were found
*/
isValid(): boolean;
/**
* Validates XML against schema
* @returns True if schema validation passed
*/
protected abstract validateSchema(): boolean;
/**
* Validates business rules
* @returns True if business rule validation passed
*/
protected abstract validateBusinessRules(): boolean;
/**
* Adds an error to the validation errors list
* @param code Error code
* @param message Error message
* @param location Location in the XML where the error occurred
*/
protected addError(code: string, message: string, location?: string): void;
}