Verify Transaction by transaction reference.

@param $reference

@return \Exception|mixed
485441
public function verify($reference)
    {
        $request = $this->paystackHttpClient->get(
            $this->transformUrl(Resource::VERIFY_TRANSACTION, $reference, ':reference')
        );

        return $this->processResourceRequestResponse($request);
    }
938511
protected function doGetDBRef(array $reference)
    {
        $mongoDB = $this->mongoDB;
        return $this->retry(function() use ($mongoDB, $reference) {
            return $mongoDB->getDBRef($reference);
        });
    }
1165822
public function getTransactionsByCode($code)
    {
        $this->_library->setEnvironment();
        $this->_library->setCharset();
        $this->_library->setLog();

        $response = null;
        try {
            $response = \PagSeguro\Services\Transactions\Search\Code::search(
                $this->_library->getPagSeguroCredentials(),
                $code
            );

            return $response;
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
    }
802916
private function convertObjectReference($reference)
    {
        if ($reference instanceof AbstractTable) {
            return $reference->getAliasOrName();
        } elseif ($reference instanceof BuilderInterface) {
            return $reference->buildSQL();
        } elseif ($reference instanceof RelativeClause) {
            $table = $this->convertObjectReference($reference->getRelatedTable());
            $clause = $this->convertObjectReference($reference->getClause());

            return str_replace($reference->getDirective(), $table . '.', $clause);
        }

        return $reference;
    }
97855
public function resolve($reference)
    {
        if (empty($reference)) {
            return $reference;
        }

        if ($this->isResolvableAnonymousReference($reference)) {
            return $this->resolveAnonymousReference($reference);
        }

        return $this->resolveInternal($reference);
    }
726678
public function getRef($reference)
    {
        $array = ! isset($reference['$ref']);
        $reference = $array ? $reference : [$reference];
        $database = $this->database;

        $result = array_map(
            function ($ref) use ($database) {
                return MongoDBRef::get($database, $ref);
            },
            $reference
        );

        return $array ? $result : reset($result);
    }
1133504
protected function _check($reference)
    {
        $isString = is_string($reference);
        if ($isString) {
            if (!class_exists($reference)) {
                throw new InvalidArgumentException("Can't Spy the unexisting class `{$reference}`.");
            }
            $reflection = Inspector::inspect($reference);
        } else {
            $reflection = Inspector::inspect(get_class($reference));
        }

        if (!$reflection->isInternal()) {
            return;
        }
        if (!$isString) {
            throw new InvalidArgumentException("Can't Spy built-in PHP instances, create a test double using `Double::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;

    }
143771
public function resolve($reference)
    {
        $parts = explode('?:', $reference, 2);

        for ($index = 0; $index < count($parts); $index++) {
            try {
                return $this->resolver->resolve(trim($parts[$index]));
            }
            catch (UnknownDefinitionException $exception) {
                continue;
            }
        }

        return null;
    }
1283199
function CommitTransaction()
	{
		if ($this->ConnectionSetting->IsReadOnlySlave)
			throw new Exception('Transactions are not allowed on a read-only slave');
		
		$this->RequireConnection(true);
		$this->Observe("DataAdapter ($this->_label) (DataAdapter.CommitTransaction)", OBSERVE_QUERY);
		$this->_transactionInProgress = false;
		return $this->_driver->CommitTransaction($this->_dbconn);
	}
255472
public function equals( $reference ) {
        if ( !( $reference instanceof EntityReference ) ) {
            return false;
        }

        if ( strcasecmp( $this->entityLogicalName, $reference->entityLogicalName ) !== 0 ) {
            return false;
        }

        if ( $this->getID() !== $reference->getID() ) {
            return false;
        }

        return true;
    }
1330539
function verify($transaction)
	{
		$this->transaction = $transaction;
		$this->transactionId = $transaction->id;
		$this->amount = intval($transaction->price);
		$this->refId = $transaction->ref_id;
	}
263129
private function resolveReference(Reference $reference)
    {
        if (!ExternalReference::isValid($reference)) {
            return $reference;
        }

        return $this->transformReferenceToDefinition(new ExternalReference($reference));
    }
328495
protected function verifyPayment()
	{
		$processor = new RSAProcessor($this->config->get('gateway.pasargad.certificate-path'),RSAKeyType::XMLFile);
		$fields = array('invoiceUID' => Input::get('tref'));
		$result = Parser::post2https($fields,$this->checkTransactionUrl);
		$check_array = Parser::makeXMLTree($result);

		if ($check_array['resultObj']['result'] != "True") {
		    $this->newLog(-1, Enum::TRANSACTION_FAILED_TEXT);
		    $this->transactionFailed();
		    throw new PasargadErrorException(Enum::TRANSACTION_FAILED_TEXT, -1);
		}
		
		$fields = array(
			'MerchantCode' => $this->config->get('gateway.pasargad.merchantId'),
			'TerminalCode' => $this->config->get('gateway.pasargad.terminalId'),
			'InvoiceNumber' => $check_array['resultObj']['invoiceNumber'],
			'InvoiceDate' => Input::get('iD'),
			'amount' => $check_array['resultObj']['amount'],
			'TimeStamp' => date("Y/m/d H:i:s"),
			'sign' => '',
		);

		$data = "#" . $fields['MerchantCode'] . "#" . $fields['TerminalCode'] . "#" . $fields['InvoiceNumber'] ."#" . $fields['InvoiceDate'] . "#" . $fields['amount'] . "#" . $fields['TimeStamp'] ."#";
		$data = sha1($data, true);
		$data = $processor->sign($data);
		$fields['sign'] = base64_encode($data);
		$result = Parser::post2https($fields,$this->verifyUrl);
		$array = Parser::makeXMLTree($result);
		if ($array['actionResult']['result'] != "True") {
			$this->newLog(-1, Enum::TRANSACTION_FAILED_TEXT);
			$this->transactionFailed();
			throw new PasargadErrorException(Enum::TRANSACTION_FAILED_TEXT, -1);
		}
		$this->refId = $check_array['resultObj']['referenceNumber'];
		$this->transactionSetRefId();
		$this->trackingCode = Input::get('tref');
		$this->transactionSucceed();
		$this->newLog(0, Enum::TRANSACTION_SUCCEED_TEXT);
	}
148487
protected function verifyPayment()
    {
        try {

            /** Get the payment ID before session clear **/
            $payment_id = \Session::get('paypal_payment_id');
            /** clear the session payment ID **/
            \Session::forget('paypal_payment_id');
            if (!$this->refId() || !$this->trackingCode()) {
                return false;
            }
            $payment = Payment::get($payment_id, $this->_api_context);
            /** PaymentExecution object includes information necessary **/
            /** to execute a PayPal account payment. **/
            /** The payer_id is added to the request query parameters **/
            /** when the user is redirected from paypal back to your site **/
            $execution = new PaymentExecution();
            $execution->setPayerId($this->refId);
            /**Execute the payment **/
            $result = $payment->execute($execution, $this->_api_context);
            /** dd($result);exit; /** DEBUG RESULT, remove it later **/
            if ($result->getState() == 'approved') {

                /** it's all right **/
                /** Here Write your database logic like that insert record or value in database if you want **/

//            \Session::put('success','Payment success');
                return true;
            }

            return false;
        } catch (\Exception $e) {
            $this->transactionFailed();
            $this->newLog('PaypalException', $e->getMessage());
            throw $e;
        }
    }
275487
public function reference($reference = null)
    {
        if (!func_num_args()) {
            return $this->_reference;
        }
        $this->_reference = $reference;
        return $this;
    }
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;
    }