Zum Inhalt springen

API reference / Quittio \ Core \ Countries

CorrectionPolicy

final readonly class in quittio/core

Quittio\Core\Countries\CorrectionPolicy · Source

Default handling of cancellations and corrections in a country, and the titles of these documents. Quittio::cancellation() takes the cancellation strategy and the titles "cancellation" and "cancellation_self_billed"; Quittio::correction() the title "correction", Quittio::priceReduction() the title "price_reduction"; the title "self_billed" is the title of self-billed invoices in PDF and HTML (InvoiceTitle::policyTitle()); the Managed layer takes the correction strategy.

Constants#

ConstantValueDescription
CANCELLATION_CREDIT_NOTE'credit_note'
CANCELLATION_NEGATIVE_INVOICE'negative_invoice'
CORRECTION_CANCEL_AND_REISSUE'cancel_and_reissue'
CORRECTION_CORRECTED_INVOICE'corrected_invoice'

Properties#

PropertyTypeDescription
$cancellationStrategy readonlystring
$correctionStrategy readonlystring
$strategyResolver readonly(Closure(InvoiceData): ?string)|nullthe cancellation strategy for a particular original, e.g. by the format it is sent in; null or a null result = $cancellationStrategy
$titles readonlyarray<string, array<string, string>>document kind (cancellation, cancellation_self_billed, correction, price_reduction, self_billed) => [locale => title]; a missing locale falls back to "en"

Methods#

MethodDescription
->__construct()
->cancellationStrategyFor()The cancellation strategy for the original: the one of the resolver, otherwise $cancellationStrategy.
->cancellationTitle()Title of a cancellation; self-billed originals use "cancellation_self_billed" if the country defines it, otherwise "cancellation".
->title()The title in the locale, else in its language ("de" for "de_CH"), else in English.

__construct()#

public function __construct(
    string $cancellationStrategy = self::CANCELLATION_CREDIT_NOTE,
    string $correctionStrategy = self::CORRECTION_CANCEL_AND_REISSUE,
    array<string, array<string, string>> $titles = [],
    (Closure(InvoiceData): ?string)|null $strategyResolver = null,
)
ParameterTypeDescription
$cancellationStrategystring = self::CANCELLATION_CREDIT_NOTE
$correctionStrategystring = self::CORRECTION_CANCEL_AND_REISSUE
$titlesarray<string, array<string, string>> = []document kind (cancellation, cancellation_self_billed, correction, price_reduction, self_billed) => [locale => title]; a missing locale falls back to "en"
$strategyResolver(Closure(InvoiceData): ?string)|null = nullthe cancellation strategy for a particular original, e.g. by the format it is sent in; null or a null result = $cancellationStrategy

cancellationStrategyFor()#

public function cancellationStrategyFor(InvoiceData $original): string

The cancellation strategy for the original: the one of the resolver, otherwise $cancellationStrategy.

ParameterTypeDescription
$originalInvoiceData
Returns
string

cancellationTitle()#

public function cancellationTitle(bool $selfBilled, string $locale = 'en'): ?string

Title of a cancellation; self-billed originals use "cancellation_self_billed" if the country defines it, otherwise "cancellation".

ParameterTypeDescription
$selfBilledbool
$localestring = 'en'
Returns
?string

title()#

public function title(string $kind, string $locale = 'en'): ?string

The title in the locale, else in its language ("de" for "de_CH"), else in English.

ParameterTypeDescription
$kindstring
$localestring = 'en'
Returns
?string

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.