wip: finalize implementation
This commit is contained in:
@@ -17,6 +17,7 @@ services:
|
||||
$xmlDump: '@xml_dump.storage'
|
||||
$travelInfoBaseUrl: '%env(APP_TRAVEL_INFO_BASE_URL)%'
|
||||
$logger: '@monolog.logger.core'
|
||||
$environment: '%kernel.environment%'
|
||||
|
||||
# makes classes in src/ available to be used as services
|
||||
# this creates a service per class whose id is the fully-qualified class name
|
||||
|
||||
@@ -222,6 +222,8 @@ class ApiClient
|
||||
*/
|
||||
public function createBookingInquiry(BookingDto $bookingDto, bool $debug = false): Notification|BookingResponse
|
||||
{
|
||||
// Forcibly override booking status to generate inquiry payload
|
||||
$bookingDto->bookingStatus = 'A';
|
||||
$payload = $this->bookingDataProcessor->createBookingRequestPayload($bookingDto, 'Anfrage');
|
||||
|
||||
$data = [
|
||||
|
||||
@@ -66,8 +66,7 @@ class Step3Controller extends AbstractController
|
||||
|
||||
if (true === $form->isSubmitted() && true === $form->isValid()) {
|
||||
try {
|
||||
// Validate booking data with API (inquiry)
|
||||
$bookingCreateDto->bookingStatus = 'A';
|
||||
// Validate booking data with API by submitting an inquiry booking
|
||||
$inquiryResponse = $this->apiClient->createBookingInquiry($bookingCreateDto);
|
||||
|
||||
if ($inquiryResponse instanceof Notification) {
|
||||
|
||||
@@ -26,6 +26,7 @@ class AppExtension extends AbstractExtension
|
||||
return [
|
||||
new TwigFunction('icon', [AppRuntime::class, 'renderIcon'], ['needs_environment' => true, 'is_safe' => ['html']]),
|
||||
new TwigFunction('is_participant_eligible', [AppRuntime::class, 'isParticipantEligible']),
|
||||
new TwigFunction('qa_attribute', [AppRuntime::class, 'renderQaAttribute'], ['is_safe' => ['html']]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
private readonly IntlExtension $intlExtension,
|
||||
private readonly CountryDataProvider $countryDataProvider,
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly string $environment,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -101,4 +102,25 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
{
|
||||
return $this->participantEligibilityService->isParticipantEligible($bookingDto, $participantIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a QA attribute for testing purposes.
|
||||
*
|
||||
* @param string $label The label for the QA attribute
|
||||
* @param string|null $value The value for the QA attribute
|
||||
*
|
||||
* @return string The rendered QA attribute
|
||||
*/
|
||||
public function renderQaAttribute(string $label, ?string $value = null): string
|
||||
{
|
||||
if ('prod' === $this->environment) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return sprintf(' data-qa-%s', strtolower($label));
|
||||
}
|
||||
|
||||
return sprintf(' data-qa-%s="%s"', strtolower($label), $value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
'attr': {
|
||||
'hx-post': path('app_booking_create_step_1_refresh'),
|
||||
'hx-swap': 'none',
|
||||
'hx-trigger': 'change'
|
||||
'hx-trigger': 'change',
|
||||
}
|
||||
}) }}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user