/home/techb158/ileadtechnology.com/SSM/vendor/nexmo/client-core/src/Redact
Edit: /home/techb158/ileadtechnology.com/SSM/vendor/nexmo/client-core/src/Redact/Client.php (2211B)
getClient()->getApiUrl() . '/v1/redact/transaction',
'POST',
'php://temp',
[
'Accept' => 'application/json',
'Content-Type' => 'application/json'
]
);
$body = ['id' => $id, 'product' => $product] + $options;
$request->getBody()->write(json_encode($body));
$response = $this->client->send($request);
$rawBody = $response->getBody()->getContents();
if ('204' != $response->getStatusCode()) {
throw $this->getException($response);
}
return null;
}
protected function getException(ResponseInterface $response)
{
$response->getBody()->rewind();
$body = json_decode($response->getBody()->getContents(), true);
$status = $response->getStatusCode();
$msg = 'Unexpected error';
// This is an error at the load balancer, likely auth related
if (isset($body['error_title'])) {
$msg = $body['error_title'];
}
if (isset($body['title'])) {
$msg = $body['title'];
if (isset($body['detail'])) {
$msg .= ' - '.$body['detail'];
}
$msg .= '. See '.$body['type'];
}
if ($status >= 400 && $status < 500) {
$e = new Exception\Request($msg, $status);
$response->getBody()->rewind();
$e->setEntity($response);
} elseif ($status >= 500 && $status < 600) {
$e = new Exception\Server($msg, $status);
$response->getBody()->rewind();
$e->setEntity($response);
} else {
$e = new Exception\Exception('Unexpected HTTP Status Code');
throw $e;
}
return $e;
}
}