src/TransactionService.php
public function checkCredentials()
    {
        try {
            $requestHeader = array_merge_recursive($this->httpHeader, $this->config->getShopHeader());

            $request = $this->messageFactory->createRequest(
                'GET',
                $this->config->getBaseUrl() . '/engine/rest/merchants/',
                $requestHeader
            );
            $request = $this->basicAuth->authenticate($request);
            $responseCode = $this->httpClient->sendRequest($request)->getStatusCode();
        } catch (TransferException $e) {
            $this->getLogger()->debug('Check credentials: Error - ' . $e->getMessage());
            return false;
        }

        if ($responseCode === 404) {
            $this->getLogger()->debug('Check credentials: Valid');
            return true;
        }

        $this->getLogger()->debug('Check credentials: Invalid - Received status code: ' . $responseCode);
        return false;
    }
public function checkCredentials()
    {
        try {
            $requestHeader = array_merge_recursive($this->httpHeader, $this->config->getShopHeader());

            $request = $this->messageFactory->createRequest(
                'GET',
                $this->config->getBaseUrl() . '/engine/rest/merchants/',
                $requestHeader
            );
            $request = $this->basicAuth->authenticate($request);
            $responseCode = $this->httpClient->sendRequest($request)->getStatusCode();
        } catch (TransferException $e) {
            $this->getLogger()->debug('Check credentials: Error - ' . $e->getMessage());
            return false;
        }

        if ($responseCode === 404) {
            $this->getLogger()->debug('Check credentials: Valid');
            return true;
        }

        $this->getLogger()->debug('Check credentials: Invalid - Received status code: ' . $responseCode);
        return false;
    }
public function checkCredentials ( ) { try { $ requestHeader = array_merge_recursive ( $ this -> httpHeader , $ this -> config -> getShopHeader ( ) ) ; $ request = $ this -> messageFactory -> createRequest ( 'GET' , $ this -> config -> getBaseUrl ( ) . '/engine/rest/merchants/' , $ requestHeader ) ; $ request = $ this -> basicAuth -> authenticate ( $ request ) ; $ responseCode = $ this -> httpClient -> sendRequest ( $ request ) -> getStatusCode ( ) ; } catch ( TransferException $ e ) { $ this -> getLogger ( ) -> debug ( 'Check credentials: Error - ' . $ e -> getMessage ( ) ) ; return false ; } if ( $ responseCode === 404 ) { $ this -> getLogger ( ) -> debug ( 'Check credentials: Valid' ) ; return true ; } $ this -> getLogger ( ) -> debug ( 'Check credentials: Invalid - Received status code: ' . $ responseCode ) ; return false ; }
We expect status code 404 for a successful authentication, otherwise the endpoint will return 401 unauthorized
@return boolean
@throws \Http\Client\Exception
We expect status code 404 for a successful authentication otherwise the endpoint will return 401 unauthorized