private function OAuth2APICall($baseURL, $queryParameters, $HttpMethod, $requestUri, $requestParameters, $requestBody, $throwExceptionOnError){
        $AuthorizationHeader = $this->getOAuth2AuthorizationHeader($this->context->requestValidator);
        //We only support QBO for PHP SDK. No QBD support, change
        // from: if ('QBO'==$this->context->serviceType || 'QBD'==$this->context->serviceType)
        if (CoreConstants::IntuitServicesTypeQBO ==$this->context->serviceType) {
            // IDS call
            $httpHeaders = $this->setCommonHeadersForPHPSDK($AuthorizationHeader, $requestUri, $requestParameters->ContentType, $requestBody);
            // Log Request Body to a file
            $this->LogAPIRequestToLog($requestBody, $requestUri, $httpHeaders);
        } else {
             throw new SdkException("IPP or other Call is not supported in OAuth2 Mode.");
        }

        $intuitResponse = $this->httpClientInterface->makeAPICall($requestUri, $HttpMethod, $httpHeaders,  $requestBody, null, true);
        $faultHandler = $intuitResponse->getFaultHandler();
        $this->LogAPIResponseToLog($intuitResponse->getBody(), $requestUri, $intuitResponse->getHeaders());
        //Based on the ducomentation, the fetch expected HTTP/1.1 20X or a redirect. If not, any 3xx, 4xx or 5xx will throw an OAuth Exception
        //for 3xx without direct, it will throw a 503 code and error saying: Invalid protected resource url, unable to generate signature base string
        if($faultHandler) {
            if($throwExceptionOnError == true){
                throw new ServiceException("Request is not made successful. Response Code:[" . $faultHandler->getHttpStatusCode() . "] with body: [" . $faultHandler->getResponseBody() . "].", $faultHandler->getHttpStatusCode());
            }else{
                $this->faultHandler = $faultHandler;
                return null;
            }
        }else{
            $this->faultHandler = false;
        }
        return array($intuitResponse->getStatusCode(),$intuitResponse->getBody());
    }
private function OAuth2APICall($baseURL, $queryParameters, $HttpMethod, $requestUri, $requestParameters, $requestBody, $throwExceptionOnError){
        $AuthorizationHeader = $this->getOAuth2AuthorizationHeader($this->context->requestValidator);
        //We only support QBO for PHP SDK. No QBD support, change
        // from: if ('QBO'==$this->context->serviceType || 'QBD'==$this->context->serviceType)
        if (CoreConstants::IntuitServicesTypeQBO ==$this->context->serviceType) {
            // IDS call
            $httpHeaders = $this->setCommonHeadersForPHPSDK($AuthorizationHeader, $requestUri, $requestParameters->ContentType, $requestBody);
            // Log Request Body to a file
            $this->LogAPIRequestToLog($requestBody, $requestUri, $httpHeaders);
        } else {
             throw new SdkException("IPP or other Call is not supported in OAuth2 Mode.");
        }

        $intuitResponse = $this->httpClientInterface->makeAPICall($requestUri, $HttpMethod, $httpHeaders,  $requestBody, null, true);
        $faultHandler = $intuitResponse->getFaultHandler();
        $this->LogAPIResponseToLog($intuitResponse->getBody(), $requestUri, $intuitResponse->getHeaders());
        //Based on the ducomentation, the fetch expected HTTP/1.1 20X or a redirect. If not, any 3xx, 4xx or 5xx will throw an OAuth Exception
        //for 3xx without direct, it will throw a 503 code and error saying: Invalid protected resource url, unable to generate signature base string
        if($faultHandler) {
            if($throwExceptionOnError == true){
                throw new ServiceException("Request is not made successful. Response Code:[" . $faultHandler->getHttpStatusCode() . "] with body: [" . $faultHandler->getResponseBody() . "].", $faultHandler->getHttpStatusCode());
            }else{
                $this->faultHandler = $faultHandler;
                return null;
            }
        }else{
            $this->faultHandler = false;
        }
        return array($intuitResponse->getStatusCode(),$intuitResponse->getBody());
    }
private function OAuth2APICall ( $ baseURL , $ queryParameters , $ HttpMethod , $ requestUri , $ requestParameters , $ requestBody , $ throwExceptionOnError ) { $ AuthorizationHeader = $ this -> getOAuth2AuthorizationHeader ( $ this -> context -> requestValidator ) ; //We only support QBO for PHP SDK. No QBD support, change // from: if ('QBO'==$this->context->serviceType || 'QBD'==$this->context->serviceType) if ( CoreConstants :: IntuitServicesTypeQBO == $ this -> context -> serviceType ) { // IDS call $ httpHeaders = $ this -> setCommonHeadersForPHPSDK ( $ AuthorizationHeader , $ requestUri , $ requestParameters -> ContentType , $ requestBody ) ; // Log Request Body to a file $ this -> LogAPIRequestToLog ( $ requestBody , $ requestUri , $ httpHeaders ) ; } else { throw new SdkException ( "IPP or other Call is not supported in OAuth2 Mode." ) ; } $ intuitResponse = $ this -> httpClientInterface -> makeAPICall ( $ requestUri , $ HttpMethod , $ httpHeaders , $ requestBody , null , true ) ; $ faultHandler = $ intuitResponse -> getFaultHandler ( ) ; $ this -> LogAPIResponseToLog ( $ intuitResponse -> getBody ( ) , $ requestUri , $ intuitResponse -> getHeaders ( ) ) ; //Based on the ducomentation, the fetch expected HTTP/1.1 20X or a redirect. If not, any 3xx, 4xx or 5xx will throw an OAuth Exception //for 3xx without direct, it will throw a 503 code and error saying: Invalid protected resource url, unable to generate signature base string if ( $ faultHandler ) { if ( $ throwExceptionOnError == true ) { throw new ServiceException ( "Request is not made successful. Response Code:[" . $ faultHandler -> getHttpStatusCode ( ) . "] with body: [" . $ faultHandler -> getResponseBody ( ) . "]." , $ faultHandler -> getHttpStatusCode ( ) ) ; } else { $ this -> faultHandler = $ faultHandler ; return null ; } } else { $ this -> faultHandler = false ; } return array ( $ intuitResponse -> getStatusCode ( ) , $ intuitResponse -> getBody ( ) ) ; }
The OAuth 2 API call

@param  String           $baseURL               The request url without queryParameters
@param  Array            $queryParameters       A list of query parameters
@param  String           $HttpMethod            POST or GET
@param  String           $requestUri            The Complete HTTP request URI
@param  Array            $requestParameters     The Complete HTTP request URI
@param  String           $requestBody           The request body for POST request.
@param  Boolean          $throwExceptionOnError If throw an exception whent he return http status is not 200. Default is false

@return array|null Response and HTTP Status code
The OAuth 2 API call