You are here

public function Payment::getAmount in Commerce Core 8.2

Gets the payment amount.

Return value

\Drupal\commerce_price\Price|null The payment amount, or NULL.

Overrides PaymentInterface::getAmount

1 call to Payment::getAmount()
Payment::getBalance in modules/payment/src/Entity/Payment.php
Gets the payment balance.

File

modules/payment/src/Entity/Payment.php, line 211

Class

Payment
Defines the payment entity class.

Namespace

Drupal\commerce_payment\Entity

Code

public function getAmount() {
  if (!$this
    ->get('amount')
    ->isEmpty()) {
    return $this
      ->get('amount')
      ->first()
      ->toPrice();
  }
}