public function commit($method, $url, $params = [], $options = [])
    {
        if (empty($this->connectionToken)) {
            $this->loginApplication();
        }

        $request = [
            'exceptions'      => false,
            'timeout'         => '80',
            'connect_timeout' => '30',
            'headers'         => [
                'Content-Type'  => 'application/json',
                'Accept'        => 'application/json',
                'Authorization' => 'Bearer '.$this->connectionToken,
            ],
        ];

        if (!empty($params)) {
            $request[$method === 'get' ? 'query' : 'json'] = $params;
        }

        $raw = $this->getHttpClient()->{$method}($url, $request);
        $statusCode = $raw->getStatusCode();

        $response = $statusCode == 200
            ? $this->parseResponse($raw->getBody())
            : $this->responseError($raw->getBody(), $statusCode);

        return $this->respond($response);
    }
public function commit($method, $url, $params = [], $options = [])
    {
        if (empty($this->connectionToken)) {
            $this->loginApplication();
        }

        $request = [
            'exceptions'      => false,
            'timeout'         => '80',
            'connect_timeout' => '30',
            'headers'         => [
                'Content-Type'  => 'application/json',
                'Accept'        => 'application/json',
                'Authorization' => 'Bearer '.$this->connectionToken,
            ],
        ];

        if (!empty($params)) {
            $request[$method === 'get' ? 'query' : 'json'] = $params;
        }

        $raw = $this->getHttpClient()->{$method}($url, $request);
        $statusCode = $raw->getStatusCode();

        $response = $statusCode == 200
            ? $this->parseResponse($raw->getBody())
            : $this->responseError($raw->getBody(), $statusCode);

        return $this->respond($response);
    }
public function commit ( $ method , $ url , $ params = [ ] , $ options = [ ] ) { if ( empty ( $ this -> connectionToken ) ) { $ this -> loginApplication ( ) ; } $ request = [ 'exceptions' => false , 'timeout' => '80' , 'connect_timeout' => '30' , 'headers' => [ 'Content-Type' => 'application/json' , 'Accept' => 'application/json' , 'Authorization' => 'Bearer ' . $ this -> connectionToken , ] , ] ; if ( ! empty ( $ params ) ) { $ request [ $ method === 'get' ? 'query' : 'json' ] = $ params ; } $ raw = $ this -> getHttpClient ( ) -> { $ method } ( $ url , $ request ) ; $ statusCode = $ raw -> getStatusCode ( ) ; $ response = $ statusCode == 200 ? $ this -> parseResponse ( $ raw -> getBody ( ) ) : $ this -> responseError ( $ raw -> getBody ( ) , $ statusCode ) ; return $ this -> respond ( $ response ) ; }
Commit an http request.

@param string $method
@param string $url
@param array  $params
@param array  $options

@return \Shoperti\PayMe\Contracts\ResponseInterface
Commit an http request .