feat: refactoring of xml parsers
This commit is contained in:
@@ -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,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user