/** * Check if capture transaction already exists * * @param OrderPaymentInterface $payment * @return bool */ private function isExistsCaptureTransaction(OrderPaymentInterface $payment) { $filters[] = $this->filterBuilder->setField('payment_id')->setValue($payment->getId())->create(); $filters[] = $this->filterBuilder->setField('txn_type')->setValue(TransactionInterface::TYPE_CAPTURE)->create(); $searchCriteria = $this->searchCriteriaBuilder->addFilters($filters)->create(); $count = $this->transactionRepository->getList($searchCriteria)->getTotalCount(); return (bool) $count; }