MangoPay/Libraries/RestTool.php
public function Request($urlMethod, $requestType, $requestData = null, $idempotencyKey = null, & $pagination = null, $additionalUrlParams = null)
    {
        $this->_requestType = $requestType;
        $this->_requestData = $requestData;
        if (strpos($urlMethod, 'consult') !== false
            && (strpos($urlMethod, 'KYC/documents') !== false || strpos($urlMethod, 'dispute-documents') !== false)) {
            $this->_requestData = "";
        }
        $logClass = $this->_root->Config->LogClass;
        $this->logger->debug("New request");
        if ($this->_root->Config->DebugMode) {
            $logClass::Debug('++++++++++++++++++++++ New request ++++++++++++++++++++++', '');
        }
        $this->BuildRequest($urlMethod, $pagination, $additionalUrlParams, $idempotencyKey);
        $responseResult = $this->_root->getHttpClient()->Request($this);
        $logClass = $this->_root->Config->LogClass;
        $this->logger->debug('Response JSON : ' . print_r($responseResult->Body, true));
        if ($this->_root->Config->DebugMode) {
            $logClass::Debug('Response JSON', $responseResult->Body);
        }
        // FIXME This can fail hard.
        $response = json_decode($responseResult->Body);
        $this->logger->debug('Decoded object : ' . print_r($response, true));
        if ($this->_root->Config->DebugMode) {
            $logClass::Debug('Response object', $response);
        }
        $this->CheckResponseCode($responseResult->ResponseCode, $response);
        $this->ReadResponseHeader($responseResult->Headers);
        if (!is_null($pagination)) {
            $pagination = $this->_pagination;
        }
        return $response;
    }
public function Request($urlMethod, $requestType, $requestData = null, $idempotencyKey = null, & $pagination = null, $additionalUrlParams = null)
    {
        $this->_requestType = $requestType;
        $this->_requestData = $requestData;
        if (strpos($urlMethod, 'consult') !== false
            && (strpos($urlMethod, 'KYC/documents') !== false || strpos($urlMethod, 'dispute-documents') !== false)) {
            $this->_requestData = "";
        }
        $logClass = $this->_root->Config->LogClass;
        $this->logger->debug("New request");
        if ($this->_root->Config->DebugMode) {
            $logClass::Debug('++++++++++++++++++++++ New request ++++++++++++++++++++++', '');
        }
        $this->BuildRequest($urlMethod, $pagination, $additionalUrlParams, $idempotencyKey);
        $responseResult = $this->_root->getHttpClient()->Request($this);
        $logClass = $this->_root->Config->LogClass;
        $this->logger->debug('Response JSON : ' . print_r($responseResult->Body, true));
        if ($this->_root->Config->DebugMode) {
            $logClass::Debug('Response JSON', $responseResult->Body);
        }
        // FIXME This can fail hard.
        $response = json_decode($responseResult->Body);
        $this->logger->debug('Decoded object : ' . print_r($response, true));
        if ($this->_root->Config->DebugMode) {
            $logClass::Debug('Response object', $response);
        }
        $this->CheckResponseCode($responseResult->ResponseCode, $response);
        $this->ReadResponseHeader($responseResult->Headers);
        if (!is_null($pagination)) {
            $pagination = $this->_pagination;
        }
        return $response;
    }
public function Request ( $ urlMethod , $ requestType , $ requestData = null , $ idempotencyKey = null , & $ pagination = null , $ additionalUrlParams = null ) { $ this -> _requestType = $ requestType ; $ this -> _requestData = $ requestData ; if ( strpos ( $ urlMethod , 'consult' ) !== false && ( strpos ( $ urlMethod , 'KYC/documents' ) !== false || strpos ( $ urlMethod , 'dispute-documents' ) !== false ) ) { $ this -> _requestData = "" ; } $ logClass = $ this -> _root -> Config -> LogClass ; $ this -> logger -> debug ( "New request" ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( '++++++++++++++++++++++ New request ++++++++++++++++++++++' , '' ) ; } $ this -> BuildRequest ( $ urlMethod , $ pagination , $ additionalUrlParams , $ idempotencyKey ) ; $ responseResult = $ this -> _root -> getHttpClient ( ) -> Request ( $ this ) ; $ logClass = $ this -> _root -> Config -> LogClass ; $ this -> logger -> debug ( 'Response JSON : ' . print_r ( $ responseResult -> Body , true ) ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'Response JSON' , $ responseResult -> Body ) ; } // FIXME This can fail hard. $ response = json_decode ( $ responseResult -> Body ) ; $ this -> logger -> debug ( 'Decoded object : ' . print_r ( $ response , true ) ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'Response object' , $ response ) ; } $ this -> CheckResponseCode ( $ responseResult -> ResponseCode , $ response ) ; $ this -> ReadResponseHeader ( $ responseResult -> Headers ) ; if ( ! is_null ( $ pagination ) ) { $ pagination = $ this -> _pagination ; } return $ response ; }
Call request to MangoPay API
@param string $urlMethod Type of method in REST API
@param \MangoPay\Libraries\RequestType $requestType Type of request
@param array $requestData Data to send in request
@param string $idempotencyKey
@param \MangoPay\Pagination $pagination Pagination object
@param array $additionalUrlParams with additional parameters to URL. Expected keys: "sort" and "filter"
@return object Response data
Call request to MangoPay API