USAGE:
First, instantiate class with the original price:
$taksit = new Taksit($price);
It is possible to change original price later by calling setOriginalPrice() function.
$taksit->setOriginalPrice($new_price);
To define a new payment type, use addRate() function:
$taksit->addRate(array(
'name' => "payment type (string, required)",
'percent' => "commission rate' percentage (float, optional, default = 0)",
'fixed' => "commission rate' fixed price (float, optional, default = 0)",
'min' => "payment processor's min. commission fee (float, optional, default = 0)",
'installment' => "number of istallment (int, optional, default = 1)",
"make_discount" => "whether or not make a discount (bool, optional, default = false)"
));
Call getPriceArray() function to get every calculated price as array.
Returned array format:
array('name' => "payment type" => (array) $options, ...)
$options array format:
array(
array('price' => "calculated price",
'installment' => "number of installment",
'discount_percent' => "percentage of discount",
'discount_fixed' => "fixed discount value")
), ...)
To get only the price of specific payment type, use getPrice() function:
$taksit->getPrice('payment type (string, required)',
'number of installment (int, optional, default = 1)'); |