public function send($endpoint, $payload)
{
try {
$request = $this->messageFactory->createRequest('POST', $endpoint, ['Content-Type' => 'text/xml; charset=UTF-8'], $payload);
$response = $this->client->sendRequest($request);
if ($response->getStatusCode() !== 200) {
throw HttpException::httpError($response->getReasonPhrase(), $response->getStatusCode());
}
return (string) $response->getBody();
} catch (PsrHttpException $e) {
$response = $e->getResponse();
throw HttpException::httpError($response->getReasonPhrase(), $response->getStatusCode());
} catch (ClientException $e) {
throw TransportException::transportError($e);
}
}