Пример #1
0
 /**
  * @param Payment $object
  * @param array $data
  * @return OrderPaymentInterface
  */
 public function convert(Payment $object, $data = [])
 {
     $paymentData = $this->objectCopyService->getDataFromFieldset('quote_convert_payment', 'to_order_payment', $object);
     $orderPayment = $this->orderPaymentRepository->create();
     $this->dataObjectHelper->populateWithArray($orderPayment, array_merge($paymentData, $data), '\\Magento\\Sales\\Api\\Data\\OrderPaymentInterface');
     $orderPayment->setAdditionalInformation(array_merge($object->getAdditionalInformation(), [Substitution::INFO_KEY_TITLE => $object->getMethodInstance()->getTitle()]));
     // set directly on the model
     $orderPayment->setCcNumber($object->getCcNumber());
     $orderPayment->setCcCid($object->getCcCid());
     return $orderPayment;
 }
Пример #2
0
 /**
  * Add control buttons
  *
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->_txn = $this->_coreRegistry->registry('current_transaction');
     if (!$this->_txn) {
         return;
     }
     $backUrl = $this->_txn->getOrderUrl() ? $this->_txn->getOrderUrl() : $this->getUrl('sales/*/');
     $this->buttonList->add('back', ['label' => __('Back'), 'onclick' => "setLocation('{$backUrl}')", 'class' => 'back']);
     $fetchTransactionAllowed = $this->_authorization->isAllowed('Magento_Sales::transactions_fetch');
     $canFetchTransaction = $this->orderPaymentRepository->get($this->_txn->getPaymentId())->getMethodInstance()->canFetchTransactionInfo();
     if ($fetchTransactionAllowed && $canFetchTransaction) {
         $fetchUrl = $this->getUrl('sales/*/fetch', ['_current' => true]);
         $this->buttonList->add('fetch', ['label' => __('Fetch'), 'onclick' => "setLocation('{$fetchUrl}')", 'class' => 'button']);
     }
 }
Пример #3
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']);
         }
     }
 }
Пример #4
0
 /**
  * Order ID getter
  * Attempts to get ID from set order payment object, if any, or from data by key 'order_id'
  *
  * @return int|null
  */
 public function getOrderId()
 {
     $orderId = $this->_getData('order_id');
     if ($orderId) {
         return $orderId;
     }
     if ($this->getPaymentId()) {
         $payment = $this->orderPaymentRepository->get($this->getPaymentId());
         if ($payment) {
             $orderId = $payment->getParentId();
         }
     }
     return $orderId;
 }