public function processResult(array $parameters)
    {
        $this->checkResultParameters($parameters);

        $redsysMethod = new RedsysMethod();

        $dsSignature = $parameters['Ds_Signature'];
        $dsResponse = $parameters['Ds_Response'];
        $dsAmount = $parameters['Ds_Amount'];
        $dsOrder = $parameters['Ds_Order'];
        $dsMerchantCode = $parameters['Ds_MerchantCode'];
        $dsCurrency = $parameters['Ds_Currency'];
        $dsSecret = $this->secretKey;
        $dsDate = $parameters['Ds_Date'];
        $dsHour = $parameters['Ds_Hour'];
        $dsSecurePayment = $parameters['Ds_SecurePayment'];
        $dsCardCountry = $parameters['Ds_Card_Country'];
        $dsAuthorisationCode = $parameters['Ds_AuthorisationCode'];
        $dsConsumerLanguage = $parameters['Ds_ConsumerLanguage'];
        $dsCardType = array_key_exists('Ds_Card_Type', $parameters)
            ? $parameters['Ds_Card_Type']
            : '';

        if ($dsSignature != $this
                ->expectedSignature(
                    $dsAmount,
                    $dsOrder,
                    $dsMerchantCode,
                    $dsCurrency,
                    $dsResponse,
                    $dsSecret
                )
        ) {
            throw new InvalidSignatureException();
        }

        /**
         * Adding transaction information to PaymentMethod.
         *
         * This information is only available in PaymentOrderSuccess event
         */
        $redsysMethod
            ->setDsResponse($dsResponse)
            ->setDsAuthorisationCode($dsAuthorisationCode)
            ->setDsCardCountry($dsCardCountry)
            ->setDsCardType($dsCardType)
            ->setDsConsumerLanguage($dsConsumerLanguage)
            ->setDsDate($dsDate)
            ->setDsHour($dsHour)
            ->setDsSecurePayment($dsSecurePayment)
            ->setDsOrder($dsOrder);

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

        /**
         * when a transaction is successful, $Ds_Response has a
         * value between 0 and 99.
         */
        if (!$this->transactionSuccessful($dsResponse)) {

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

            throw new PaymentException();
        }

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

        return $this;
    }