public function getTransactionStatus()
    {
        // If the signature check fails, then all bets are off - the POST cannot be trusted.

        if (! $this->isValid()) {
            return static::STATUS_FAILED;
        }

        $status = $this->getStatus();

        if ($status === Response::SAGEPAY_STATUS_OK
            || $status === Response::SAGEPAY_STATUS_OK_REPEATED
            || $status === Response::SAGEPAY_STATUS_AUTHENTICATED
            || $status === Response::SAGEPAY_STATUS_REGISTERED
        ) {
            return static::STATUS_COMPLETED;
        }

        if ($status === Response::SAGEPAY_STATUS_PENDING) {
            return static::STATUS_PENDING;
        }

        return static::STATUS_FAILED;
    }