You are here

class TransactionDataEvent in Commerce Stripe 8

Defines the transaction data event.

This enables other modules to add transaction data and metadata to the transaction that will be sent to Stripe.

Hierarchy

  • class \Drupal\commerce_stripe\Event\TransactionDataEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of TransactionDataEvent

See also

\Drupal\commerce_stripe\Event\StripeEvents

2 files declare their use of TransactionDataEvent
Stripe.php in src/Plugin/Commerce/PaymentGateway/Stripe.php
TransactionDataSubscriber.php in tests/modules/commerce_stripe_test/src/EventSubscriber/TransactionDataSubscriber.php

File

src/Event/TransactionDataEvent.php, line 16

Namespace

Drupal\commerce_stripe\Event
View source
class TransactionDataEvent extends Event {

  /**
   * The payment.
   *
   * @var \Drupal\commerce_payment\Entity\PaymentInterface
   */
  protected $payment;

  /**
   * The transaction data.
   *
   * @var array
   */
  protected $transactionData = [];

  /**
   * The transaction metadata.
   *
   * @var array
   */
  protected $metadata = [];

  /**
   * Constructs a new TransactionDataEvent object.
   *
   * @param \Drupal\commerce_payment\Entity\PaymentInterface $payment
   *   The payment.
   */
  public function __construct(PaymentInterface $payment) {
    $this->payment = $payment;
  }

  /**
   * Get the transaction data.
   *
   * @return array
   *   The transaction data.
   *
   * @deprecated Transaction data is no longer influenced by this event.
   */
  public function getTransactionData() {
    return $this->transactionData;
  }

  /**
   * Sets the transaction data data array.
   *
   * @param array $transaction_data
   *   The transaction data.
   *
   * @return $this
   *
   * @deprecated Transaction data is no longer influenced by this event.
   */
  public function setTransactionData(array $transaction_data) {
    $this->transactionData = $transaction_data;
    return $this;
  }

  /**
   * Get the transaction metadata.
   *
   * @return array
   *   The metadata.
   */
  public function getMetadata() {
    return $this->metadata;
  }

  /**
   * Sets the metadata array.
   *
   * @param array $metadata
   *   The metadata.
   *
   * @return $this
   */
  public function setMetadata(array $metadata) {
    $this->metadata = $metadata;
    return $this;
  }

  /**
   * Get the payment.
   *
   * @return \Drupal\commerce_payment\Entity\PaymentInterface
   *   The payment.
   */
  public function getPayment() {
    return $this->payment;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TransactionDataEvent::$metadata protected property The transaction metadata.
TransactionDataEvent::$payment protected property The payment.
TransactionDataEvent::$transactionData protected property The transaction data.
TransactionDataEvent::getMetadata public function Get the transaction metadata.
TransactionDataEvent::getPayment public function Get the payment.
TransactionDataEvent::getTransactionData Deprecated public function Get the transaction data.
TransactionDataEvent::setMetadata public function Sets the metadata array.
TransactionDataEvent::setTransactionData Deprecated public function Sets the transaction data data array.
TransactionDataEvent::__construct public function Constructs a new TransactionDataEvent object.