Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
HtmlTransactionIdObserver.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  private $paypalData;
20 
24  public function __construct(
25  \Magento\Paypal\Helper\Data $paypalData
26  ) {
27  $this->paypalData = $paypalData;
28  }
29 
36  public function execute(EventObserver $observer)
37  {
39  $transaction = $observer->getDataObject();
40  $order = $transaction->getOrder();
41  $payment = $order->getPayment();
42  $methodInstance = $payment->getMethodInstance();
43  $paymentCode = $methodInstance->getCode();
44  $transactionLink = $this->paypalData->getHtmlTransactionId($paymentCode, $transaction->getTxnId());
45  $transaction->setData('html_txn_id', $transactionLink);
46  }
47 }
$transaction
$order
Definition: order.php:55
__construct(\Magento\Paypal\Helper\Data $paypalData)
$payment
Definition: order.php:17