Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Transactions.php
Go to the documentation of this file.
1 <?php
7 
13 
20 {
26  const ADMIN_RESOURCE = 'Magento_Sales::transactions';
27 
33  protected $_coreRegistry = null;
34 
38  protected $resultPageFactory;
39 
44 
49 
57  public function __construct(
58  \Magento\Backend\App\Action\Context $context,
59  Registry $coreRegistry,
63  ) {
64  $this->_coreRegistry = $coreRegistry;
65  $this->resultPageFactory = $resultPageFactory;
66  $this->resultLayoutFactory = $resultLayoutFactory;
67  $this->orderPaymentRepository = $orderPaymentRepository;
68  parent::__construct($context);
69  }
70 
76  protected function _initTransaction()
77  {
78  $txn = $this->_objectManager->create(
79  \Magento\Sales\Model\Order\Payment\Transaction::class
80  )->load(
81  $this->getRequest()->getParam('txn_id')
82  );
83 
84  if (!$txn->getId()) {
85  $this->messageManager->addErrorMessage(__('Please correct the transaction ID and try again.'));
86  $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
87  return false;
88  }
89  $orderId = $this->getRequest()->getParam('order_id');
90  if ($orderId) {
91  $txn->setOrderUrl($this->getUrl('sales/order/view', ['order_id' => $orderId]));
92  }
93 
94  $this->_coreRegistry->register('current_transaction', $txn);
95  return $txn;
96  }
97 }
__()
Definition: __.php:13
__construct(\Magento\Backend\App\Action\Context $context, Registry $coreRegistry, PageFactory $resultPageFactory, LayoutFactory $resultLayoutFactory, OrderPaymentRepositoryInterface $orderPaymentRepository)