PHP Classes

File: usage.txt

Recommend this page to a friend!
  Classes of Ovunc Tukenmez   Taksit   usage.txt   Download  
File: usage.txt
Role: Documentation
Content type: text/plain
Description: documentation
Class: Taksit
Calculate prices for different payment processors
Author: By
Last change:
Date: 10 years ago
Size: 1,434 bytes
 

Contents

Class file image Download
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)');