Class Calc
Calc provides methods to calculate part payment functions.
All rates are yearly rates, but they are calculated monthly. So a rate of 9 % is used 0.75% monthly. The first is the one we specify to the customers, and the second one is the one added each month to the account. The IRR uses the same notation.
The APR is however calculated by taking the monthly rate and raising it to the 12 power. This is according to the EU law, and will give very large numbers if the $pval is small compared to the $fee and the amount of months you repay is small as well.
All functions work in discrete mode, and the time interval is the mythical evenly divided month. There is no way to calculate APR in days without using integrals and other hairy math. So don't try. The amount of days between actual purchase and the first bill can of course vary between 28 and 61 days, but all calculations in this class assume this time is exactly and that is ok since this will only overestimate the APR and all examples in EU law uses whole months as well.
Methods summary
public static
float
|
|
public static
float
|
#
totalCreditPurchaseCost( float $sum, Klarna\XMLRPC\PClass $pclass, integer $flags )
Calculates the total credit purchase cost. |
public static
float
|
#
calcMonthlyCost( integer $sum, Klarna\XMLRPC\PClass $pclass, integer $flags )
Calculates the monthly cost for the specified pclass.
The result is rounded up to the correct value depending on the
pclass country. |
public static
integer|float
|
#
getLowestPaymentForAccount( integer $country )
Returns the lowest monthly payment for Klarna Account. |
public static
float|integer
|
Magic methods summary
Properties summary
protected static
float
|
$accuracy
This constant tells the irr function when to stop. If the calculation error is lower than this the calculation is done. |
#
0.01
|