fix: respect environment variable to toggle BPN debug mode

This commit is contained in:
Björn Fromme
2025-09-02 08:40:17 +02:00
parent 76aeb101bd
commit 1c2421fb7e
4 changed files with 10 additions and 6 deletions
+1
View File
@@ -6,6 +6,7 @@
parameters: parameters:
travel_info_base_url: '%env(APP_TRAVEL_INFO_BASE_URL)%' travel_info_base_url: '%env(APP_TRAVEL_INFO_BASE_URL)%'
path_to_keys: '%kernel.project_dir%/config/secret' path_to_keys: '%kernel.project_dir%/config/secret'
bpn_debug: '%env(APP_BPN_DEBUG)%'
services: services:
# default configuration for services in *this* file # default configuration for services in *this* file
+5 -4
View File
@@ -121,7 +121,7 @@ class ApiClient
'adressdaten' => $personalData->toPayload(), 'adressdaten' => $personalData->toPayload(),
]; ];
return $this->sendRequest(static::TYPE_CUSTOMER_DATA, $data, $debug); return $this->sendRequest(static::TYPE_CUSTOMER_DATA, $data);
} }
/** /**
@@ -184,7 +184,7 @@ class ApiClient
/** /**
* @throws ApiClientException * @throws ApiClientException
*/ */
public function updateBooking(BookingData $formData, bool $debug = false): Notification|BookingUpdate public function updateBooking(BookingData $formData): Notification|BookingUpdate
{ {
$payload = (new BookingDataProcessor())->createUpdateRequestPayload($formData); $payload = (new BookingDataProcessor())->createUpdateRequestPayload($formData);
@@ -196,7 +196,7 @@ class ApiClient
...$payload, ...$payload,
]; ];
return $this->sendRequest(static::TYPE_BOOKING_UPDATE, $data, $debug); return $this->sendRequest(static::TYPE_BOOKING_UPDATE, $data);
} }
/** /**
@@ -282,9 +282,10 @@ class ApiClient
/** /**
* @throws ApiClientException * @throws ApiClientException
*/ */
private function sendRequest(string $type, array $data, bool $debug = false): mixed private function sendRequest(string $type, array $data): mixed
{ {
$requestId = date(DATE_ATOM).uniqid(); $requestId = date(DATE_ATOM).uniqid();
$debug = $this->config['debug'];
$body = $this $body = $this
->serializer ->serializer
+3 -1
View File
@@ -146,6 +146,8 @@ class Booking
public function isEditable(): bool public function isEditable(): bool
{ {
return $this->travelDate > new \DateTimeImmutable() && false === in_array($this->status, ['S', 'U']); $now = new \DateTimeImmutable();
return $this->travelDate > $now && false === in_array($this->status, ['S', 'U']);
} }
} }
+1 -1
View File
@@ -105,7 +105,7 @@ class EditController extends AbstractController
]); ]);
try { try {
$response = $this->apiClient->updateBooking($formData, true); $response = $this->apiClient->updateBooking($formData);
if ($response instanceof Notification) { if ($response instanceof Notification) {
if (true === $response->isError()) { if (true === $response->isError()) {
$this->addFlash('error', $response->message); $this->addFlash('error', $response->message);