Check after response from IPayment if the paymenthandler is the one which sent request to IPayment.

@return bool $bIsCorrectIPaymentType
327414
protected function bIsCorrectIPaymentType()
    {
        $bIsCorrectIPaymentType = false;
        $aParameter = $this->GetPaymentTypeSpecifivParameter();
        $oGlobal = TGlobal::instance();
        $sResponsePaymentType = $oGlobal->GetUserData('trx_paymenttyp');
        if (!empty($sResponsePaymentType) && array_key_exists('trx_paymenttyp', $aParameter) && $aParameter['trx_paymenttyp'] == $sResponsePaymentType) {
            $bIsCorrectIPaymentType = true;
        }

        return $bIsCorrectIPaymentType;
    }
169109
public function processPayment()
    {
        $paymentMethod = $this
            ->methodFactory
            ->create();

        /**
         * At this point, order must be created given a card, and placed in
         * PaymentBridge.
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderLoad(
                $this->paymentBridge,
                $paymentMethod
            );

        /**
         * Order exists right here.
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderCreated(
                $this->paymentBridge,
                $paymentMethod
            );

        /**
         * Payment paid done.
         *
         * Paid process has ended (No matters result)
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderDone(
                $this->paymentBridge,
                $paymentMethod
            );

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

        return $this;
    }
263402
public function errorAction()
    {
        try {
            $order = $this->getPaymentHandler()->handleError($this->getCurrentRequest(), $this->getBasket());
        } catch (EntityNotFoundException $ex) {
            throw new NotFoundHttpException($ex->getMessage());
        } catch (InvalidTransactionException $ex) {
            throw new UnauthorizedHttpException($ex->getMessage());
        }

        return $this->render('SonataPaymentBundle:Payment:error.html.twig', [
            'order' => $order,
        ]);
    }
412548
public function isBoletoPayment()
    {
        $this->order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());

        if ($this->order->getPayment() && $this->order->getPayment()->getMethod() == "adyen_boleto") {
            return true;
        }

        return false;
    }
741635
public function checkResponse()
    {
        if (!isset($this->order_ref)) {
            $this->errorMessage[] = 'CHECK RESPONSE: Missing order_ref variable!';
            return false;
        }
        $this->logFunc("BackRef", $this->getData, $this->order_ref);

        if (!$this->checkCtrl()) {
            $this->errorMessage[] = 'CHECK RESPONSE: INVALID CTRL!';
            return false;
        }

        $ios = new SimpleIos($this->iosConfig, $this->getData['order_currency'], $this->order_ref);

        foreach ($ios->errorMessage as $msg) {
            $this->errorMessage[] = $msg;
        }
        foreach ($ios->debugMessage as $msg) {
            $this->debugMessage[] = $msg;
        }

        if (is_object($ios)) {
            $this->checkIOSStatus($ios);
        }
        $this->logFunc("BackRef_BackStatus", $this->backStatusArray, $this->order_ref);
        if (!$this->checkRtVariable($ios)) {
            return false;
        }
        if (!$this->backStatusArray['RESULT']) {
            return false;
        }
        return true;
    }
480273
public function getPaymorrowOxUserPaymentReloaded()
    {
        $sUserPaymentId = $this->oxorder__oxpaymentid->value;

        /** @var oxUserPayment $oUserPayment */
        $oUserPayment = oxNew( 'oxUserPayment' );
        $oUserPayment->load( $sUserPaymentId );

        return $oUserPayment;
    }
3888
public function paymentSuccessful() {
    if ($this->requestHasSucceeded() && $this->requestMethod->isDirectPayment()) {
      return $this->requestMethod->getTransactionSuccessfulCode() == $this->response['resultPayment'];
    }

    return false;
  }
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);
	}
414280
public function changeWrapping()
    {
        $return = parent::changeWrapping();

        // in case user adds wrapping, basket info must be resubmitted..
        if ($this->isPayPal()) {
            $payPalType = (int) $this->getSession()->getVariable("oepaypal");

            if ($payPalType == 1) {
                $return = "payment";
            } else {
                $return = "basket";
            }
        }

        return $return;
    }
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);
	}
37579
public function wasAccepted()
    {
        if ( $this->hasErrors() ) {
            return false;
        }

        $aResponse = $this->getResponse();

        if ( !empty( $aResponse['pm_order_status'] ) && $aResponse['pm_order_status'] === 'ACCEPTED' ) {
            return true;
        }

        return false;
    }
996775
public function getPaymentErrorMessage()
    {
        /** @var Payment $lastPayment */
        // Get the last payment
        if (!$lastPayment = $this->reservation->Payments()->first()) {
            return false;
        }

        // Find the gateway error
        $lastErrorMessage = null;
        $errorMessages = $lastPayment->Messages()->exclude('Message', '')->sort('Created', 'DESC');
        foreach ($errorMessages as $errorMessage) {
            if ($errorMessage instanceof GatewayErrorMessage) {
                $lastErrorMessage = $errorMessage;
                break;
            }
        }

        // If no error is found return
        if (!$lastErrorMessage) {
            return false;
        }

        return _t("{$lastErrorMessage->Gateway}.{$lastErrorMessage->Code}", $lastErrorMessage->Message);
    }
164907
def process_callback(payment_transaction, callback_response)
      payment_transaction.processor_type = PaymentTransaction::PROCESSOR_CALLBACK
      payment_transaction.processor_name = @callback_type

      super payment_transaction, callback_response
    end
1047994
public function processIPNAction($sBody)
    {
        $oMessage = $this->_getMessage($sBody);

        if (isset($oMessage->NotificationData)) {
            $oData = $oMessage->NotificationData;

            switch ($oMessage->NotificationType) {
                case 'OrderReferenceNotification':
                    return $this->_orderReferenceUpdate($oData);
                case 'PaymentAuthorize':
                    return $this->_paymentAuthorize($oData);
                case 'PaymentCapture':
                    return $this->_paymentCapture($oData);
                case 'PaymentRefund':
                    return $this->_paymentRefund($oData);
                default:
                    $this->logIPNResponse(Logger::ERROR, 'NotificationType in response not found', $oMessage);
                    return false;
            }
        }

        $this->logIPNResponse(Logger::ERROR, 'Invalid ipn message');
        return false;
    }
364296
public function isWorking()
    {
        if (!function_exists('mb_internal_encoding')) {
            return Piwik::translate('UserCountry_GeoIPCannotFindMbstringExtension',
                array('mb_internal_encoding', 'mbstring'));
        }

        $geoIpError = false;
        $catchGeoIpError = function ($errno, $errstr, $errfile, $errline) use (&$geoIpError) {
            $filename = basename($errfile);
            if ($filename == 'geoip.inc'
                || $filename == 'geoipcity.inc'
            ) {
                $geoIpError = array($errno, $errstr, $errfile, $errline);
            } else {
                throw new \Exception("Error in PHP GeoIP provider: $errstr on line $errline of $errfile"); // unexpected
            }
        };

        // catch GeoIP errors
        set_error_handler($catchGeoIpError);
        $result = parent::isWorking();
        restore_error_handler();

        if ($geoIpError) {
            list($errno, $errstr, $errfile, $errline) = $geoIpError;
            Log::warning("Got GeoIP error when testing PHP GeoIP location provider: %s(%s): %s", $errfile, $errline, $errstr);

            return Piwik::translate('UserCountry_GeoIPIncorrectDatabaseFormat');
        }

        return $result;
    }
607265
public function isValidPayment($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId)
    {
        /** @var OxpsPaymorrowOxPayment|oxPayment $this */

        $blIsValid = (bool) $this->_OxpsPaymorrowOxPayment_isValidPayment_parent(
            $aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId
        );

        $iErrorCode = (int) $this->getPaymentErrorNumber();

        // In case it is Paymorrow payment method unset error code and tell than validation passed.
        if ($this->isPaymorrowActive() and !$blIsValid and ($iErrorCode === 1)) {
            $this->_iPaymentError = null;

            return true;
        }

        return $blIsValid;
    }
1072670
protected function parseAutodiscoverResponse()
    {
        // Content-type isn't trustworthy, unfortunately. Shame on Microsoft.
        if (substr($this->last_response, 0, 5) !== '<?xml') {
            return false;
        }

        $response = $this->responseToArray($this->last_response);

        if (isset($response['Error'])) {
            $this->error = $response['Error'];
            return false;
        }

        // Check the account action for redirect.
        switch ($response['Account']['Action']) {
            case 'redirectUrl':
                $this->redirect = array(
                    'redirectUrl' => $response['Account']['RedirectUrl']
                );
                return false;
            case 'redirectAddr':
                $this->redirect = array(
                    'redirectAddr' => $response['Account']['RedirectAddr']
                );
                return false;
            case 'settings':
            default:
                $this->discovered = $response;
                return true;
        }
    }