public function commit($method, $url, $params = [], $options = [])
    {
        $request = $this->requestTemplate;

        $token = Arr::get($options, 'token');

        if (!$token) {
            // there are some methods that do not have $options argument
            $token = Arr::get($params, 'token');
            if ($token) {
                unset($params['token']);
            }
        }

        // on IPN we need to send content as form params
        $payloadKey = $method === 'post'
            ? (strpos($url, 'https://ipnpb.') === 0 ? 'form_params' : 'json')
            : 'query';

        $request['headers']['Authorization'] = "Bearer {$token}";
        $request[$payloadKey] = $params;

        $rawResponse = $this->getHttpClient()->$method($url, $request);

        $response = $this->responseToArray($rawResponse);

        $response = $this->respond($response, $params, $options, $rawResponse->getStatusCode());

        return $response;
    }
public function commit($method, $url, $params = [], $options = [])
    {
        $request = $this->requestTemplate;

        $token = Arr::get($options, 'token');

        if (!$token) {
            // there are some methods that do not have $options argument
            $token = Arr::get($params, 'token');
            if ($token) {
                unset($params['token']);
            }
        }

        // on IPN we need to send content as form params
        $payloadKey = $method === 'post'
            ? (strpos($url, 'https://ipnpb.') === 0 ? 'form_params' : 'json')
            : 'query';

        $request['headers']['Authorization'] = "Bearer {$token}";
        $request[$payloadKey] = $params;

        $rawResponse = $this->getHttpClient()->$method($url, $request);

        $response = $this->responseToArray($rawResponse);

        $response = $this->respond($response, $params, $options, $rawResponse->getStatusCode());

        return $response;
    }
public function commit ( $ method , $ url , $ params = [ ] , $ options = [ ] ) { $ request = $ this -> requestTemplate ; $ token = Arr :: get ( $ options , 'token' ) ; if ( ! $ token ) { // there are some methods that do not have $options argument $ token = Arr :: get ( $ params , 'token' ) ; if ( $ token ) { unset ( $ params [ 'token' ] ) ; } } // on IPN we need to send content as form params $ payloadKey = $ method === 'post' ? ( strpos ( $ url , 'https://ipnpb.' ) === 0 ? 'form_params' : 'json' ) : 'query' ; $ request [ 'headers' ] [ 'Authorization' ] = "Bearer {$token}" ; $ request [ $ payloadKey ] = $ params ; $ rawResponse = $ this -> getHttpClient ( ) -> $ method ( $ url , $ request ) ; $ response = $ this -> responseToArray ( $ rawResponse ) ; $ response = $ this -> respond ( $ response , $ params , $ options , $ rawResponse -> getStatusCode ( ) ) ; return $ response ; }
Commit an HTTP request.

@param string   $method
@param string   $url
@param string[] $params
@param string[] $options

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