class PaymentLineItem in Payment 7
A payment line item.
Hierarchy
- class \PaymentCommon
- class \PaymentLineItem
Expanded class hierarchy of PaymentLineItem
See also
File
- ./
payment.classes.inc, line 1080 - The API and related functions for executing and managing payments.
View source
class PaymentLineItem extends PaymentCommon {
/**
* The payment amount, excluding tax. The number of decimals depends on the
* ISO 4217 currency used.
*
* @var float
*/
public $amount = 0.0;
/**
* A US English human-readable description for this line item. May contain
* HTML.
*
* @var string
*/
public $description = '';
/**
* Arguments to pass on to t() when translating $this->description.
*
* @var string[]
*/
public $description_arguments = array();
/**
* The unique machine name (for a certain payment).
*
* @var string
*/
public $name = '';
/**
* The tax rate that applies to PaymentLineItem::amount. Should be a float
* between 0 and 1.
*
* @var float
*/
public $tax_rate = 0.0;
/**
* Quantity.
*
* @var float
*/
public $quantity = 1.0;
/**
* Return this line item's unit amount.
*
* @param boolean $tax
* Whether to include taxes or not.
*
* @return float
*/
function unitAmount($tax) {
return $this->amount * ($tax ? $this->tax_rate + 1 : 1);
}
/**
* Return this line item's total amount.
*
* @param boolean $tax
* Whether to include taxes or not.
*
* @return float
*/
function totalAmount($tax) {
return $this->amount * $this->quantity * ($tax ? $this->tax_rate + 1 : 1);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PaymentCommon:: |
function | 2 | ||
PaymentLineItem:: |
public | property | The payment amount, excluding tax. The number of decimals depends on the ISO 4217 currency used. | |
PaymentLineItem:: |
public | property | A US English human-readable description for this line item. May contain HTML. | |
PaymentLineItem:: |
public | property | Arguments to pass on to t() when translating $this->description. | |
PaymentLineItem:: |
public | property | The unique machine name (for a certain payment). | |
PaymentLineItem:: |
public | property | Quantity. | |
PaymentLineItem:: |
public | property | The tax rate that applies to PaymentLineItem::amount. Should be a float between 0 and 1. | |
PaymentLineItem:: |
function | Return this line item's total amount. | ||
PaymentLineItem:: |
function | Return this line item's unit amount. |