API reference / Quittio \ Core \ Dunning
DefaultInterest
final readonly class in quittio/core
Quittio\Core\Dunning\DefaultInterest · Source
Default interest of a late payment law: the reference rate plus the points of the DunningLaw (business or consumer debtors), split at every change of the reference rate, with the day count basis of the law; a fixed rate of the law for businesses or consumers instead, if it has one. The result goes into DocumentBuilder::interestCharge().
Methods#
| Method | Description |
|---|---|
->__construct() | |
->calculate() | Interest charges for an open amount from the first day of default until $until (exclusive). |
->flatRate() | Flat rate for business debtors (e.g. 40 EUR, EU late payment directive), once per claim. |
::forCountry() | Default interest with the reference rates and the dunning law of a country pack. |
__construct()#
public function __construct(
ReferenceRates|null $rates,
DunningLaw $law,
(Closure(BigDecimal $rate, BigDecimal $referenceRate, string $points, Date $from, Date $lastDay, string $locale): ?string)|null $describe = null,
)| Parameter | Type | Description |
|---|---|---|
$rates | ReferenceRates|null | null for a law with fixed rates only (DunningLaw::hasFixedRates()) |
$law | DunningLaw | |
$describe | (Closure(Brick\Math\BigDecimal $rate, Brick\Math\BigDecimal $referenceRate, string $points, Date $from, Date $lastDay, string $locale): ?string)|null = null | text of a charge, e.g. "Verzugszinsen 9 Prozentpunkte über dem Basiszinssatz …"; null = no text |
calculate()#
public function calculate(
Money $amount,
Date $from,
Date $until,
bool $consumer = false,
string $locale = 'en',
): list<InterestCharge>Interest charges for an open amount from the first day of default until $until (exclusive).
| Parameter | Type | Description |
|---|---|---|
$amount | Brick\Money\Money | |
$from | Date | |
$until | Date | |
$consumer | bool = false | |
$locale | string = 'en' |
- Returns
list<InterestCharge>- Throws
ConfigurationException– without reference rates for a debtor whose rate is not fixed
flatRate()#
public function flatRate(string $currency = 'EUR'): ?MoneyFlat rate for business debtors (e.g. 40 EUR, EU late payment directive), once per claim.
| Parameter | Type | Description |
|---|---|---|
$currency | string = 'EUR' |
- Returns
?Brick\Money\Money
forCountry()#
public static function forCountry(CountryPack $pack): selfDefault interest with the reference rates and the dunning law of a country pack.
| Parameter | Type | Description |
|---|---|---|
$pack | CountryPack |
- Returns
self- Throws
ConfigurationException– for a pack without reference rates whose law has no fixed rates