@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
80 lines (79 loc) • 2.36 kB
TypeScript
/**
* Supported electronic invoice formats
*/
export declare enum InvoiceFormat {
UNKNOWN = "unknown",
UBL = "ubl",// Universal Business Language
CII = "cii",// Cross-Industry Invoice
ZUGFERD = "zugferd",// ZUGFeRD (German e-invoice format)
FACTURX = "facturx",// Factur-X (French e-invoice format)
XRECHNUNG = "xrechnung",// XRechnung (German e-invoice implementation of EN16931)
FATTURAPA = "fatturapa"
}
/**
* Formats supported for export operations
* This is a subset of InvoiceFormat that only includes formats
* that can be generated and embedded in PDFs
*/
export type ExportFormat = 'facturx' | 'zugferd' | 'xrechnung' | 'ubl' | 'cii';
/**
* Describes a validation level for invoice validation
*/
export declare enum ValidationLevel {
SYNTAX = "syntax",// Schema validation only
SEMANTIC = "semantic",// Semantic validation (field types, required fields, etc.)
BUSINESS = "business"
}
/**
* Describes a validation error
*/
export interface ValidationError {
code: string;
message: string;
location?: string;
}
/**
* Result of a validation operation
*/
export interface ValidationResult {
valid: boolean;
errors: ValidationError[];
level: ValidationLevel;
}
/**
* Options for the EInvoice class
*/
export interface EInvoiceOptions {
validateOnLoad?: boolean;
validationLevel?: ValidationLevel;
}
/**
* Interface for validator implementations
*/
export interface IValidator {
validate(level?: ValidationLevel): ValidationResult;
isValid(): boolean;
getValidationErrors(): ValidationError[];
}
/**
* PDF interface
*/
export interface IPdf {
name: string;
id: string;
metadata: {
textExtraction: string;
format?: string;
embeddedXml?: {
filename: string;
description: string;
};
};
buffer: Uint8Array;
}
export type { TInvoice } from '@tsclass/tsclass/dist_ts/finance/index.js';
export type { TCreditNote } from '@tsclass/tsclass/dist_ts/finance/index.js';
export type { TDebitNote } from '@tsclass/tsclass/dist_ts/finance/index.js';
export type { TContact } from '@tsclass/tsclass/dist_ts/business/index.js';
export type { TLetterEnvelope } from '@tsclass/tsclass/dist_ts/business/index.js';
export type { TDocumentEnvelope } from '@tsclass/tsclass/dist_ts/business/index.js';