WIP: Implement Admin CRUD

This commit is contained in:
Björn Fromme
2023-09-21 17:51:16 +02:00
parent 2dd8a6de19
commit c3c2e1ae2d
26 changed files with 568 additions and 20 deletions
+35
View File
@@ -208,6 +208,41 @@ class ApiClient
});
}
public function getPickups(): BaseResponse
{
return $this->cache->get('bpn_pickups', function (ItemInterface $item) {
$item->expiresAfter(3600);
$data = [
'anfrage' => [
'user' => $this->config['bpn_username'],
'key' => $this->createKey($this->config['bpn_username'], $this->config['bpn_password'], 'STAMMZUSTIEGE'),
'satz' => ['@typ' => 'STAMMZUSTIEGE'],
],
];
$body = $this
->serializer
->serialize($data, 'xml');
try {
$response = $this->httpClient->request('GET', $this->config['bpn_url'], [
'query' => [
'operation' => $body,
]
]);
$xml = $response->getContent();
return $this->responseParser->parseXmlString($xml);
} catch (\Throwable $e) {
}
$this->logger->error('API error', ['error' => $e->getMessage()]);
throw new ApiClientException($e->getMessage());
});
}
private function createKey(string $username, string $password, string $type): string
{
$date = (new \DateTimeImmutable())->format('Ymd');