UNPKG

@fin.cx/einvoice

Version:

A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.

41 lines (40 loc) 1.06 kB
import * as plugins from './plugins.js'; /** * A class to convert a given XML string (ZUGFeRD/Factur-X, UBL or fatturaPA) * into a structured ILetter with invoice data. * * Handles different invoice XML formats: * - ZUGFeRD/Factur-X (CII) * - UBL * - FatturaPA */ export declare class FacturXDecoder { private xmlString; private xmlFormat; private xmlDoc; constructor(xmlString: string); /** * Detects the XML invoice format using simple string checks */ private detectFormat; /** * Extracts text from the first element matching the XPath-like selector */ private getElementText; /** * Converts XML to a structured letter object */ getLetterData(): Promise<plugins.tsclass.business.ILetter>; /** * Parse CII (ZUGFeRD/Factur-X) formatted XML */ private parseCII; /** * Parse generic XML using default approach */ private parseGeneric; /** * Creates a default letter object with minimal data */ private createDefaultLetter; }