예제 #1
0
 /**
  * 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();
 }
예제 #2
0
 public function beforeGetLayout(\Magento\Sales\Block\Adminhtml\Transactions\Detail $subject)
 {
     $this->_txn = $this->_coreRegistry->registry('current_transaction');
     if (!$this->_txn) {
         return;
     }
     if ($this->_txn->getTxnType() != Transaction::TYPE_REFUND) {
         return;
     }
     /** @var \Magento\Sales\Model\Order\Payment\Interceptor $payment */
     $payment = $this->orderPaymentRepository->get($this->_txn->getPaymentId());
     $methodInstance = $payment->getMethodInstance();
     if ($methodInstance instanceof \Wirecard\CheckoutPage\Model\AbstractPayment) {
         $addInfo = $this->_txn->getAdditionalInformation('raw_details_info');
         if (isset($addInfo['orderNumber']) && isset($addInfo['creditNumber'])) {
             $fetchUrl = $this->_urlBuilder->getUrl('wirecardcheckoutpage/transactions/refundreversal', ['_current' => true]);
             $subject->addButton('refundreversal', ['label' => __('Refund Reversal'), 'onclick' => "setLocation('{$fetchUrl}')", 'class' => 'button']);
         }
     }
 }
예제 #3
0
파일: Detail.php 프로젝트: aiesh/magento2
 /**
  * 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();
 }
예제 #4
0
 /**
  * Update transactions in database using provided transaction as parent for them
  * have to repeat the business logic to avoid accidental injection of wrong transactions
  *
  * @param \Magento\Sales\Model\Order\Payment\Transaction $transaction
  * @return void
  */
 public function injectAsParent(\Magento\Sales\Model\Order\Payment\Transaction $transaction)
 {
     $txnId = $transaction->getTxnId();
     if ($txnId && \Magento\Sales\Model\Order\Payment\Transaction::TYPE_PAYMENT === $transaction->getTxnType() && ($id = $transaction->getId())) {
         $connection = $this->getConnection();
         // verify such transaction exists, determine payment and order id
         $verificationRow = $connection->fetchRow($connection->select()->from($this->getMainTable(), ['payment_id', 'order_id'])->where("{$this->getIdFieldName()} = ?", (int) $id));
         if (!$verificationRow) {
             return;
         }
         list($paymentId, $orderId) = array_values($verificationRow);
         // inject
         $where = [$connection->quoteIdentifier($this->getIdFieldName()) . '!=?' => $id, new \Zend_Db_Expr('parent_id IS NULL'), 'payment_id = ?' => (int) $paymentId, 'order_id = ?' => (int) $orderId, 'parent_txn_id = ?' => $txnId];
         $connection->update($this->getMainTable(), ['parent_id' => $id], $where);
     }
 }
예제 #5
0
 /**
  * @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;
 }
예제 #6
0
 /**
  * @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();
 }