Method returns possible follow up operations for transaction.
If limit is set to false (default), all possible operations will be returned.

@param Transaction $transaction
@param boolean $limit
@return array|bool
500403
public function retrieveBackendOperations($transaction, $limit = false)
    {
        $parentTransaction = $this->getTransactionByTransactionId(
            $transaction->getParentTransactionId(),
            $transaction::NAME != MaestroTransaction::NAME ? $transaction::NAME : CreditCardTransaction::NAME
        );
        if (!is_null($parentTransaction) && (
            !$limit ||
            !$this->isFinal($parentTransaction[Transaction::PARAM_PAYMENT][Transaction::PARAM_TRANSACTION_TYPE])
            )) {
            $transaction->setParentTransactionType(
                $parentTransaction[Transaction::PARAM_PAYMENT][Transaction::PARAM_TRANSACTION_TYPE]
            );
        } else {
            return false;
        }

        $operations = false;
        if ($transaction->getBackendOperationForPay() && (!$limit ||
            $transaction->getParentTransactionType() == Transaction::TYPE_AUTHORIZATION)) {
            $operations[Operation::PAY] = self::CAPTURE_BUTTON_TEXT;
        }
        if ($transaction->getBackendOperationForCancel()) {
            if (stristr($transaction->getBackendOperationForCancel(), 'refund')) {
                $operations[Operation::CANCEL] = self::REFUND_BUTTON_TEXT;
            } else {
                $operations[Operation::CANCEL] = self::CANCEL_BUTTON_TEXT;
            }
        }
        if ($transaction->getBackendOperationForRefund()) {
            $operations[Operation::REFUND] = self::REFUND_BUTTON_TEXT;
        }
        if ($transaction->getBackendOperationForCredit() || $transaction->getSepaCredit()) {
            if ($limit && $transaction->getSepaCredit()) {
                $operations[Operation::CREDIT] = self::REFUND_BUTTON_TEXT;
            } elseif (!$limit) {
                $operations[Operation::CREDIT] = self::CREDIT_BUTTON_TEXT;
            }
        }

        return $operations;
    }
108786
protected function getCommand(Transaction $transaction)
    {
        switch ($transaction->getType()->getValue()) {
            case Transaction\TransactionType::SALE:
                return 'ECheck.ProcessPayment';

            case Transaction\TransactionType::AUTH:
                return 'ECheck.Authorize';

            case Transaction\TransactionType::CAPTURE:
                return 'ECheck.Capture';

            case Transaction\TransactionType::REFUND:
                return 'ECheck.Refund';

            case Transaction\TransactionType::VOID:
                return 'ECheck.Void';

            case Transaction\TransactionType::QUERY:
                return 'ECheckReports.StatusTrackingQuery';

            case Transaction\TransactionType::UPDATE:
                return 'ECheck.Update';
        }
    }
1047632
public function rollBackTransaction(): bool
	{
		if($this->transactionNestingLevel > 0)
		{
			if($this->transactionNestingLevel > 1)
			{
				$success = $this->rollBackSavepoint();
			}
			else
			{
				$success =  $this->pdo->rollBack();
			}

			$this->transactionNestingLevel--;

			return $success;
		}

		return false;
	}
652194
public function rollbackTransaction()
    {
        $this->db_connect('w', true);

        // check connection before proceeding
        if (!$this->is_connected()) {
            return $this->last_result = false;
        }

        $this->debug('ROLLBACK TRANSACTION');

        if (@oci_rollback($this->dbh)) {
            $this->in_transaction = false;
        }
        else {
            $this->handle_error('ROLLBACK');
        }

        return $this->last_result = $this->dbh->rollBack();
    }
912963
private function processTransaction(Transaction $transaction, PaymillMethod $paymentMethod)
    {
        /**
         * Payment paid done
         *
         * Paid process has ended ( No matters result )
         */
        $this->paymentEventDispatcher->notifyPaymentOrderDone($this->paymentBridge, $paymentMethod);

        /**
         * when a transaction is successful, it is marked as 'closed'
         */
        $transactionStatus = $transaction->getStatus();
        if (empty($transactionStatus) || $transactionStatus != 'closed') {

            /**
             * Payment paid failed
             *
             * Paid process has ended failed
             */
            $paymentMethod->setTransaction($transaction);
            $this->paymentEventDispatcher->notifyPaymentOrderFail($this->paymentBridge, $paymentMethod);

            throw new PaymentException();
        }

        /**
         * Adding to PaymentMethod transaction information
         *
         * This information is only available in PaymentOrderSuccess event
         */
        $paymentMethod
            ->setTransactionId($transaction->getId())
            ->setTransactionStatus($transactionStatus)
            ->setTransaction($transaction);

        /**
         * Payment paid successfully
         *
         * Paid process has ended successfully
         */
        $this->paymentEventDispatcher->notifyPaymentOrderSuccess($this->paymentBridge, $paymentMethod);

        return $this;
    }
944224
public function addTransaction(Transaction $transaction)
    {
        $transaction->setAgreement($this);
        $this->transactions->add($transaction);

        return $this;
    }
566200
public function getPending($limit = 10)
    {
        $results = $this->getCollection()
            ->find(array('processed' => false))
            ->limit($limit);

        return iterator_to_array($results);
    }
1244706
public function getDelivery(Transaction $transaction = null)
    {
        if ($this->session->has('delivery-id')) {
            $delivery = $this->manager->getRepository('EcommerceBundle:Delivery')->find($this->session->get('delivery-id'));

            return $delivery;
        }

        $delivery = new Delivery();

        /** @var Address $billingAddress */
        $billingAddress = $this->manager->getRepository('EcommerceBundle:Address')->findOneBy(array(
            'actor' => $this->securityContext->getToken()->getUser(),
            'forBilling' => true
        ));

        if (false === is_null($billingAddress)) {
            $delivery->setFullName($this->securityContext->getToken()->getUser()->getFullName());
            $delivery->setContactPerson($billingAddress->getContactPerson());
            $delivery->setDni($billingAddress->getDni());
            $delivery->setAddressInfo($billingAddress->getAddressInfo());
            $delivery->setPhone($billingAddress->getPhone());
            $delivery->setPhone2($billingAddress->getPhone2());
            $delivery->setPreferredSchedule($billingAddress->getPreferredSchedule());
        }

        $country = $this->manager->getRepository('CoreBundle:Country')->find('es');
        $delivery->setCountry($country);

        if (false === is_null($transaction)) {
            $delivery->setTransaction($transaction);
        }

        return $delivery;
    }
1066182
public function endTransaction($commit)
    {
        if ($commit) {
            $result = $this->commit();
        } else {
            $result = $this->rollback();
        }

        switch ($this->mode) {

            case "mysql":
                if (!$this->server->autocommit(true)) {
                    $result = false;
                }
                break;

            case "postgres":
                $result = $this->query("SET AUTOCOMMIT = ON");
                break;

            case "redshift":
                # Do nothing, and use the result from the commit/rollback
                break;

            case "odbc":
                if (!odbc_autocommit($this->server, true)) {
                    $result = false;
                }
                break;

            default:
                throw new \Exception("endTransaction() not supported in this mode (" . $this->mode . ")");
        }

        if (!$result) {
            $this->error();
        }

        $this->transaction = false;

        return true;
    }
711155
protected function rollback_transaction() {
        if (!$this->transactions_supported()) {
            return;
        }

        $sql = "ROLLBACK";
        $this->query_start($sql, NULL, SQL_QUERY_AUX);
        $result = $this->mysqli->query($sql);
        $this->query_end($result);

        return true;
    }
347291
public function getTransaction( $transaction = self::TRANSACTION_LAST_USED, $throwExceptionIfNotFound = true )
    {

        if( $transaction === self::TRANSACTIONS_ALL ) {
            return array_keys( $this->queue );
        }

        if( $transaction === self::TRANSACTION_LAST_CREATED ) {
            if( !$this->queue) {
                $this->newTransaction();
            }
            $queue = array_keys( $this->queue );
            return array_pop( $queue );
        }

        if( $transaction === self::TRANSACTION_LAST_USED ) {
            if( !$this->queue) {
                $this->newTransaction();
            }
            return $this->lastTransaction;
        }

        if( $transaction === self::TRANSACTION_NEW ) {
            return $this->newTransaction();
        }

        if( !array_key_exists( $transaction, $this->queue ) ) {
            if( $throwExceptionIfNotFound ) {
                throw new TransactionDoesNotExistException(
                    "Transaction with this name `{$transaction}` doesn't exist. Sorry."
                );
            }
            return null;
        }

        return $transaction;

    }
100617
public function generateForms(Transaction $transaction)
    {
        $paymentForms = array();

        foreach ($this->paymentAdapters as $bankId => $paymentAdapter) {
            if ($paymentAdapter->enabled) {
                $form = new Form([], $paymentAdapter);

                $paymentAdapter->fillPaymentFormDataset($form, $transaction);
                $this->paymentHandler->finalizeForm($form, $paymentAdapter);

                $paymentForms[$bankId] = $form;
            }
        }

        return $paymentForms;
    }
630554
public function getQueryResults($limit = null)
    {
        if (isset($limit)) {
            $this->queryBuilder->setMaxResults($limit);
        }
        
        if (!$this->queryBuilder->getDQLPart('orderBy')) {
            $this->queryBuilder->orderBy('a.createdAt', 'ASC');
        }

        return $this->queryBuilder->getQuery()->getResult();
    }
1315973
public function getTopTraderEntityData($limit = 10)
    {
        $topTrader = $this->gameDataService->getTopJobCharacter(1);

        return $topTrader->setMaxResults($limit)
            ->getQuery()
            ->getResult();
    }
510408
private function setTransaction(TransactionInterface $transaction) {
        $transactions = $this->getTransactions();
        $transactions[$this->getDbService()] = $transaction;
        $this->setTransactions($transactions);
    }
492258
public function withinTransaction(callable $operation)
    {
        if ($this->isInTransaction()) {
            return $operation();
        }

        $this->beginTransaction();
        try {
            $result = $operation();
            $this->commitTransaction();

            return $result;
        } catch (\Exception $e) {
            $this->rollbackTransaction();
            throw $e;
        }
    }
1356362
protected function doTransact(Transaction $transaction, array $options = array())
    {
        $this->_validateTransaction($transaction);

        $result = $transaction->getResult();
        $result->setTransactor($this);

        $result->setStatus(new Result\ResultStatus(Result\ResultStatus::APPROVED));

        return $result;
    }