Initialize one time transaction to get payment url.

@return \Exception|mixed|PaystackInvalidTransactionException
965001
public function initialize()
    {
        return !is_null($this->transactionRef) ?
           $this->getTransactionResource()->initialize($this->_requestPayload()) :
            new PaystackInvalidTransactionException(
                json_decode(
                    json_encode(
                        [
                            'message' => 'Transaction Reference Not Generated.',
                        ]
                    ),
                    false
                )
            );
    }
33619
public function payment() {
		$registration = $this->getCurrentRegistration(false);
		if(!$registration || !$registration->canPay()){
			return $this->redirect($this->Link());
		}
		$controller = new PaymentController($this, "payment", $registration, $registration->Total);
		$controller->setSuccessURL($this->Link('complete'));
		$controller->setCancelURL($this->Link('payment'));
		//hack the url segment until the parent controller of this works properly
		$controller->data()->URLSegment = "register/payment";
		return $controller;
	}
1250517
public function verify()
	{
		if (!$this->request->has('transaction_id') && !$this->request->has('iN'))
			throw new InvalidRequestException;
		if ($this->request->has('transaction_id')) {
			$id = $this->request->get('transaction_id');
		}else {
			$id = $this->request->get('iN');
		}

		$transaction = $this->getTable()->whereId($id)->first();

		if (!$transaction)
			throw new NotFoundTransactionException;

		if (in_array($transaction->status, [Enum::TRANSACTION_SUCCEED, Enum::TRANSACTION_FAILED]))
			throw new RetryException;

		$this->make($transaction->port);

		return $this->port->verify($transaction);
	}
1193234
public function beginTransaction()
    {
        $this->setActive(true);
        $this->_pdo->beginTransaction();
        return $this->_transaction = new Transaction($this);
    }
948230
public function commit() {
		if (!$this->inTransaction()) {
			throw new Exception('There is no active transaction');
		}

		$res = @oci_commit($this->_dbh);
		$this->checkError($res);

		$this->_inTransaction = false;
		$this->_commitMode = null;

		return $res;
	}
543576
public function getPaymentLink()
    {
        if (($sValue = $this->getViewConfigParam('paymentlink')) === null) {
            $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
            $this->setViewConfigParam('paymentlink', $sValue);
        }

        return $sValue;
    }
693606
private function buildCommitRequest()
    {
        $obj_request = (object)['mutations' => []];

        // Transaction at root level, so do not use applyTransaction()
        if(null !== $this->str_next_transaction) {
            $obj_request->transaction = $this->str_next_transaction;
            $obj_request->mode = self::MODE_TRANSACTIONAL;
            $this->str_next_transaction = null;
        } else {
            $obj_request->mode = self::MODE_NON_TRANSACTIONAL;
        }
        return $obj_request;
    }
76524
public function getURL() {

        if ($this->_generatedURL != "")
            return $this->_generatedURL;

        if (!isset($this->_merchantID))
            throw new Exception('Merchant ID not set, use the setMerchantID() method');
        if (!isset($this->_secretCode))
            throw new Exception('Secretcode ID not set, use the setSecretCode() method');

        if (!isset($this->data->ic_country)) {
            if (count($this->_country) == 1) {
                $this->data->ic_country = current($this->_country);
            } else
                $this->data->ic_country = $this->_defaultCountryCode;
        }

        if (!isset($this->data->ic_issuer) && isset($this->data->ic_paymentmethod)) {
            if (count($this->_issuer) == 1) {
                $this->data->ic_issuer = current($this->_issuer);
            } else
                throw new Exception('Issuer not set, use the setIssuer() method');
        }

        if (!isset($this->data->ic_language)) {
            if (count($this->_language) == 1) {
                $this->data->ic_language = current($this->_language);
            } else
                throw new Exception('Language not set, use the setLanguage() method');
        }

        if (!isset($this->data->ic_currency)) {
            if (count($this->_currency) == 1) {
                $this->data->ic_currency = current($this->_currency);
            } else
                throw new Exception('Currency not set, use the setCurrency() method');
        }

        if (!isset($this->data->ic_amount))
            throw new Exception('Amount not set, use the setAmount() method');

        if (!isset($this->data->ic_orderid))
            throw new Exception('OrderID not set, use the setOrderID() method');

        if (!isset($this->data->ic_reference))
            $this->data->ic_reference = "";
        if (!isset($this->data->ic_description))
            $this->data->ic_description = "";

        /*
         * Dynamic URLs
         * @since 1.0.1
         */
        if (!isset($this->data->ic_urlcompleted))
            $this->data->ic_urlcompleted = "";
        if (!isset($this->data->ic_urlerror))
            $this->data->ic_urlerror = "";

        $this->data->ic_version = $this->_checkout_version;
        $this->data->ic_merchantid = $this->_merchantID;
        $this->data->chk = $this->generateCheckSumDynamic();

        /* @since version 1.0.2 */
        if ($this->_webservice) {
            require_once(DIR . DS . "icepay_api_webservice.php");

            if (!isset($this->data->ic_issuer) || $this->data->ic_issuer == "")
                throw new Exception("Issuer not set");

            //$ws = Icepay_Api_Webservice::getInstance()->paymentService();
            $ws = Icepay_Api_Webservice::getInstance()->paymentService();
            $ws->setMerchantID($this->_merchantID)
                    ->setSecretCode($this->_secretCode)
                    ->setSuccessURL($this->data->ic_urlcompleted)
                    ->setErrorURL($this->data->ic_urlerror);
            try {
                $this->_generatedURL = $ws->checkOut($this->paymentObj, true);
            } catch (Exception $e) {
                throw new Exception($e->getMessage());
            }
            return $this->_generatedURL;
        }

        if (isset($this->data->ic_paymentmethod)) {
            $this->_generatedURL = $this->postRequest($this->basicMode(), $this->prepareParameters());
        } else {
            $this->_generatedURL = sprintf("%s&%s", $this->basicMode(), $this->prepareParameters());
        }

        return $this->_generatedURL;
    }
846804
protected function checkRequest()
    {
        if ('prod' === $this->getKernel()->getEnvironment()) {
            throw new \RuntimeException('Debug Payment is not authorized in production environment.');
        }

        $request = $this->getCurrentRequest();
        $reference = $request->get('reference');

        $order = $this->getOrderManager()->findOneBy(['reference' => $reference]);

        if (!$order) {
            throw new NotFoundHttpException(sprintf('Order with reference "%s" not found.', $reference));
        }

        if ($request->get('check') !== $this->getDebugPayment()->generateUrlCheck($order)) {
            throw new InvalidTransactionException($reference);
        }

        return $order;
    }
259534
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new PaymentProperties();

			self::$instance->init( PaymentGlobal::CONFIG_PAYMENT );
		}

		return self::$instance;
	}
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;

    }
872763
protected function userPayment()
	{
		$this->refIf = Input::get('id_get');
		$trackingCode = Input::get('trans_id');

		if (is_numeric($trackingCode) && $trackingCode > 0) {
			$this->trackingCode = $trackingCode;
			return true;
		}

		$this->transactionFailed();
		$this->newLog(-4, PaylineReceiveException::$errors[-4]);
		throw new PaylineReceiveException(-4);
	}
289566
protected function validatePaymentTransaction(PaymentTransaction $paymentTransaction)
    {
        $this->validateQueryConfig($paymentTransaction);

        $errorMessage   = '';
        $missedFields   = array();
        $invalidFields  = array();

        foreach (static::$requestFieldsDefinition as $fieldDescription)
        {
            list($fieldName, $propertyPath, $isFieldRequired, $validationRule) = $fieldDescription;

            $fieldValue = PropertyAccessor::getValue($paymentTransaction, $propertyPath, false);

            if (!empty($fieldValue))
            {
                try
                {
                    Validator::validateByRule($fieldValue, $validationRule);
                }
                catch (ValidationException $e)
                {
                    $invalidFields[] = "Field '{$fieldName}' from property path '{$propertyPath}', {$e->getMessage()}.";
                }
            }
            elseif ($isFieldRequired)
            {
                $missedFields[] = "Field '{$fieldName}' from property path '{$propertyPath}' missed or empty.";
            }
        }

        if (!empty($missedFields))
        {
            $errorMessage .= "Some required fields missed or empty in PaymentTransaction: \n" .
                             implode("\n", $missedFields) . "\n";
        }

        if (!empty($invalidFields))
        {
            $errorMessage .= "Some fields invalid in PaymentTransaction: \n" .
                             implode("\n", $invalidFields) . "\n";
        }

        if (!empty($errorMessage))
        {
            throw new ValidationException($errorMessage);
        }
    }
425981
public function transactionStart()
    {
        if (empty($this->oDb)) {
            $this->connect();
        }

        try {

            $this->oDb->beginTransaction();
            $this->transactionRunning = true;

            return true;

        } catch (\Exception $e) {
            throw new TransactionException($e->getMessage(), $e->getCode());
        }
    }
561243
public function beginTransaction()
    {
        $return = true;
        $opcount = $this->getNestedTransactionCount();
        if ($opcount === 0) {
            $return = self::exec('BEGIN TRANSACTION');
            if ($this->useDebug) {
                $this->log('Begin transaction', null, __METHOD__);
            }
            $this->isUncommitable = false;
        }
        $this->nestedTransactionCount++;

        return $return;
    }
285962
public function checkEntityPayments($payments = array())
    {
        $requestReferenceDetails = new Structure\RequestEntityPayments();
        if ($payments) {
            foreach ($payments as $key => $value) {
                $requestPayment = new Structure\RequestReferenceDetails($value);
                $requestReferenceDetails->addPayment($requestPayment);
            }
        }

        $this->response = parent::checkEntityPayments($this->entity, $requestReferenceDetails);

        /**
         * Checks the state of the platform integration.
         */
        if (Exception\IntegrationState::check($this->response->state)) {
            throw new Exception\IntegrationState($this->response->state);
        }

        if ($this->response->state->state == 0) {
            throw new Exception\IntegrationResponse($this->response->state->message, $this->response->state->code);
        }

        return $this->response;
    }
170312
function initCompleteTransaction($amount, $buyOrder, $sessionId, $cardExpirationDate, $cvv, $cardNumber) {

        try {

            $wsCompleteInitTransactionInput = new wsCompleteInitTransactionInput();
            $completeCardDetail = new completeCardDetail();
            $wsCompleteTransactionDetail = new wsCompleteTransactionDetail();

            /** (Obligatorio) Indica el tipo de transacción, su valor debe ser siempre TR_COMPLETA_WS */
            $wsCompleteInitTransactionInput->transactionType = 'TR_COMPLETA_WS';
            $wsCompleteInitTransactionInput->sessionId = $sessionId;

            $wsCompleteTransactionDetail->amount = $amount;
            $wsCompleteTransactionDetail->buyOrder = $buyOrder;
            $wsCompleteTransactionDetail->commerceCode = $this->config->getCommerceCode();

            $completeCardDetail->cardExpirationDate = $cardExpirationDate;
            $completeCardDetail->cvv = $cvv;
            $completeCardDetail->cardNumber = $cardNumber;

            /** (Obligatorio) Objeto del tipo wsTransactionDetail que contiene información asociada a la tarjeta de crédito */
            $wsCompleteInitTransactionInput->cardDetail = $completeCardDetail; // cardDetails

            /** (Obligatorio) Lista de objetos del tipo wsTransactionDetail, el cual contiene datos de la transacción. Máxima cantidad de repeticiones es de 1 para este tipo de transacción */
            $wsCompleteInitTransactionInput->transactionDetails = $wsCompleteTransactionDetail; // wsTransactionDetail

            $initCompleteTransactionResponse = $this->_initCompleteTransaction(
                    array("wsCompleteInitTransactionInput" => $wsCompleteInitTransactionInput)
            );

            $xmlResponse = $this->soapClient->__getLastResponse();
            $soapValidation = new SoapValidation($xmlResponse, $this->config->getWebpayCert());
            $validationResult = $soapValidation->getValidationResult();

            if ($validationResult === TRUE) {

                $wsCompleteInitTransactionOutput = $initCompleteTransactionResponse->return;
                return $wsCompleteInitTransactionOutput;
            } else {

                $error["error"] = "Error validando conexi&oacute;n a Webpay (Verificar que la informaci&oacute;n del certificado sea correcta)";
                $error["detail"] = "No se pudo completar la conexi&oacute;n con Webpay";
            }
        } catch (Exception $e) {

            $error["error"] = "Error conectando a Webpay (Verificar que la informaci&oacute;n del certificado sea correcta)";

            $replaceArray = array('<!--' => '', '-->' => '');
            $error["detail"] = str_replace(array_keys($replaceArray), array_values($replaceArray), $e->getMessage());
        }

        return $error;
    }