You are here

class TransactionDataEvent in Commerce Braintree 8

Defines the transaction data event.

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

Hierarchy

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

Expanded class hierarchy of TransactionDataEvent

See also

\Drupal\commerce_braintree\Event\BraintreeEvents

1 file declares its use of TransactionDataEvent
HostedFields.php in src/Plugin/Commerce/PaymentGateway/HostedFields.php

File

src/Event/TransactionDataEvent.php, line 16

Namespace

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

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

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

  /**
   * Constructs a new TransactionDataEvent object.
   *
   * @param array $transactionData
   *   The transaction data to submit to Braintree.
   * @param \Drupal\commerce_payment\Entity\PaymentInterface $payment
   *   The payment.
   */
  public function __construct(array $transactionData, PaymentInterface $payment) {
    $this->payment = $payment;
    $this->transactionData = $transactionData;
  }

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

  /**
   * Sets the transaction data data array.
   *
   * @param array $transaction_data
   *   The transaction data.
   *
   * @return $this
   */
  public function setTransactionData(array $transaction_data) {
    $this->transactionData = $transaction_data;
    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::$payment protected property The payment.
TransactionDataEvent::$transactionData protected property The transaction data.
TransactionDataEvent::getPayment public function Get the payment.
TransactionDataEvent::getTransactionData public function Get the transaction data.
TransactionDataEvent::setTransactionData public function Sets the transaction data data array.
TransactionDataEvent::__construct public function Constructs a new TransactionDataEvent object.