feat: refactoring of xml parsers

This commit is contained in:
Björn Fromme
2025-01-24 17:10:49 +01:00
parent 11f1508640
commit 6730c243f6
49 changed files with 1414 additions and 1235 deletions
+6 -7
View File
@@ -2,7 +2,7 @@
namespace App\BusProNet;
use App\BusProNet\ApiResponseParser\ResponseParser;
use App\BusProNet\XmlParser\ApiResponseParser;
use App\BusProNet\DataProcessor\BookingDataProcessor;
use App\BusProNet\Exception\ApiClientException;
use App\BusProNet\Exception\ResponseParserException;
@@ -34,9 +34,9 @@ class ApiClient
public function __construct(
private readonly SerializerInterface $serializer,
private readonly ResponseParser $responseParser,
private readonly LoggerInterface $logger,
array $options
private readonly ApiResponseParser $responseParser,
private readonly LoggerInterface $logger,
array $options
) {
$this->config = $this->resolveOptions($options);
}
@@ -180,16 +180,15 @@ class ApiClient
* @throws ApiClientException
* @throws ResponseParserException
*/
public function updateBooking(BookingData $formData, bool $dryRun = true): Notification|BookingUpdate
public function updateBooking(BookingData $formData): Notification|BookingUpdate
{
$mode = $dryRun ? 'Anfrage' : 'Buchung';
$payload = (new BookingDataProcessor())->createUpdateRequestPayload($formData);
$data = [
'user' => $this->config['bpn_username'],
'key' => $this->createKey($this->config['bpn_username'], $this->config['bpn_password'], static::TYPE_BOOKING_UPDATE),
'satz' => ['@typ' => static::TYPE_BOOKING_UPDATE],
'buchungsart' => $mode,
'buchungsart' => 'Buchung',
...$payload,
];