You are here

function Payment::totalAmount in Payment 7

Get the total payment amount.

Parameters

boolean $tax: Whether to include taxes or not.

PaymentLineItem[]|null $line_items: An array with PaymentLineItem objects to calculate the total from. Leave empty to use $this->line_items.

Return value

float

File

./payment.classes.inc, line 238
The API and related functions for executing and managing payments.

Class

Payment
A single payment. Contains all payment-specific data.

Code

function totalAmount($tax, array $line_items = NULl) {
  $total = 0;
  if (is_null($line_items)) {
    $line_items = $this->line_items;
  }
  foreach ($line_items as $line_item) {
    $total += $line_item
      ->totalAmount($tax);
  }
  return $total;
}