You are here

function Payment::setStatus in Payment 7

Set the payment status.

Parameters

PaymentStatusItem $status_item:

Return value

static

1 call to Payment::setStatus()
Payment::execute in ./payment.classes.inc
Execute the actual payment.

File

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

Class

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

Code

function setStatus(PaymentStatusItem $status_item) {
  $previous_status_item = $this
    ->getStatus();
  $status_item->pid = $this->pid;
  $this->statuses[] = $status_item;
  foreach (module_implements('payment_status_change') as $module_name) {
    call_user_func($module_name . '_payment_status_change', $this, $previous_status_item);

    // If a hook invocation has added another log item, a new loop with
    // invocations has already been executed and we don't need to continue
    // with this one.
    if ($this
      ->getStatus() !== $status_item) {
      return $this;
    }
  }
  if (module_exists('rules')) {
    rules_invoke_event('payment_status_change', $this, $previous_status_item);
  }
  return $this;
}