You are here

public function Payment::getPaymentStatus in Payment 8.2

Gets the current payment status.

Return value

\Drupal\payment\Plugin\Payment\Status\PaymentStatusInterface

Overrides PaymentInterface::getPaymentStatus

1 call to Payment::getPaymentStatus()
Payment::setPaymentStatus in src/Entity/Payment.php
Sets a status.

File

src/Entity/Payment.php, line 270

Class

Payment
Defines a payment entity.

Namespace

Drupal\payment\Entity

Code

public function getPaymentStatus() {
  $deltas = [];

  /** @var \Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemInterface $field_item */
  foreach ($this
    ->get('payment_statuses') as $delta => $field_item) {
    $deltas[] = $delta;
  }
  if ($deltas) {
    return $this
      ->get('payment_statuses')[max($deltas)]
      ->getContainedPluginInstance();
  }
}