示例#1
0
 /**
  * {@inheritdoc}
  */
 public function getAuthorizationTransaction($parentTransactionId, $paymentId, $orderId)
 {
     $transaction = false;
     if ($parentTransactionId) {
         $transaction = $this->transactionRepository->getByTransactionId($parentTransactionId, $paymentId, $orderId);
     }
     return $transaction ?: $this->transactionRepository->getByTransactionType(Transaction::TYPE_AUTH, $paymentId, $orderId);
 }
示例#2
0
 /**
  * Check order payment capture action availability
  *
  * @return bool
  */
 public function canCapture()
 {
     if (!$this->getMethodInstance()->canCapture()) {
         return false;
     }
     // Check Authorization transaction state
     $authTransaction = $this->getAuthorizationTransaction();
     if ($authTransaction && $authTransaction->getIsClosed()) {
         $orderTransaction = $this->transactionRepository->getByTransactionType(Transaction::TYPE_ORDER, $this->getId(), $this->getOrder()->getId());
         if (!$orderTransaction) {
             return false;
         }
     }
     return true;
 }
示例#3
0
 /**
  * Get transaction with type order
  *
  * @param OrderPaymentInterface $payment
  *
  * @return false|\Magento\Sales\Api\Data\TransactionInterface
  */
 protected function getOrderTransaction($payment)
 {
     return $this->transactionRepository->getByTransactionType(Transaction::TYPE_ORDER, $payment->getId(), $payment->getOrder()->getId());
 }