18 class Detail extends \Magento\Backend\Block\Widget\Container
54 \
Magento\Sales\Helper\Admin $adminHelper,
59 $this->adminHelper = $adminHelper;
61 parent::__construct($context,
$data);
73 $this->_txn = $this->_coreRegistry->registry(
'current_transaction');
78 $backUrl = $this->_txn->getOrderUrl() ? $this->_txn->getOrderUrl() : $this->
getUrl(
'sales/*/');
79 $this->buttonList->add(
81 [
'label' =>
__(
'Back'),
'onclick' =>
"setLocation('{$backUrl}')",
'class' =>
'back']
84 $fetchTransactionAllowed = $this->_authorization->isAllowed(
'Magento_Sales::transactions_fetch');
85 $canFetchTransaction = $this->orderPaymentRepository->get($this->_txn->getPaymentId())
87 ->canFetchTransactionInfo();
89 if ($fetchTransactionAllowed && $canFetchTransaction) {
90 $fetchUrl = $this->
getUrl(
'sales/*/fetch', [
'_current' =>
true]);
91 $this->buttonList->add(
93 [
'label' =>
__(
'Fetch'),
'onclick' =>
"setLocation('{$fetchUrl}')",
'class' =>
'button']
106 "Transaction # %1 | %2",
107 $this->_txn->getTxnId(),
109 $this->_txn->getCreatedAt(),
110 \IntlDateFormatter::MEDIUM,
123 $this->setTxnIdHtml($this->adminHelper->escapeHtmlWithLinks(
124 $this->_txn->getHtmlTxnId(),
128 $this->setParentTxnIdUrlHtml(
129 $this->
escapeHtml($this->
getUrl(
'sales/transactions/view', [
'txn_id' => $this->_txn->getParentId()]))
132 $this->setParentTxnIdHtml($this->
escapeHtml($this->_txn->getParentTxnId()));
134 $this->setOrderIncrementIdHtml($this->
escapeHtml($this->_txn->getOrder()->getIncrementId()));
136 $this->setTxnTypeHtml($this->
escapeHtml(
__($this->_txn->getTxnType())));
138 $this->setOrderIdUrlHtml(
139 $this->
escapeHtml($this->
getUrl(
'sales/order/view', [
'order_id' => $this->_txn->getOrderId()]))
142 $this->setIsClosedHtml($this->_txn->getIsClosed() ?
__(
'Yes') :
__(
'No'));
144 $createdAt = strtotime(
145 $this->_txn->getCreatedAt()
147 $this->_txn->getCreatedAt(),
148 \IntlDateFormatter::MEDIUM,
153 $this->setCreatedAtHtml($this->
escapeHtml($createdAt));
155 return parent::_toHtml();
formatDate( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, \Magento\Sales\Helper\Admin $adminHelper, OrderPaymentRepositoryInterface $orderPaymentRepository, array $data=[])
escapeHtml($data, $allowedTags=null)
getUrl($route='', $params=[])