Interface EInvoiceFormat

Interface representing an e-invoice format generation service.

interface EInvoiceFormat {
    get customizationID(): string;
    get mimeType(): EInvoiceMIMEType;
    get profileID(): string;
    get syntax(): "UBL" | "CII";
    fillInvoiceDefaults(invoice: Invoice): void;
    fillMappingDefaults(mapping: Mapping): void;
    generate(
        invoice: Invoice,
        options: InvoiceServiceOptions,
    ): Promise<string | Uint8Array<ArrayBufferLike>>;
}

Accessors

  • get customizationID(): string

    The default customization ID of the format.

    This ID specifies a particular customization of the invoice format, which may define additional constraints or extensions to the standard.

    Returns string

  • get mimeType(): EInvoiceMIMEType

    The MIME type associated with this invoice format.

    This indicates the expected media type when generating or processing invoices in this format.

    Returns EInvoiceMIMEType

  • get profileID(): string

    The default profile ID of the format.

    The profile ID identifies a specific usage profile for the e-invoice, often used to distinguish between different industry-specific implementations.

    Returns string

  • get syntax(): "UBL" | "CII"

    The syntax used for this e-invoice format.

    This is either 'UBL' (Universal Business Language) or 'CII' (Cross Industry Invoice), which are both common standards for electronic invoicing.

    Returns "UBL" | "CII"

Methods

  • Populates an invoice with default and computable values.

    This method fills in any missing fields in the invoice with default values to ensure it meets the required specifications.

    Parameters

    • invoice: Invoice

      The invoice to be updated.

    Returns void

  • Populates a mapping with default and computable values.

    This method ensures that all required fields in the mapping have reasonable defaults before further processing.

    Parameters

    • mapping: Mapping

      The mapping definition to be updated.

    Returns void

  • Generates an invoice in the specified format.

    This function converts the given invoice data into a serialized format (such as XML or JSON) that conforms to the selected e-invoice standard.

    Parameters

    • invoice: Invoice

      The invoice data structure containing all required information.

    • options: InvoiceServiceOptions

      Additional options influencing invoice generation.

    Returns Promise<string | Uint8Array<ArrayBufferLike>>

    A promise resolving to the generated invoice as a string or a Uint8Array, depending on the format.