@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
44 lines (43 loc) • 1.5 kB
TypeScript
import { BaseEncoder } from '../base/base.encoder.js';
import type { TInvoice, TCreditNote, TDebitNote } from '../../interfaces/common.js';
import { CIIProfile } from './cii.types.js';
/**
* Base encoder for CII-based invoice formats
*/
export declare abstract class CIIBaseEncoder extends BaseEncoder {
protected profile: CIIProfile;
/**
* Sets the CII profile to use for encoding
* @param profile CII profile
*/
setProfile(profile: CIIProfile): void;
/**
* Encodes a TInvoice object into CII XML
* @param invoice TInvoice object to encode
* @returns CII XML string
*/
encode(invoice: TInvoice): Promise<string>;
/**
* Encodes a TCreditNote object into CII XML
* @param creditNote TCreditNote object to encode
* @returns CII XML string
*/
protected abstract encodeCreditNote(creditNote: TCreditNote): Promise<string>;
/**
* Encodes a TDebitNote object into CII XML
* @param debitNote TDebitNote object to encode
* @returns CII XML string
*/
protected abstract encodeDebitNote(debitNote: TDebitNote): Promise<string>;
/**
* Creates the XML declaration and root element
* @returns XML string with declaration and root element
*/
protected createXmlRoot(): string;
/**
* Formats a date as an ISO string (YYYY-MM-DD)
* @param timestamp Timestamp to format
* @returns Formatted date string
*/
protected formatDate(timestamp: number): string;
}