Transacts the given transaction


@param \Orkestra\Transactor\Entity\Transaction $transaction
@param array                                   $options

@throws \Orkestra\Transactor\Exception\TransactorException
@return \Orkestra\Transactor\Entity\Result
430533
public function transact(Transaction $transaction, array $options = array())
    {
        if ($transaction->isTransacted()) {
            throw TransactorException::transactionAlreadyProcessed();
        } elseif (!$this->supportsType($transaction->getType())) {
            throw TransactorException::unsupportedTransactionType($transaction->getType());
        } elseif (!$this->supportsNetwork($transaction->getNetwork())) {
            throw TransactorException::unsupportedTransactionNetwork($transaction->getNetwork());
        }

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

        try {
            $options = $this->getResolver()->resolve($options);

            $this->doTransact($transaction, $options);
        } catch (\Exception $e) {
            $result->setStatus(new ResultStatus(ResultStatus::ERROR));
            $result->setMessage('An internal error occurred while processing the transaction.');
            $result->setData('message', $e->getMessage());
            $result->setData('trace', $e->getTraceAsString());
        }

        return $this->filterResult($result);
    }
112618
def refund_transaction(options = {})
      @logger.debug("[refund_transaction] options=#{options.inspect}")

      validate_refund_transaction_params!(options)

      response = execute_request(:refund_info, options)
      unless response.refundable?
        raise NonRefundableTransactionException, options[:transaction_id]
      end

      # Pick maximum refundable amount if amount is not supplied.
      options[:amount] = response.maximum_amount unless options[:amount]

      # Fill required parameters with data from refund info request.
      options.merge!(
        payment_method: response.payment_method,
        invoicenumber: response.invoicenumber,
        currency: response.currency
      )

      execute_request(:refund_transaction, options)
    end
1153187
public function addTransaction(Transaction $transaction)
    {
        $transaction->setAdvert($this);
        $this->transactions->add($transaction);

        return $this;
    }
983684
private function _submitTransaction($transaction, $txnType, $clientTransactionId = null)
    {
        $options = array();
        if ($clientTransactionId !== null) {
            $options['clientTransactionId'] = $clientTransactionId;
        }
        $rsp = $this->doRequest($transaction, $options);
        HpsGatewayResponseValidation::checkResponse($rsp, $txnType);
        $response = HpsCheckResponse::fromDict($rsp, $txnType);

        if ($response->responseCode != 0) {
            throw new HpsCheckException(
                $rsp->Header->GatewayTxnId,
                $response->details,
                $response->responseCode,
                $response->responseText
            );
        }

        return $response;
    }
364765
def cancel_transaction(options = {})
      @logger.debug("[cancel_transaction] options=#{options.inspect}")

      validate_required_params!(options, :transaction_id)

      response = execute_request(:status, options)
      unless response.cancellable?
        raise NonCancellableTransactionException, options[:transaction_id]
      end

      execute_request(:cancel, options)
    end
1327042
public function beginTransaction(array $options = [])
    {
        if (!$this->isConnected()) {
            $this->connect();
        }
        
        if (!$this->inTransaction() || !empty($options['new'])) {
            $this->workSavepoint(
                'beginTransaction',
                'SAVEPOINT ' . $this->savePointName()
            );
            $this->transactions[] = true;
        } else {
            $this->transactions[] = false;
        }
    }
332879
protected function doTransact(Transaction $transaction, array $options = array())
    {
        $this->validateTransaction($transaction);

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

        $adjustment = $transaction->getAmount();
        if (Transaction\TransactionType::SALE === $transaction->getType()->getValue()) {
            if ($transaction->getAmount() > $account->getBalance()) {
                $result->setStatus(new Result\ResultStatus(Result\ResultStatus::DECLINED));
                $result->setMessage('Amount exceeds account balance');

                return $result;
            }

            $adjustment *= -1; // Negate the adjustment
        }

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

        return $result;
    }
1002724
public function update(Transaction $transaction, UpdateTransactionRequest $request)
    {
        $this->transaction->update($transaction, $request->all());

        return redirect()->route('admin.order.order.show', $transaction->order_id)
            ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('order::transactions.title.transactions')]));
    }
325686
public function process(Request $request, Transaction $transaction, Delivery $delivery)
    {
        //UPDATE TRANSACTION
        $em = $this->container->get('doctrine')->getManager();
        $pm = $em->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('bank-transfer-test');
        $transaction->setStatus(Transaction::STATUS_PAID);
        $transaction->setPaymentMethod($pm);
        $em->persist($transaction);
        $em->flush();
        //confirmation payment
        $answer = new stdClass();
        $answer->redirectUrl = $this->container->get('router')->generate('ecommerce_checkout_confirmationpayment');

        return $answer;
    }
639942
public function _send($transaction)
        {
            $storeId        = $this->getConfigData('store_id');
            $apiToken       = $this->getConfigData('api_token');

            $request        = new mpgRequest($transaction);

            $mpgHttpsPost   = new mpgHttpsPost($storeId, $apiToken, $request);

            return $mpgHttpsPost->getMpgResponse();
        }
262166
public function transfer($options)
    {
        $options['method'] = 'transfer';
        $body = $this->_buildTransfer($options);
        return $this->_request($body);
    }
723569
public function trackTransaction($id, array $options = [])
	{
		$options['id'] = $id;
		$this->trackEcommerce(self::ECOMMERCE_TRANSACTION, $options);
	}
87474
public function applyTransactionId(TransactionInterface $transaction)
    {
        $transactionId = $transaction->get('txn_id', null);

        if (!$transactionId) {
            // no transaction id provided
            $transactionId = -1;
        }

        $transaction->setTransactionId($transactionId);
    }
921206
public function delete($id, $options = [])
    {
        $params = [];

        $params['transaction'] = 'fail';

        if ($creditcard === 'success') {
            $params['transaction'] = 'success';
        }

        return $this->gateway->commit('post', 'delete', $params);
    }
1168412
public function processRedsysTransaction($ds_response, Transaction $transaction)
    {
        if ($ds_response > 99) {
            return false;
        }

        $transaction->setStatus(Transaction::STATUS_PAID);
        $pm = $this->manager->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('redsys');
        $transaction->setPaymentMethod($pm);

        $this->manager->persist($transaction);
        $this->manager->flush();

        return true;
    }
159430
protected function validateTransaction(Transaction $transaction)
    {
        if (!$transaction->getParent() && in_array($transaction->getType()->getValue(), array(
            Transaction\TransactionType::REFUND
        ))) {
            throw ValidationException::parentTransactionRequired();
        } elseif (!$transaction->getAccount() instanceof PointsAccount) {
            throw ValidationException::invalidAccountType($transaction->getAccount());
        }

        $transaction->setAmount((int) $transaction->getAmount());
    }
8622
public function action($action, $options = [])
    {
        if ($this->shouldValidate) $this->validate();
        if ($this->shouldCallGuard) $this->guard();
        if ($this->shouldFallThrough) return $this;

        if (is_string($action) && !class_exists($action)) {
            throw new Exception("{$action} does not exist.");
        }

        if (!is_subclass_of($action, Action::class)) {
            throw new Exception('Actions must extend '.Action::class.'.');
        }

        if (is_string($action)) {
            $action = new $action($this, $options);
        }

        $this->perform($action);

        return $this;
    }