private function messageFrom($response)
    {
        $result = (string) $response->result;
        $response_message = (string) $response->message;

        switch ($result) {
            case '00':
                $message = $this->messages['SUCCESS'];
                break;
            case '101':
            case '102':
            case '103':
                $message = ($this->inTestMode($response)) ? $response_message : $this->messages['DECLINED'];
                break;
            case (bool) preg_match("/^2[0-9][0-9]/", $result, $matches):
                $message = $this->messages['BANK_ERROR'];
                break;
            case (bool) preg_match("/^3[0-9][0-9]/", $result, $matches):
                $message = $this->messages['REALEX_ERROR'];
                break;
            case (bool) preg_match("/^5[0-9][0-9]/", $result, $matches):
                $message = $response_message;
                break;
            case '600':
            case '601':
            case '602':
                $message = $this->messages['ERROR'];
                break;
            case '666':
                $message = $this->messages['CLIENT_DEACTIVATED'];
                break;
            default:
                $message = $this->messages['DECLINED'];
                break;
        }

        return $message;
    }