xrechnung-kit API reference

XRechnungGenerator
in package

FinalYes

XRechnungGenerator is responsible for generating XRechnung XML files using the data provided by the XRechnungEntity.

Table of Contents

Constants

DOCUMENT_TYPES_TO_SKIP_GENERATION  = ['offer', 'order']

Methods

__construct()  : mixed
addBuyerParty()  : XRechnungGenerator
Adds buyer party details to the XML content from XRechnungEntity object.
addInvoiceLineItem()  : XRechnungGenerator
Adds an invoice line item to the XML content from XRechnungEntity object.
generateXRechnung()  : string
Builds the XRechnung XML in memory, validates it against the bundled UBL XSD, then atomically lands it on disk:

Constants

DOCUMENT_TYPES_TO_SKIP_GENERATION

public mixed DOCUMENT_TYPES_TO_SKIP_GENERATION = ['offer', 'order']

Methods

__construct()

public __construct(XRechnungEntity $xRechnungEntity[, XRechnungValidator|null $validator = null ][, LoggerInterface|null $logger = null ][, NotificationDispatcherInterface|null $notifications = null ][, AtomicWriter|null $writer = null ]) : mixed
Parameters
$xRechnungEntity : XRechnungEntity
$validator : XRechnungValidator|null = null
$logger : LoggerInterface|null = null
$notifications : NotificationDispatcherInterface|null = null
$writer : AtomicWriter|null = null

generateXRechnung()

Builds the XRechnung XML in memory, validates it against the bundled UBL XSD, then atomically lands it on disk:

public generateXRechnung([string $fileName = 'XRechnung.xml' ]) : string
  • Valid XML -> $fileName (and any pre-existing _invalid sibling is removed).
  • Invalid XML -> the *_invalid.xml sibling (and any pre-existing valid file at $fileName is removed). The pipeline never presents invalid XML at the caller-supplied target name.

'cancel' invoice type writes to $fileName without validation, preserving the L3 behaviour. A4 will revisit whether cancel docs should validate.

Parameters
$fileName : string = 'XRechnung.xml'
Return values
string

The path the XML was written to (either $fileName or its quarantine sibling).


        
On this page

Search results