You are here

class SymfonyEventDispatcher in Payment 8.2

Dispatches Payment events through Symfony's event dispatcher.

Hierarchy

Expanded class hierarchy of SymfonyEventDispatcher

2 files declare their use of SymfonyEventDispatcher
EventDispatcherCollectionTest.php in tests/src/Unit/EventDispatcherCollectionTest.php
SymfonyEventDispatcherTest.php in tests/src/Unit/SymfonyEventDispatcherTest.php
1 string reference to 'SymfonyEventDispatcher'
payment.services.yml in ./payment.services.yml
payment.services.yml
1 service uses SymfonyEventDispatcher
payment.event_dispatcher.symfony in ./payment.services.yml
Drupal\payment\SymfonyEventDispatcher

File

src/SymfonyEventDispatcher.php, line 22

Namespace

Drupal\payment
View source
class SymfonyEventDispatcher implements EventDispatcherInterface {

  /**
   * The Symfony event dispatcher.
   *
   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
   */
  protected $symfonyEventDispatcher;

  /**
   * Constructs a new instance.
   *
   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $symfony_event_dispatcher
   */
  public function __construct(SymfonyEventDispatcherInterface $symfony_event_dispatcher) {
    $this->symfonyEventDispatcher = $symfony_event_dispatcher;
  }

  /**
   * {@inheritdoc}
   */
  public function alterQueueLoadedPaymentIds($queue_id, $category_id, $owner_id, array $payment_ids) {
    $event = new PaymentQueuePaymentIdsAlter($queue_id, $category_id, $owner_id, $payment_ids);
    $this->symfonyEventDispatcher
      ->dispatch(PaymentEvents::PAYMENT_QUEUE_PAYMENT_IDS_ALTER, $event);
    $payment_ids = $event
      ->getPaymentIds();
    return $payment_ids;
  }

  /**
   * {@inheritdoc}
   */
  public function setPaymentStatus(PaymentInterface $payment, PaymentStatusInterface $previous_payment_status = NULL) {
    $event = new PaymentStatusSet($payment, $previous_payment_status);
    $this->symfonyEventDispatcher
      ->dispatch(PaymentEvents::PAYMENT_STATUS_SET, $event);
  }

  /**
   * {@inheritdoc}
   *
   */
  public function preExecutePayment(PaymentInterface $payment) {
    $event = new PaymentPreExecute($payment);
    $this->symfonyEventDispatcher
      ->dispatch(PaymentEvents::PAYMENT_PRE_EXECUTE, $event);
  }

  /**
   * {@inheritdoc}
   */
  public function executePaymentAccess(PaymentInterface $payment, PaymentMethodInterface $payment_method, AccountInterface $account) {
    $event = new PaymentExecuteAccess($payment, $payment_method, $account);
    $this->symfonyEventDispatcher
      ->dispatch(PaymentEvents::PAYMENT_EXECUTE_ACCESS, $event);
    return $event
      ->getAccessResult();
  }

  /**
   * {@inheritdoc}
   *
   */
  public function preCapturePayment(PaymentInterface $payment) {
    $event = new PaymentPreCapture($payment);
    $this->symfonyEventDispatcher
      ->dispatch(PaymentEvents::PAYMENT_PRE_CAPTURE, $event);
  }

  /**
   * {@inheritdoc}
   *
   */
  public function preRefundPayment(PaymentInterface $payment) {
    $event = new PaymentPreRefund($payment);
    $this->symfonyEventDispatcher
      ->dispatch(PaymentEvents::PAYMENT_PRE_REFUND, $event);
  }

  /**
   * {@inheritdoc}
   */
  public function preResumeContext(PaymentInterface $payment) {
    $event = new PaymentTypePreResumeContext($payment);
    $this->symfonyEventDispatcher
      ->dispatch(PaymentEvents::PAYMENT_TYPE_PRE_RESUME_CONTEXT, $event);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SymfonyEventDispatcher::$symfonyEventDispatcher protected property The Symfony event dispatcher.
SymfonyEventDispatcher::alterQueueLoadedPaymentIds public function Alters the payment IDs loaded by a payment queue. Overrides EventDispatcherInterface::alterQueueLoadedPaymentIds
SymfonyEventDispatcher::executePaymentAccess public function Checks access for before executing a payment. Overrides EventDispatcherInterface::executePaymentAccess
SymfonyEventDispatcher::preCapturePayment public function Fires right before a payment will be captured. Overrides EventDispatcherInterface::preCapturePayment
SymfonyEventDispatcher::preExecutePayment public function Fires right before a payment will be executed. Overrides EventDispatcherInterface::preExecutePayment
SymfonyEventDispatcher::preRefundPayment public function Fires right before a payment will be refunded. Overrides EventDispatcherInterface::preRefundPayment
SymfonyEventDispatcher::preResumeContext public function Fires right before a payment type's context is resumed. Overrides EventDispatcherInterface::preResumeContext
SymfonyEventDispatcher::setPaymentStatus public function Responds to a new payment status being set. Overrides EventDispatcherInterface::setPaymentStatus
SymfonyEventDispatcher::__construct public function Constructs a new instance.