Ejemplo n.º 1
0
 /**
  * Void payment
  *
  * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface|Payment $payment
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function void(\Magento\Payment\Model\InfoInterface $payment)
 {
     //Switching to order transaction if needed
     if ($payment->getAdditionalInformation($this->_isOrderPaymentActionKey) && !$payment->getVoidOnlyAuthorization()) {
         $orderTransaction = $payment->lookupTransaction(false, Transaction::TYPE_ORDER);
         if ($orderTransaction) {
             $payment->setParentTransactionId($orderTransaction->getTxnId());
             $payment->setTransactionId($orderTransaction->getTxnId() . '-void');
         }
     }
     $this->_pro->void($payment);
     return $this;
 }