@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
63 lines (62 loc) • 1.97 kB
TypeScript
import { InvoiceFormat } from '../../interfaces/common.js';
/**
* Utility class for detecting invoice formats
*/
export declare class FormatDetector {
/**
* Detects the format of an XML document
* @param xml XML content to analyze
* @returns Detected invoice format
*/
static detectFormat(xml: string): InvoiceFormat;
/**
* Performs a quick format check based on string content
* This is faster than full XML parsing for obvious cases
* @param xml XML string
* @returns Detected format or UNKNOWN if more analysis is needed
*/
private static quickFormatCheck;
/**
* Checks if the document is a UBL format
* @param root Root element
* @returns True if it's a UBL format
*/
private static isUBLFormat;
/**
* Checks if the document is an XRechnung format
* @param doc XML document
* @returns True if it's an XRechnung format
*/
private static isXRechnungFormat;
/**
* Checks if the document is a CII format (Factur-X/ZUGFeRD v2+)
* @param root Root element
* @returns True if it's a CII format
*/
private static isCIIFormat;
/**
* Checks if the document is a ZUGFeRD v1 format
* @param root Root element
* @returns True if it's a ZUGFeRD v1 format
*/
private static isZUGFeRDV1Format;
/**
* Checks if the document is a FatturaPA format
* @param root Root element
* @returns True if it's a FatturaPA format
*/
private static isFatturaPAFormat;
/**
* Detects the specific CII format (Factur-X vs ZUGFeRD)
* @param doc XML document
* @param xml Original XML string for fallback checks
* @returns Detected format
*/
private static detectCIIFormat;
/**
* Fallback method to detect CII format from string content
* @param xml XML string
* @returns Detected format
*/
private static detectCIIFormatFromString;
}