ThreeScaleClient::authrep PHP Method

authrep() public method

Authorize and report in a single shot.
See also: ThreeScaleAuthorizeResponse (which is derived from ThreeScaleResponse) and contains additional information about the usage status.
See also: ThreeScaleResponse
See also: ThreeScaleAuthorizeResponse
public authrep ( $appId, $appKey = null, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null ) : ThreeScaleResponse
$appId application id.
$appKey secret application key.
return ThreeScaleResponse object containing additional authorization information. If both provider key and application id are valid, the returned object is actually
    public function authrep($appId, $appKey = null, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null)
    {
        $url = "http://" . $this->getHost() . "/transactions/authrep.xml";
        $params = array('provider_key' => $this->getProviderKey(), 'app_id' => $appId);
        if ($appKey) {
            $params['app_key'] = $appKey;
        }
        if ($userId) {
            $params['user_id'] = $userId;
        }
        if ($object) {
            $params['object'] = $object;
        }
        if ($usage) {
            $params['usage'] = $usage;
        }
        if ($no_body) {
            $params['no_body'] = $no_body;
        }
        if ($serviceId) {
            $params['service_id'] = $serviceId;
        }
        $httpResponse = $this->httpClient->get($url, $params);
        if (self::isHttpSuccess($httpResponse)) {
            return $this->buildAuthorizeResponse($httpResponse->body);
        } else {
            return $this->processError($httpResponse);
        }
    }