src/Shop/BaseConfigForm.php
protected function checkAccountSettings()
    {
        // Check if we can retrieve a picklist. This indicates if the account
        // settings are correct.
        $message = '';
        $credentials = $this->acumulusConfig->getCredentials();
        if (!empty($credentials[Tag::ContractCode]) && !empty($credentials[Tag::UserName]) && !empty($credentials[Tag::Password])) {
            $this->about = $this->service->getAbout();
            if ($this->about->hasError()) {
                $message = $this->about->hasCode(401) ? 'message_error_auth' : ($this->about->hasCode(403) ? 'message_error_forb' : 'message_error_comm');
                $this->addErrorMessages($this->about->getExceptionMessage());
                $this->addErrorMessages($this->about->getErrors(Result::Format_PlainTextArray));
                $this->addWarningMessages($this->about->getWarnings(Result::Format_PlainTextArray));
            } elseif ($this->about->hasCode(553)) {
                // Role has been deprecated role for use with the API.
                $this->addWarningMessages($this->t('message_warning_role_deprecated'));
            } else {
                // Check role for sufficient rights but no overkill.
                $response = $this->about->getResponse();
                $roleId = (int) $response['roleid'];
                if ($roleId === Api::RoleApiCreator) {
                    $this->addWarningMessages($this->t('message_warning_role_insufficient'));
                } elseif ($roleId === Api::RoleApiManager) {
                    $this->addWarningMessages($this->t('message_warning_role_overkill'));
                }
            }
        } else {
            // First fill in your account details.
            $message = 'message_auth_unknown';
        }

        // Translate and format message.
        if (!empty($message)) {
            $formType = $this->isAdvancedConfigForm() ? 'advanced' : 'config';
            $message = sprintf($this->t($message), $this->t("message_error_arg1_$formType"), $this->t("message_error_arg2_$formType"));
        }

        return $message;
    }
protected function checkAccountSettings()
    {
        // Check if we can retrieve a picklist. This indicates if the account
        // settings are correct.
        $message = '';
        $credentials = $this->acumulusConfig->getCredentials();
        if (!empty($credentials[Tag::ContractCode]) && !empty($credentials[Tag::UserName]) && !empty($credentials[Tag::Password])) {
            $this->about = $this->service->getAbout();
            if ($this->about->hasError()) {
                $message = $this->about->hasCode(401) ? 'message_error_auth' : ($this->about->hasCode(403) ? 'message_error_forb' : 'message_error_comm');
                $this->addErrorMessages($this->about->getExceptionMessage());
                $this->addErrorMessages($this->about->getErrors(Result::Format_PlainTextArray));
                $this->addWarningMessages($this->about->getWarnings(Result::Format_PlainTextArray));
            } elseif ($this->about->hasCode(553)) {
                // Role has been deprecated role for use with the API.
                $this->addWarningMessages($this->t('message_warning_role_deprecated'));
            } else {
                // Check role for sufficient rights but no overkill.
                $response = $this->about->getResponse();
                $roleId = (int) $response['roleid'];
                if ($roleId === Api::RoleApiCreator) {
                    $this->addWarningMessages($this->t('message_warning_role_insufficient'));
                } elseif ($roleId === Api::RoleApiManager) {
                    $this->addWarningMessages($this->t('message_warning_role_overkill'));
                }
            }
        } else {
            // First fill in your account details.
            $message = 'message_auth_unknown';
        }

        // Translate and format message.
        if (!empty($message)) {
            $formType = $this->isAdvancedConfigForm() ? 'advanced' : 'config';
            $message = sprintf($this->t($message), $this->t("message_error_arg1_$formType"), $this->t("message_error_arg2_$formType"));
        }

        return $message;
    }
protected function checkAccountSettings ( ) { // Check if we can retrieve a picklist. This indicates if the account // settings are correct. $ message = '' ; $ credentials = $ this -> acumulusConfig -> getCredentials ( ) ; if ( ! empty ( $ credentials [ Tag :: ContractCode ] ) && ! empty ( $ credentials [ Tag :: UserName ] ) && ! empty ( $ credentials [ Tag :: Password ] ) ) { $ this -> about = $ this -> service -> getAbout ( ) ; if ( $ this -> about -> hasError ( ) ) { $ message = $ this -> about -> hasCode ( 401 ) ? 'message_error_auth' : ( $ this -> about -> hasCode ( 403 ) ? 'message_error_forb' : 'message_error_comm' ) ; $ this -> addErrorMessages ( $ this -> about -> getExceptionMessage ( ) ) ; $ this -> addErrorMessages ( $ this -> about -> getErrors ( Result :: Format_PlainTextArray ) ) ; $ this -> addWarningMessages ( $ this -> about -> getWarnings ( Result :: Format_PlainTextArray ) ) ; } elseif ( $ this -> about -> hasCode ( 553 ) ) { // Role has been deprecated role for use with the API. $ this -> addWarningMessages ( $ this -> t ( 'message_warning_role_deprecated' ) ) ; } else { // Check role for sufficient rights but no overkill. $ response = $ this -> about -> getResponse ( ) ; $ roleId = ( int ) $ response [ 'roleid' ] ; if ( $ roleId === Api :: RoleApiCreator ) { $ this -> addWarningMessages ( $ this -> t ( 'message_warning_role_insufficient' ) ) ; } elseif ( $ roleId === Api :: RoleApiManager ) { $ this -> addWarningMessages ( $ this -> t ( 'message_warning_role_overkill' ) ) ; } } } else { // First fill in your account details. $ message = 'message_auth_unknown' ; } // Translate and format message. if ( ! empty ( $ message ) ) { $ formType = $ this -> isAdvancedConfigForm ( ) ? 'advanced' : 'config' ; $ message = sprintf ( $ this -> t ( $ message ) , $ this -> t ( "message_error_arg1_$formType" ) , $ this -> t ( "message_error_arg2_$formType" ) ) ; } return $ message ; }
Checks the account settings for correctness and sufficient authorization.

This is done by calling the about API call and checking the result.

@return string
Message to show in the 2nd and 3rd fieldset. Empty if successful.
Checks the account settings for correctness and sufficient authorization .