QuittioFake
extends QuittioManager
in package
Calculates invoices and chooses formats and profiles like a real run (requested formats, defaults.format, the automatic choice, profile keys and objects, defaults.profile), but skips validation, XML, template and PDF. Records every render call and every queued render, and dispatches the events of a real run (InvoiceRendering, InvoiceValidated with an empty result unless validation is off, InvoiceRendered).
Table of Contents
Constants
- EXTENSION_TYPES : array<string|int, mixed> = \Quittio\Laravel\Support\DriverRegistry::TYPES
Properties
- $app : Container
Methods
- __construct() : mixed
- accountStatement() : RenderableDocumentBuilder
- A new account statement with the seller and its defaults.
- assertDocumentQueued() : void
- assertDocumentRendered() : void
- assertNothingQueued() : void
- Asserts that neither an invoice nor a document was queued.
- assertNothingRendered() : void
- assertQueued() : void
- assertRendered() : void
- assertRenderedCount() : void
- cancellation() : InvoiceBuilder
- Builder for the cancellation of an issued invoice; render it like any invoice: Quittio::make(Quittio::cancellation($original, 'ST-2026-0001', 'Doppelt berechnet'))->render().
- check() : ValidationResult
- Validates like a render run, without template and PDF, and returns the result; see Quittio\Core\Quittio::check().
- core() : Quittio
- The core built from the current configuration; it is kept until the quittio configuration changes (config()->set(), another tenant), flush(), extend() or registerCountry().
- coreWithLevels() : Quittio
- A new core (not the cached one) that validates with the configured levels plus $levels, every driver with its settings of validation.drivers.* exactly as in a render run; e.g. quittio:validate --kosit --verapdf.
- countries() : CountryRegistry
- The country packs of the core.
- defaultVat() : TaxPreset|null
- VAT of invoice lines without VAT treatment (InvoiceBuilder::useDefaultVat()): the preset of quittio.defaults.vat, otherwise the standard preset of the seller's country pack; invoices of small businesses use the small business preset of the pack.
- deliveryNote() : RenderableDocumentBuilder
- A new delivery note with the seller and its defaults.
- document() : PendingDocument
- Starts the render call of a document; a builder is built at once.
- documents() : array<int, RenderedDocument>
- The recorded document results (quotes, reminders, …), in order.
- edit() : RenderableInvoiceBuilder
- Builder that continues existing invoice data (a draft, an invoice read from XML); the declared amounts are compared with the configured calculator (calculation.*).
- extend() : static
- Registers a driver: renderer, validator, serializer or format_resolver, or a rule that replaces the PHP rule with the code $name. The factory receives the container and the driver's configuration.
- flush() : static
- Forgets the built core. Not needed after configuration changes: core() builds a new one when the quittio configuration differs from the one the core was built from.
- formats() : FormatRegistry
- The output formats of the core.
- invoice() : RenderableInvoiceBuilder
- A new invoice with the seller and its defaults (config/quittio.php, or the current issuer of quittio/managed); ends with ->render() or ->build().
- make() : PendingInvoice
- Starts a render call: format(), profile(), locale() … and render() or queue(). A builder is built and a model converted (ProvidesInvoiceData) at once.
- orderConfirmation() : RenderableDocumentBuilder
- A new order confirmation with the seller and its defaults.
- paymentReminder() : RenderableDocumentBuilder
- prepare() : PreparedInvoice
- Calculates and validates without rendering, whatever the validation mode; see Quittio\Core\Quittio::prepare().
- profiles() : ProfileRegistry
- The profiles of the core, those of the country packs included.
- proforma() : RenderableDocumentBuilder
- A new proforma invoice with the seller and its defaults.
- queued() : array<int, RenderInvoice>
- The recorded queued render jobs, in order.
- queuedDocuments() : array<int, RenderDocument>
- The recorded queued render jobs of documents, in order.
- queueDocument() : RenderDocument
- Records the document job and dispatches it like the real manager.
- queueInvoice() : RenderInvoice
- Records the job and dispatches it like the real manager, so Queue::fake() sees it and a sync queue renders it with the fake.
- quote() : RenderableDocumentBuilder
- A new quote with the seller and its defaults (config/quittio.php or the current issuer).
- read() : ReadResult
- Reads an incoming XML or PDF e-invoice from its content (bytes), never from a path.
- readFile() : ReadResult
- Reads an incoming XML or PDF e-invoice from a file.
- registerCountry() : static
- Registers a country pack; it wins over discovered and configured packs with the same code. The next call builds the core again (the default country depends on the packs).
- renderDocument() : RenderedDocument
- The render run behind PendingDocument::render(), with the events DocumentRendering and DocumentRendered.
- rendered() : array<int, RenderedInvoice>
- The recorded invoice results, in order (the main format of each call).
- renderInvoice() : RenderedInvoice
- The render run behind PendingInvoice::render(), with the events InvoiceRendering, InvoiceValidated (not in the mode "off") or InvoiceValidationFailed, and InvoiceRendered.
- settings() : Settings
- Typed read access to config('quittio').
- validateFile() : ValidationResult
- Reads and validates an incoming e-invoice (content, never a path) with all configured levels.
- validatePath() : ValidationResult
- Reads and validates an incoming e-invoice from a file with all configured levels.
- build() : Quittio
- container() : Container
- The application the manager works in. Under Laravel Octane that is the application of the current request (Container::getInstance()), not the one that created the singleton, so that configuration set for the request applies.
- run() : RenderedInvoice
- The render run behind renderInvoice(), without the events; the fake replaces it.
- runDocument() : RenderedDocument
- The render run behind renderDocument(), without the events; the fake replaces it.
Constants
EXTENSION_TYPES
public
array<string|int, mixed>
EXTENSION_TYPES
= \Quittio\Laravel\Support\DriverRegistry::TYPES
Properties
$app read-only
protected
Container
$app
Methods
__construct()
public
__construct(Container $app) : mixed
Parameters
- $app : Container
accountStatement()
A new account statement with the seller and its defaults.
public
accountStatement() : RenderableDocumentBuilder
Return values
RenderableDocumentBuilderassertDocumentQueued()
public
assertDocumentQueued([callable(RenderDocument): bool|null $callback = null ]) : void
Parameters
- $callback : callable(RenderDocument): bool|null = null
-
e.g. fn ($job) => $job->data()->number === 'AN-1'
assertDocumentRendered()
public
assertDocumentRendered([callable(RenderedDocument): bool|null $callback = null ]) : void
Parameters
- $callback : callable(RenderedDocument): bool|null = null
assertNothingQueued()
Asserts that neither an invoice nor a document was queued.
public
assertNothingQueued() : void
assertNothingRendered()
public
assertNothingRendered() : void
assertQueued()
public
assertQueued([callable(RenderInvoice): bool|null $callback = null ]) : void
Parameters
- $callback : callable(RenderInvoice): bool|null = null
-
e.g. fn ($job) => $job->data()->number === 'RE-1'
assertRendered()
public
assertRendered([callable(RenderedInvoice): bool|null $callback = null ]) : void
Parameters
- $callback : callable(RenderedInvoice): bool|null = null
assertRenderedCount()
public
assertRenderedCount(int $count) : void
Parameters
- $count : int
cancellation()
Builder for the cancellation of an issued invoice; render it like any invoice: Quittio::make(Quittio::cancellation($original, 'ST-2026-0001', 'Doppelt berechnet'))->render().
public
cancellation(InvoiceData $original, string $number[, string|null $reason = null ][, string|null $strategy = null ][, Date|null $issueDate = null ][, array<int, BigDecimal|int|string, amount?: string}>|null $lines = null ][, CancellationHistory|null $history = null ][, string|null $title = null ]) : InvoiceBuilder
Parameters
- $original : InvoiceData
- $number : string
- $reason : string|null = null
- $strategy : string|null = null
- $issueDate : Date|null = null
- $lines : array<int, BigDecimal|int|string, amount?: string}>|null = null
-
partial cancellation; null = full
- $history : CancellationHistory|null = null
-
earlier partial cancellations, for the cumulative rounding of the VAT
- $title : string|null = null
-
document title in the PDF, e.g. "Stornorechnung"; null = the title of the country pack's correction policy
Return values
InvoiceBuildercheck()
Validates like a render run, without template and PDF, and returns the result; see Quittio\Core\Quittio::check().
public
check(InvoiceData $invoice, RenderOptions $options) : ValidationResult
Parameters
- $invoice : InvoiceData
- $options : RenderOptions
Tags
Return values
ValidationResultcore()
The core built from the current configuration; it is kept until the quittio configuration changes (config()->set(), another tenant), flush(), extend() or registerCountry().
public
core() : Quittio
Return values
QuittiocoreWithLevels()
A new core (not the cached one) that validates with the configured levels plus $levels, every driver with its settings of validation.drivers.* exactly as in a render run; e.g. quittio:validate --kosit --verapdf.
public
coreWithLevels(array<int, string> $levels) : Quittio
Parameters
- $levels : array<int, string>
-
names as in quittio.validation.levels, e.g. kosit, verapdf
Return values
Quittiocountries()
The country packs of the core.
public
countries() : CountryRegistry
Return values
CountryRegistrydefaultVat()
VAT of invoice lines without VAT treatment (InvoiceBuilder::useDefaultVat()): the preset of quittio.defaults.vat, otherwise the standard preset of the seller's country pack; invoices of small businesses use the small business preset of the pack.
public
defaultVat(string|null $sellerCountry, bool $smallBusiness) : TaxPreset|null
Parameters
- $sellerCountry : string|null
- $smallBusiness : bool
Return values
TaxPreset|nulldeliveryNote()
A new delivery note with the seller and its defaults.
public
deliveryNote() : RenderableDocumentBuilder
Return values
RenderableDocumentBuilderdocument()
Starts the render call of a document; a builder is built at once.
public
document(DocumentData|DocumentBuilder $document) : PendingDocument
Parameters
- $document : DocumentData|DocumentBuilder
Tags
Return values
PendingDocumentdocuments()
The recorded document results (quotes, reminders, …), in order.
public
documents() : array<int, RenderedDocument>
Return values
array<int, RenderedDocument>edit()
Builder that continues existing invoice data (a draft, an invoice read from XML); the declared amounts are compared with the configured calculator (calculation.*).
public
edit(InvoiceData $data) : RenderableInvoiceBuilder
Parameters
- $data : InvoiceData
Return values
RenderableInvoiceBuilderextend()
Registers a driver: renderer, validator, serializer or format_resolver, or a rule that replaces the PHP rule with the code $name. The factory receives the container and the driver's configuration.
public
extend(string $type, string $name, callable(Container, array<string, mixed>): object $factory) : static
Parameters
- $type : string
- $name : string
- $factory : callable(Container, array<string, mixed>): object
Return values
staticflush()
Forgets the built core. Not needed after configuration changes: core() builds a new one when the quittio configuration differs from the one the core was built from.
public
flush() : static
Return values
staticformats()
The output formats of the core.
public
formats() : FormatRegistry
Return values
FormatRegistryinvoice()
A new invoice with the seller and its defaults (config/quittio.php, or the current issuer of quittio/managed); ends with ->render() or ->build().
public
invoice() : RenderableInvoiceBuilder
Return values
RenderableInvoiceBuildermake()
Starts a render call: format(), profile(), locale() … and render() or queue(). A builder is built and a model converted (ProvidesInvoiceData) at once.
public
make(InvoiceData|ProvidesInvoiceData|InvoiceBuilder $data) : PendingInvoice
Parameters
Tags
Return values
PendingInvoiceorderConfirmation()
A new order confirmation with the seller and its defaults.
public
orderConfirmation() : RenderableDocumentBuilder
Return values
RenderableDocumentBuilderpaymentReminder()
public
paymentReminder([int $level = 0 ]) : RenderableDocumentBuilder
Parameters
- $level : int = 0
-
0 = payment reminder, 1 = first reminder, 2 = second reminder …
Return values
RenderableDocumentBuilderprepare()
Calculates and validates without rendering, whatever the validation mode; see Quittio\Core\Quittio::prepare().
public
prepare(InvoiceData $invoice, RenderOptions $options) : PreparedInvoice
Parameters
- $invoice : InvoiceData
- $options : RenderOptions
Tags
Return values
PreparedInvoiceprofiles()
The profiles of the core, those of the country packs included.
public
profiles() : ProfileRegistry
Return values
ProfileRegistryproforma()
A new proforma invoice with the seller and its defaults.
public
proforma() : RenderableDocumentBuilder
Return values
RenderableDocumentBuilderqueued()
The recorded queued render jobs, in order.
public
queued() : array<int, RenderInvoice>
Return values
array<int, RenderInvoice>queuedDocuments()
The recorded queued render jobs of documents, in order.
public
queuedDocuments() : array<int, RenderDocument>
Return values
array<int, RenderDocument>queueDocument()
Records the document job and dispatches it like the real manager.
public
queueDocument(RenderDocument $job) : RenderDocument
Parameters
- $job : RenderDocument
Return values
RenderDocumentqueueInvoice()
Records the job and dispatches it like the real manager, so Queue::fake() sees it and a sync queue renders it with the fake.
public
queueInvoice(RenderInvoice $job) : RenderInvoice
Parameters
- $job : RenderInvoice
Return values
RenderInvoicequote()
A new quote with the seller and its defaults (config/quittio.php or the current issuer).
public
quote() : RenderableDocumentBuilder
Return values
RenderableDocumentBuilderread()
Reads an incoming XML or PDF e-invoice from its content (bytes), never from a path.
public
read(string $content) : ReadResult
Parameters
- $content : string
Tags
Return values
ReadResultreadFile()
Reads an incoming XML or PDF e-invoice from a file.
public
readFile(string $path) : ReadResult
Parameters
- $path : string
Tags
Return values
ReadResultregisterCountry()
Registers a country pack; it wins over discovered and configured packs with the same code. The next call builds the core again (the default country depends on the packs).
public
registerCountry(CountryPack $pack) : static
Parameters
- $pack : CountryPack
Return values
staticrenderDocument()
The render run behind PendingDocument::render(), with the events DocumentRendering and DocumentRendered.
public
renderDocument(DocumentData $document, RenderOptions $options) : RenderedDocument
Parameters
- $document : DocumentData
- $options : RenderOptions
Return values
RenderedDocumentrendered()
The recorded invoice results, in order (the main format of each call).
public
rendered() : array<int, RenderedInvoice>
Return values
array<int, RenderedInvoice>renderInvoice()
The render run behind PendingInvoice::render(), with the events InvoiceRendering, InvoiceValidated (not in the mode "off") or InvoiceValidationFailed, and InvoiceRendered.
public
renderInvoice(InvoiceData $invoice, RenderOptions $options) : RenderedInvoice
Parameters
- $invoice : InvoiceData
- $options : RenderOptions
Tags
Return values
RenderedInvoicesettings()
Typed read access to config('quittio').
public
settings() : Settings
Return values
SettingsvalidateFile()
Reads and validates an incoming e-invoice (content, never a path) with all configured levels.
public
validateFile(string $content) : ValidationResult
Parameters
- $content : string
Tags
Return values
ValidationResultvalidatePath()
Reads and validates an incoming e-invoice from a file with all configured levels.
public
validatePath(string $path) : ValidationResult
Parameters
- $path : string
Tags
Return values
ValidationResultbuild()
protected
build([array<int, string>|null $levels = null ]) : Quittio
Parameters
- $levels : array<int, string>|null = null
-
validation levels instead of quittio.validation.levels
Return values
Quittiocontainer()
The application the manager works in. Under Laravel Octane that is the application of the current request (Container::getInstance()), not the one that created the singleton, so that configuration set for the request applies.
protected
container() : Container
Return values
Containerrun()
The render run behind renderInvoice(), without the events; the fake replaces it.
protected
run(InvoiceData $invoice, RenderOptions $options) : RenderedInvoice
Parameters
- $invoice : InvoiceData
- $options : RenderOptions
Return values
RenderedInvoicerunDocument()
The render run behind renderDocument(), without the events; the fake replaces it.
protected
runDocument(DocumentData $document, RenderOptions $options) : RenderedDocument
Parameters
- $document : DocumentData
- $options : RenderOptions