You are here

interface EventDispatcherInterface in Payment 8.2

Defines a Payment event dispatcher.

Because new events may be added in minor releases, this interface and all classes that implemented are considered unstable forever. If you write an event dispatcher, you must be prepared to update it in minor releases.

Hierarchy

Expanded class hierarchy of EventDispatcherInterface

All classes that implement EventDispatcherInterface

13 files declare their use of EventDispatcherInterface
Basic.php in src/Plugin/Payment/Method/Basic.php
DatabaseQueueTest.php in tests/src/Unit/DatabaseQueueTest.php
EventDispatcherCollectionTest.php in tests/src/Unit/EventDispatcherCollectionTest.php
PaymentForm.php in modules/payment_form/src/Plugin/Payment/Type/PaymentForm.php
PaymentFormTest.php in modules/payment_form/tests/src/Unit/Plugin/Payment/Type/PaymentFormTest.php

... See full list

File

src/EventDispatcherInterface.php, line 17

Namespace

Drupal\payment
View source
interface EventDispatcherInterface {

  /**
   * Alters the payment IDs loaded by a payment queue.
   *
   * @param string $queue_id
   *   The ID of the queue to alter IDs for.
   * @param string $category_id
   *   The category of the IDs to alter.
   * @param int $owner_id
   *   The ID of the user for whom the IDs are retrieved.
   * @param int[] $payment_ids
   *   The IDs to alter.
   *
   * @return int[]
   *   The altered IDs.
   */
  public function alterQueueLoadedPaymentIds($queue_id, $category_id, $owner_id, array $payment_ids);

  /**
   * Responds to a new payment status being set.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *   The payment on which the new status has been set.
   * @param \Drupal\payment\Plugin\Payment\Status\PaymentStatusInterface|null $previous_payment_status
   *   The payment's previous status or NULL if there is none.
   */
  public function setPaymentStatus(PaymentInterface $payment, PaymentStatusInterface $previous_payment_status = NULL);

  /**
   * Fires right before a payment will be executed.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *   The payment that will be executed.
   */
  public function preExecutePayment(PaymentInterface $payment);

  /**
   * Checks access for before executing a payment.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *   The payment that will be executed.
   * @param \Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface $payment_method
   *   The payment method that will execute the payment.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The account for which to check access.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   */
  public function executePaymentAccess(PaymentInterface $payment, PaymentMethodInterface $payment_method, AccountInterface $account);

  /**
   * Fires right before a payment will be captured.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *   The payment that will be captured.
   */
  public function preCapturePayment(PaymentInterface $payment);

  /**
   * Fires right before a payment will be refunded.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *   The payment that will be refunded.
   */
  public function preRefundPayment(PaymentInterface $payment);

  /**
   * Fires right before a payment type's context is resumed.
   *
   * @param \Drupal\payment\Entity\PaymentInterface $payment
   *   The payment of which the type's context will be resumed.
   */
  public function preResumeContext(PaymentInterface $payment);

}

Members

Namesort descending Modifiers Type Description Overrides
EventDispatcherInterface::alterQueueLoadedPaymentIds public function Alters the payment IDs loaded by a payment queue. 2
EventDispatcherInterface::executePaymentAccess public function Checks access for before executing a payment. 2
EventDispatcherInterface::preCapturePayment public function Fires right before a payment will be captured. 2
EventDispatcherInterface::preExecutePayment public function Fires right before a payment will be executed. 2
EventDispatcherInterface::preRefundPayment public function Fires right before a payment will be refunded. 2
EventDispatcherInterface::preResumeContext public function Fires right before a payment type's context is resumed. 2
EventDispatcherInterface::setPaymentStatus public function Responds to a new payment status being set. 2