/** * Render block html * * @return string */ protected function _toHtml() { $this->setTxnIdHtml($this->escapeHtml($this->_txn->getTxnId())); $this->setParentTxnIdUrlHtml($this->escapeHtml($this->getUrl('sales/transactions/view', ['txn_id' => $this->_txn->getParentId()]))); $this->setParentTxnIdHtml($this->escapeHtml($this->_txn->getParentTxnId())); $this->setOrderIncrementIdHtml($this->escapeHtml($this->_txn->getOrder()->getIncrementId())); $this->setTxnTypeHtml($this->escapeHtml($this->_txn->getTxnType())); $this->setOrderIdUrlHtml($this->escapeHtml($this->getUrl('sales/order/view', ['order_id' => $this->_txn->getOrderId()]))); $this->setIsClosedHtml($this->_txn->getIsClosed() ? __('Yes') : __('No')); $createdAt = strtotime($this->_txn->getCreatedAt()) ? $this->formatDate($this->_txn->getCreatedAt(), \IntlDateFormatter::MEDIUM, true) : __('N/A'); $this->setCreatedAtHtml($this->escapeHtml($createdAt)); return parent::_toHtml(); }
/** * Render block html * * @return string */ protected function _toHtml() { $this->setTxnIdHtml($this->escapeHtml($this->_txn->getTxnId())); $this->setParentTxnIdUrlHtml($this->escapeHtml($this->getUrl('sales/transactions/view', array('txn_id' => $this->_txn->getParentId())))); $this->setParentTxnIdHtml($this->escapeHtml($this->_txn->getParentTxnId())); $this->setOrderIncrementIdHtml($this->escapeHtml($this->_txn->getOrder()->getIncrementId())); $this->setTxnTypeHtml($this->escapeHtml($this->_txn->getTxnType())); $this->setOrderIdUrlHtml($this->escapeHtml($this->getUrl('sales/order/view', array('order_id' => $this->_txn->getOrderId())))); $this->setIsClosedHtml($this->_txn->getIsClosed() ? __('Yes') : __('No')); $createdAt = strtotime($this->_txn->getCreatedAt()) ? $this->formatDate($this->_txn->getCreatedAt(), \Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM, true) : __('N/A'); $this->setCreatedAtHtml($this->escapeHtml($createdAt)); return parent::_toHtml(); }
/** * @param Transaction $transaction * @return array */ private function getPreparedTransactionData(Transaction $transaction) { $additionalInfo = []; foreach ($transaction->getAdditionalInformation() as $value) { $additionalInfo[] = $value; } $expectedData = ['transaction_id' => (int) $transaction->getId()]; if ($transaction->getParentId() !== null) { $expectedData['parent_id'] = (int) $transaction->getParentId(); } $expectedData = array_merge($expectedData, ['order_id' => (int) $transaction->getOrderId(), 'payment_id' => (int) $transaction->getPaymentId(), 'txn_id' => $transaction->getTxnId(), 'parent_txn_id' => $transaction->getParentTxnId() ? (string) $transaction->getParentTxnId() : '', 'txn_type' => $transaction->getTxnType(), 'is_closed' => (int) $transaction->getIsClosed(), 'additional_information' => ['data'], 'created_at' => $transaction->getCreatedAt(), 'child_transactions' => []]); return $expectedData; }
/** * @param TrasactionModel $transactionModel * @param bool $lazy * @return Transaction */ public function extractDto(TrasactionModel $transactionModel, $lazy = false) { /** @var TransactionBuilder $transactionBuilder */ $transactionBuilder = $this->transactionBuilderFactory->create(); $transactionBuilder->setTransactionId($transactionModel->getTransactionId()); $transactionBuilder->setParentId($transactionModel->getParentId()); $transactionBuilder->setOrderId($transactionModel->getOrderId()); $transactionBuilder->setTxnId($transactionModel->getTxnId()); $transactionBuilder->setPaymentId($transactionModel->getPaymentId()); $transactionBuilder->setParentTxnId($transactionModel->getParentTxnId()); $transactionBuilder->setTxnType($transactionModel->getTxnType()); $transactionBuilder->setIsClosed($transactionModel->getIsClosed()); $transactionBuilder->setAdditionalInformation($this->getAdditionalInfo($transactionModel)); $transactionBuilder->setCreatedAt($transactionModel->getCreatedAt()); $transactionBuilder->setMethod($transactionModel->getMethod()); $transactionBuilder->setIncrementId($this->getIncrementId($transactionModel)); $transactionBuilder->setChildTransactions($lazy ? [] : $this->getChildTransactions($transactionModel)); return $transactionBuilder->create(); }