Compare commits

..
Author SHA1 Message Date
Björn Fromme 03cb74370b fix: enforce submit-time immutability, scope booking cache per user 2026-03-16 11:20:05 +01:00
Björn Fromme d05524222b chore: update test to recent changes 2026-03-16 11:20:05 +01:00
Björn Fromme c02b1b57c7 fix: reduce mutability data cache ttl to avoid staleness
addresses #869cdzmkq
2026-03-16 11:20:05 +01:00
Björn Fromme efff024196 fix: ensure mutability is accounted for when restoring drafts
addresses #869cdzmkq
2026-03-16 11:20:05 +01:00
Björn Fromme 021671a45f fix: assign mandatory services when applying dummy data 2026-03-07 12:46:56 +01:00
Björn Fromme 744cf55a7e chore: update project dependencies 2026-03-07 12:38:10 +01:00
Björn Fromme f2c12a9f03 feat: update wording 2026-03-04 12:43:49 +01:00
Björn Fromme 5cf4b0f9ea feat: shortened and filename-safe request ids 2026-03-04 11:25:23 +01:00
Björn Fromme 370bc9fc5f fix: ensure pickups node exists in api payload 2026-03-04 11:09:41 +01:00
Björn Fromme a1d43b9c5a fix: ensure drop-offs are submitted when same as pickups 2026-03-04 10:48:57 +01:00
Björn Fromme 90fc66277e feat: anonymization command for request/response XML dumps 2026-03-04 10:47:20 +01:00
Björn Fromme cd5d353158 chore: update project dependencies 2026-03-02 11:57:46 +01:00
Björn Fromme 590146be9e feat: adopt new pickups planning payload JSON structure 2026-03-02 11:55:57 +01:00
Björn Fromme 8e2c688641 chore: cleanup 2026-02-25 17:17:21 +01:00
Björn Fromme f705a851c2 fix: validate mandatory services selection 2026-02-25 17:09:13 +01:00
Björn Fromme d33ff9779c fix: correctly validate pickup selection
closes #869c94jqn
2026-02-25 16:55:22 +01:00
Björn Fromme 876cd5a8fa fix: don't restore selections from draft for immutable fields 2026-02-24 18:16:52 +01:00
Björn Fromme 5a64c85fb6 fix: enforce mutability checks for all fields 2026-02-24 11:53:00 +01:00
Björn Fromme 31153e90b4 chore: remove dead code 2026-02-24 11:27:53 +01:00
Björn Fromme 949bea723d chore: add git ignored temp directory 2026-02-24 11:27:41 +01:00
Björn Fromme 0365daa57b feat: avoid indexing of content by crawlers 2026-02-23 09:45:22 +01:00
Björn Fromme 3996e02dd9 feat: use normalized checkbox values in field handlers 2026-02-23 09:31:19 +01:00
Björn Fromme bd488211bd chore: update plan for symfony 7.4 upgrade 2026-02-23 09:11:15 +01:00
Björn Fromme ca34d4a4f3 chore: update project dependencies 2026-02-23 08:59:35 +01:00
Björn Fromme a93a8469c4 chore: remove claude code entirely 2026-02-23 08:49:32 +01:00
Björn Fromme cec481741b fix: prevent race conditions in htmx boost response handling 2026-02-20 17:24:20 +01:00
Björn Fromme 39bacd2927 fix: ensure loading indicator when entering booking flow in Chrome 2026-02-20 17:23:56 +01:00
Björn Fromme 39972c1418 fix: avoid selection trap for mandatory services with age constraints 2026-02-20 17:06:43 +01:00
Björn Fromme 45cfc459aa fix: always fill-in empty participants names when submitting to api 2026-02-20 09:48:22 +01:00
Björn Fromme 21356f00d5 chore: update project dependencies 2026-02-19 12:57:09 +01:00
Björn Fromme 4529fe5472 fix: correct sort order of pickups and drop-offs 2026-02-19 12:56:06 +01:00
Björn Fromme 08aaff1e2d fix: show pickup select field for outbound bus travel only 2026-02-19 08:22:52 +01:00
Björn Fromme 0884a39f3d feat: selectable drop-offs for inbound bus travel 2026-02-17 11:53:39 +01:00
Björn Fromme 41b0f56b5b chore: split scheduler config for prod and staging 2026-02-17 11:53:14 +01:00
Björn Fromme b034b8c7f8 chore: update project dependencies 2026-02-17 08:57:07 +01:00
Björn Fromme a4cae4f321 fix: handle empty api responses more gracefully 2026-02-17 08:55:49 +01:00
Björn Fromme ab67f9d7b5 feat: legal links in page footer 2026-02-16 09:09:28 +01:00
Björn Fromme a22688c87e fix: catch unexpected api response for personal data 2026-02-15 12:57:03 +01:00
Björn Fromme cfc52a9cf3 fix: backward compatibility for new session format 2026-02-15 12:55:48 +01:00
Björn Fromme 33e09bbe89 fix: correctly determine file size and avoid type mismatch 2026-02-14 16:09:21 +01:00
Björn Fromme a339f8a517 feat: show booking status in sidebar 2026-02-14 16:04:54 +01:00
Björn Fromme abeb91b59f feat: dummy data fill
closes #869c3khk0
2026-02-14 15:56:56 +01:00
Björn Fromme 350a9e6742 chore: update project dependencies 2026-02-14 09:49:38 +01:00
Björn Fromme c373a98953 feat: reduce session payload 2026-02-14 09:47:14 +01:00
Björn Fromme 3863999f2a chore: use correct database type to replicate prod environment 2026-02-13 20:22:29 +01:00
Björn Fromme 54410628b4 chore: add staging environment to deployer config 2026-02-13 13:45:41 +01:00
Björn Fromme 2c3ce32282 fix: correct room assignment and count
closes #869c2jnzr
2026-02-09 11:00:36 +01:00
Björn Fromme dd03cdd77f chore: align node and npm versions of DDEV with host, use npm ci 2026-02-05 18:07:43 +01:00
Björn Fromme bc8d4f74c1 feat: fill default names for canceled participants in agency bookings 2026-02-05 17:57:35 +01:00
Björn Fromme 6f869bdb1a chore: update frontend tooling 2026-02-05 17:56:36 +01:00
Björn Fromme 6adc0769c7 chore: code cleanup 2026-02-05 17:45:54 +01:00
Björn Fromme 2f9930a240 feat: update personal data of canceled participants as well
addresses #869bze0kq
2026-02-05 11:23:25 +01:00
Björn Fromme 3036a7773c chore: update project dependencies 2026-02-05 10:30:01 +01:00
Björn Fromme e668c2d882 feat: revert allow updating room assignments in edit mode 2026-02-05 10:29:34 +01:00
Björn Fromme bb4768c491 chore: update platform specs in composer.json for prod 2026-01-30 17:46:51 +01:00
Björn Fromme 9140e4f3fc chore: update project dependencies 2026-01-30 17:29:56 +01:00
Björn Fromme 6b205c7a86 fix: allow updating room assignments in edit mode 2026-01-30 17:29:26 +01:00
Björn Fromme 0aa4bb5055 chore: streamline namespacing 2026-01-30 16:10:29 +01:00
Björn Fromme ee3b1f47a7 chore: update project dependencies 2026-01-29 16:25:35 +01:00
Björn Fromme 40da2ecaf3 fix: enforce profile completion of applicant in all situations 2026-01-29 16:24:27 +01:00
Björn Fromme 5d0ba0ef9a fix: ensure complete participant data even when canceled 2026-01-29 12:57:37 +01:00
Björn Fromme 786a4306dd chore: update project dependencies 2026-01-28 19:41:28 +01:00
Björn Fromme 677ffc7368 fix: streamline datalayer integration for all events 2026-01-28 19:40:48 +01:00
Björn Fromme 93eb08c610 fix: properly initialize CMP, GTM and data layer for tracking 2026-01-27 21:25:03 +01:00
Björn Fromme 6365e4b24c feat: remove street from hotel address in sidebar
addresses #869bwq1vh
2026-01-27 18:36:03 +01:00
Björn Fromme e138fbeca8 chore: update frontend dependencies 2026-01-27 18:29:59 +01:00
Björn Fromme d29a6a1835 chore: update project dependencies 2026-01-27 18:26:15 +01:00
Björn Fromme dc91660488 feat: require all personal data fields for registration 2026-01-27 18:25:38 +01:00
Björn Fromme e9548d9f38 feat: tracking integration with GTM and CMP 2026-01-27 17:31:41 +01:00
Björn Fromme d5944bf717 feat: domain-based theme-detection 2026-01-27 11:18:37 +01:00
Björn Fromme 2355442ac0 chore: update database and php versions to match prod environment 2026-01-26 08:24:19 +01:00
Björn Fromme 789555078d chore: update deployer config for new hosting environment 2026-01-25 13:53:43 +01:00
Björn Fromme 34f190f469 fix: don't normalize hotel and product codes when fetching cms data 2026-01-23 15:35:24 +01:00
Björn Fromme 8646c4ffdd chore: update project url in ddev 2026-01-23 13:05:48 +01:00
Björn Fromme 419d3b78c6 chore: update project dependencies 2026-01-23 12:54:07 +01:00
Björn Fromme e8df7d193e feat: display error codes in admin overview 2026-01-23 11:15:46 +01:00
Björn Fromme aa08307500 feat: error-codes in flash messages to reference log entries 2026-01-23 11:06:24 +01:00
Björn Fromme c41524c1fd feat: user-friendly error messages on login 2026-01-23 10:30:17 +01:00
Björn Fromme 8dec0be375 feat: streamlined flash messages 2026-01-23 10:15:44 +01:00
Björn Fromme 9471abce94 fix: revert pickup pricing to match current BusPro behavior
Reverts split pricing calculation to use outbound-only pricing,
matching BusPro's current behavior where pickup is only charged when
outbound transportation is BUS.

- Use pickup->price directly instead of calculateEffectivePrice()
- PKW+BUS scenario now correctly charges €0 (matches BusPro loophole)
- priceOutbound/priceInbound remain populated for future activation
- Updated documentation with current behavior and future plan
2026-01-21 17:18:09 +01:00
Björn Fromme 2aeed762fd feat: extensible participant status determination for booking creation
Adds a rule-based system to determine participant status in CREATE
payloads. Participants selecting a 'Begleitperson' service now receive
status 'O' (Option), all others default to 'F' (Final).

- Add ParticipantStatusRuleInterface for defining status rules
- Add ParticipantStatusRuleRegistry for priority-based rule evaluation
- Add ChaperonServiceStatusRule for Begleitperson detection
- Integrate status evaluation into BookingPayloadBuilder
2026-01-21 10:16:57 +01:00
Björn Fromme 512b63b88b feat: infotext for insurance booking conditions
closes #869bvcu2p
2026-01-21 09:33:36 +01:00
Björn Fromme 92d7eac3a1 chore: update httpclient config to use random values for contactform 2026-01-21 09:02:47 +01:00
Björn Fromme 548b8a8ef0 feat: log contact form submissions 2026-01-21 08:43:28 +01:00
Björn Fromme fb8aabe34c chore: remove debug logging in toast controller 2026-01-21 08:11:36 +01:00
Björn Fromme 0c1f143b12 feat: info text and correct field type for service group 'VEG'
addresses #869bvch71
2026-01-20 18:36:33 +01:00
Björn Fromme 24ac2efc53 fix: don't hide voucher fields for booking status 'O'
closes #869bvbkrd
2026-01-20 16:06:17 +01:00
Björn Fromme e7a139b025 chore: update test to fix deprecation warning 2026-01-20 16:05:48 +01:00
Björn Fromme cfe19b7a74 chore: update project dependencies 2026-01-20 16:05:28 +01:00
Björn Fromme f725a6b72f feat: ignored room types
closes #869bvbmcw
2026-01-20 15:52:57 +01:00
Björn Fromme a097159897 feat: move profile completeness check from login to booking flow entry
- Add profileComplete flag to User entity to avoid API calls
- Set flag during login (BpnAuthenticator) and profile save
- Check flag in IndexController when entering booking flow
- Remove ProfileCompletionSubscriber (no longer needed)

Users with incomplete profiles are only redirected when starting
a new booking, not on every login. Eliminates extra API call by
caching completeness status on the user entity.
2026-01-19 18:55:55 +01:00
Björn Fromme da33620ea9 chore: update alert wording to be more descriptive 2026-01-19 18:06:29 +01:00
Björn Fromme 0b44394b11 feat: enforce profile data completeness before entering booking flow 2026-01-19 18:04:19 +01:00
Björn Fromme 2949870acc feat: allow editing of nationality in personal data 2026-01-19 17:12:26 +01:00
Björn Fromme 35c289240d fix: default participant's nationality to German to avoid missing data 2026-01-19 17:12:12 +01:00
Björn Fromme 3b165bf292 chore: update rsync excludes in deployer config 2026-01-19 16:17:35 +01:00
Björn Fromme f0c43a17d8 feat: body dimensions mandatory with selected rentals, updated help text
feat: body dimensions mandatory with selected rentals
2026-01-19 16:12:53 +01:00
Björn Fromme 2776429639 fix: preserve selected services from booking even when unavailable
When editing a booking, services that were previously booked but are no
longer available in the travel catalog were being dropped. This caused
API error 650 ("Anzahl Leistung stimmt nicht mit Teilnehmerzuordnung
überein") because the service participant counts no longer matched.

The fix ensures that in edit mode, booked services are merged with
travel data services in both:
- Form rendering (ParticipantFieldOptionsProvider): so checkboxes appear
- Handler validation (AbstractParticipantFieldHandler): so selections
  are accepted

This allows users to keep their existing service selections or
deliberately replace them with other available options. Create mode
remains unchanged.
2026-01-19 15:51:39 +01:00
Björn Fromme 5c9f8c2a2e doc: add technical documentation 2026-01-17 19:27:06 +01:00
Björn Fromme 3e6533829c fix: ensure unique services mapping when creating api payload 2026-01-16 14:22:17 +01:00
Björn Fromme 054505d853 feat: match modes for room selection condition to detect MBZ*
addresses #869btdcyh
2026-01-15 11:02:27 +01:00
Björn Fromme c793550af5 feat: improved logic to control field visibility
addresses #869btdphv
2026-01-15 10:28:26 +01:00
Björn Fromme b18fccff9d fix: correctly handle discounts applied by dpn api 2026-01-14 17:46:15 +01:00
Björn Fromme 398eb448cb feat: cli command to download travel xml data from buspro api 2026-01-14 16:57:17 +01:00
Björn Fromme 6cdede138e fix: correct body dimensions values 2026-01-14 16:07:30 +01:00
Björn Fromme 3046aad94d fix: account for discounts applied by bpn api in validation request 2026-01-14 12:47:25 +01:00
Björn Fromme ec2ce6ec62 feat: revert room price fetching for performance reasons 2026-01-13 15:54:54 +01:00
Björn Fromme 3c61e7eaf3 feat: trigger form refresh for dob when completely entered only 2026-01-13 15:37:05 +01:00
Björn Fromme f942600dd8 fix: fetch fresh room prices from api to avoid calculation mismatch 2026-01-13 15:14:27 +01:00
Björn Fromme efacbf64cb fix: consider booking status O correctly 2026-01-13 14:42:51 +01:00
Björn Fromme e38445f184 fix: correctly compare age range 2026-01-13 14:42:35 +01:00
Björn Fromme 00803b2e73 feat: always load fresh api data when starting to edit booking 2026-01-13 13:16:35 +01:00
Björn Fromme a52f65919f chore: update project dependencies 2026-01-13 10:22:25 +01:00
Björn Fromme 3d4d88e986 feat: xlsx export of booking edit draft data for admins 2026-01-13 10:22:03 +01:00
Björn Fromme 5221cea53b feat: merge draft data with api response for selected fields 2026-01-12 18:25:51 +01:00
Björn Fromme 7636ee41af fix: ensure nationality is assigned when editing booking data 2026-01-12 18:23:52 +01:00
Björn Fromme 830fd2464c fix: avoid reinstallation of claude code with each restart of ddev 2026-01-11 13:35:50 +01:00
Björn Fromme d922fd2b9c chore: update project dependencies 2026-01-11 13:26:02 +01:00
Björn Fromme d22078b26e fix: populate booking number with edit drafts 2026-01-11 13:25:13 +01:00
Björn Fromme 195af95995 feat: integrate with easy admin bundle 2026-01-11 13:24:07 +01:00
Björn Fromme d95d0a8930 feat: streamlined booking number property 2026-01-10 12:12:54 +01:00
Björn Fromme 6fca40963d wip: integrate with easy admin bundle 2026-01-10 11:35:16 +01:00
Björn Fromme ace251c1dd feat: cleanup favicons 2026-01-10 11:34:46 +01:00
Björn Fromme db2e92c058 feat: custom hx redirect class 2026-01-10 11:32:14 +01:00
Björn Fromme 28b62f5071 feat: adjust xml dump reader command to new filename format 2026-01-10 11:31:24 +01:00
Björn Fromme 168c128b1d chore: update claude code installation in ddev container 2026-01-09 18:07:45 +01:00
Björn Fromme 90af012e56 chore: update lts upgrade plan with current state of the project 2026-01-09 16:34:46 +01:00
Björn Fromme d6c36b4171 chore: simplify and update claude code installation in ddev container 2026-01-09 16:25:43 +01:00
Björn Fromme 9575aad10c feat: always allow editing of participants for internal bookings
Prior to this commit the mutability flag from BusProNet was evaluated
and would potentially conflict with this rule. This flag is now
completely ignored for internal bookings.
2026-01-09 13:37:22 +01:00
Björn Fromme 7b98cccbe9 fix: add suffix to request id in xml-dump filenames to avoid overwrites 2026-01-09 13:28:04 +01:00
Björn Fromme fe2268c897 feat: cleanup, log successful bookings 2026-01-09 10:05:21 +01:00
Björn Fromme f2c1988d75 chore: add draft cleanup command to schedule 2026-01-09 09:49:35 +01:00
Björn Fromme 5b9f35eddc fix: use correct property path for travel date determination 2026-01-09 09:46:29 +01:00
Björn Fromme c8ed5b2cc7 feat: cli command to backfill travel dates on draft records, single use 2026-01-09 09:39:35 +01:00
Björn Fromme da517b37b6 feat: cli command to clean up outdated or stale booking draft records 2026-01-09 09:22:51 +01:00
Björn Fromme 0992c05539 fix: don't update booking session and draft on form refresh
Each form refresh would create a draft even for users that just explore
booking options causing stale draft records in the database.
2026-01-09 09:22:18 +01:00
Björn Fromme ed8a8a2f8b feat: streamlined display of hotel image, name and address 2026-01-08 17:51:39 +01:00
Björn Fromme 5516ef45f6 chore: update project dependencies 2026-01-08 16:43:16 +01:00
Björn Fromme 6beb965c85 feat: new service category 'VEG' 2026-01-08 16:42:42 +01:00
Björn Fromme 479a88e131 chore: update httpclient config 2026-01-08 16:32:02 +01:00
Björn Fromme e4a1a992be feat: command to read xml-dumps from bpn api by provided request id 2026-01-08 14:23:22 +01:00
Björn Fromme 97a5d7f9f1 fix: include gender and nationality into group of mandatory fields 2026-01-08 14:18:37 +01:00
Björn Fromme 776b9d0912 feat: proper determination of agency initiated bookings
For booking that are agency initiated (groups) different rules apply
concerning mutability and requirement of personal data and whether the
first participant is the applicant or not. This commit adds logic to
evaluate the agency id assigned to the booking data to decide.
2026-01-08 12:54:59 +01:00
Björn Fromme df35ed3032 feat: log request ids to map xml dumps of bpn api communication 2026-01-08 10:17:00 +01:00
Björn Fromme 59b08ed098 fix: update draft together with session on refresh 2026-01-08 08:38:21 +01:00
Björn Fromme 936004bc2d fix: show actual error message 2026-01-07 20:30:58 +01:00
Björn Fromme 365658d727 fix: allow null argument for gender mapping 2026-01-07 20:00:51 +01:00
Björn Fromme d603e57c62 fix: insurance ids are strings 2026-01-07 19:50:41 +01:00
Björn Fromme 58ec94eaeb fix: exclude pickup surcharge when self-organized outbound 2026-01-07 19:45:12 +01:00
Björn Fromme 2f4184f60f fix: avoid float rounding errors when comparing 2026-01-07 18:46:28 +01:00
Björn Fromme b0b608f12e feat: load hotel data locally for sidebar 2026-01-07 18:35:09 +01:00
Björn Fromme 97be776b10 feat: default status of new bookings to option during beta phase
addresses #869bpb7fg
2026-01-07 17:55:38 +01:00
Björn Fromme ddb876bc1c fix: ensure rental insurance is selectable when insurance is available
addresses #869bp9ev5
2026-01-07 17:31:20 +01:00
Björn Fromme 6fee5c048a fix: correctly distinguish between first participant and applicant 2026-01-07 17:22:17 +01:00
Björn Fromme 80f22b7cd0 fix: don't include default date of birth in contact form submissions 2026-01-07 14:44:53 +01:00
Björn Fromme e1123577f4 feat: update field label 2026-01-07 11:36:08 +01:00
Björn Fromme 5f33f82b8b fix: redirect to dashboard as default when logged in 2026-01-07 10:15:27 +01:00
Björn Fromme 5285ded46f chore: revert claude code replacement with opencode 2026-01-07 09:27:59 +01:00
Björn Fromme 69df93b773 feat: load balancing of api requests, cleanup api client 2026-01-07 08:33:16 +01:00
Björn Fromme 1e3389e21a fix: properly handle parking service selection 2026-01-06 19:03:10 +01:00
Björn Fromme 192b1fdcf4 fix: add missing LoggerInterface dependency to BookingDataProcessorTest 2026-01-06 18:46:06 +01:00
Björn Fromme 6008a1b2d9 feat: retry api requests when closed immediately due to overload 2026-01-06 17:29:34 +01:00
Björn Fromme 62fc734f82 fix: avoid null pointer exceptions, log warning about removed services 2026-01-06 16:08:51 +01:00
Björn Fromme 7fb5466eb4 fix: avoid scrolling to the bottom when making a selection
closes #869bnn1bw
2026-01-06 15:34:25 +01:00
Björn Fromme aafac9d43b chore: update scheduler config 2026-01-06 15:01:08 +01:00
Björn Fromme 585f87e1f9 chore: reduce logger noise 2026-01-06 14:48:32 +01:00
Björn Fromme eb1d05aa10 fix: only assign dummy data to the applicant 2026-01-06 14:39:49 +01:00
Björn Fromme db1de2653c fix: assign dummy values to missing applicant data fields
This fix avoids rejection of API requests due to missing data of the
applicant. The current user most probably is not aware about this so
they get confused about the error messages otherwise.
2026-01-06 14:29:41 +01:00
Björn Fromme 8bdc33b4f0 feat: draft inspection cli command 2026-01-06 14:06:04 +01:00
Björn Fromme 1c1766bbd4 fix: apply correct return type and response handling 2026-01-06 14:05:51 +01:00
Björn Fromme 96205c14db fix: only invalidate cache and remove draft on successful edit 2026-01-06 13:53:49 +01:00
Björn Fromme 7ec4562064 chore: code cleanup 2026-01-06 12:38:51 +01:00
Björn Fromme 1eb1e9f02f fix: invalidate booking data caches after updating personal data 2026-01-06 12:24:07 +01:00
Björn Fromme 0b35b3494b fix: streamline price label for transportation services 2026-01-06 12:08:13 +01:00
Björn Fromme e021fc7570 feat: link terms in confirmation checkbox label 2026-01-06 11:56:03 +01:00
Björn Fromme 2a13a62291 feat: remove cancel confirmation since obsolete because of drafts 2026-01-06 10:44:30 +01:00
Björn Fromme 60c1459902 feat: automatic saving of drafts when editing bookings 2026-01-06 10:29:17 +01:00
Björn Fromme 97f8baba06 fix: adopt general styles to error page template 2026-01-06 08:34:24 +01:00
Björn Fromme 3ffa80e2bc chore: update deployer config 2026-01-06 08:30:56 +01:00
Björn Fromme ab1a21dffc chore: update project dependencies 2026-01-06 08:26:22 +01:00
Björn Fromme bccd8c6fc3 chore: merge master into feature branch 2026-01-05 18:25:14 +01:00
Björn Fromme 2ea298854d fix: restore .user.ini from master 2026-01-05 18:17:38 +01:00
Björn Fromme b7e4f29813 chore: update upgrade plan with current state of the project 2026-01-05 17:34:02 +01:00
Björn Fromme 7780646601 chore: replace claude code with opencode inside ddev container 2026-01-05 17:24:41 +01:00
Björn Fromme 0f58f07757 chore: update project dependencies 2026-01-05 17:20:44 +01:00
Björn Fromme ef263e064a feat: add env variable for website base url 2026-01-05 17:20:18 +01:00
Björn Fromme 7127b4d050 chore: install claude code in ddev container for security reasons 2025-12-31 14:02:53 +01:00
Björn Fromme 42744fa30f chore: complete scheduler config for email notifications 2025-12-22 11:07:56 +01:00
Björn Fromme be3f6e6288 feat: remove outdated log entries scheduled 2025-12-22 11:07:33 +01:00
Björn Fromme 9291adfdff fix: fail gracefully when remote XML data cannot be read during sync 2025-12-22 08:29:57 +01:00
Björn Fromme c9426eff3b fix: catch travel data not found errors to show proper flash message 2025-12-19 17:54:25 +01:00
Björn Fromme cd350c212e chore: update project dependencies 2025-12-19 17:29:33 +01:00
Björn Fromme 1f1ac1a0cc docs: add inline documentation where missing 2025-12-19 17:26:59 +01:00
Björn Fromme 2dd5b7ad64 chore: cleanup 2025-12-19 17:26:39 +01:00
Björn Fromme 62ac8038dc feat: cron controlled cli command to sync xml data with remote 2025-12-19 17:06:27 +01:00
Björn Fromme 5f94f0487b chore: cleanup flysystem config 2025-12-19 16:07:12 +01:00
Björn Fromme 64880355e8 chore: update json test-data for pickups planning 2025-12-17 17:16:41 +01:00
Björn Fromme 1dc8489239 fix: avoid duplicated pickup planning entries 2025-12-17 17:05:38 +01:00
Björn Fromme 5831294d33 chore: reduce noise in logs 2025-12-17 16:44:11 +01:00
Björn Fromme 073bbdc0f8 feat: add logging to api endpoint 2025-12-17 16:34:57 +01:00
Björn Fromme ef75383885 fix: don't show bulk insurance labels in summary 2025-12-17 16:04:19 +01:00
Björn Fromme bfb25a4051 feat: accept multiple travel codes per pickup planning 2025-12-17 14:23:05 +01:00
Björn Fromme f55febd545 chore: update project dependencies 2025-12-17 10:23:06 +01:00
Björn Fromme d27b78cec1 chore: rotate auth log 2025-12-17 10:22:37 +01:00
Björn Fromme 1bb145e3be feat: forcibly invalidate availabilities cache on booking start 2025-12-16 13:46:54 +01:00
Björn Fromme 59b9a42009 feat: loading indicator on initial page load 2025-12-16 13:44:25 +01:00
Björn Fromme a576fa2d23 fix: adopt changes in test 2025-12-16 13:31:06 +01:00
Björn Fromme 14fe9bd44f feat: load availability data once per booking session 2025-12-16 13:30:45 +01:00
Björn Fromme cce59b8ed6 chore: disable saving cookies for api requests 2025-12-16 12:23:40 +01:00
Björn Fromme 8904e1c7fe feat: log pickups planning data api calls 2025-12-16 12:17:41 +01:00
Björn Fromme a0f763af63 chore: update project dependencies 2025-12-16 09:59:15 +01:00
Björn Fromme 667c9d4677 chore: reduce logger noise 2025-12-14 17:17:19 +01:00
Björn Fromme 1622f2be6a chore: retain xml dumps for three days to save on webspace 2025-12-14 17:10:09 +01:00
Björn Fromme 28914d6586 feat: rotate auth logfile 2025-12-12 20:15:56 +01:00
Björn Fromme cfc3957fec chore: update project dependencies 2025-12-12 20:06:45 +01:00
Björn Fromme aee2eb848d fix: adopt changed response class 2025-12-12 20:06:19 +01:00
Björn Fromme 42f17db542 feat: extended oauth2 user info and refactored authenticator 2025-12-12 19:57:34 +01:00
Björn Fromme 6315fbd0f7 fix: ensure template variable exists 2025-12-12 19:46:48 +01:00
Björn Fromme 79e5a3c12d feat: adjust oauth2 implementation for TYPO3 backend login 2025-12-12 16:31:32 +01:00
Björn Fromme e9c1dd8b9d feat: basic themes for event sites 2025-12-12 13:13:36 +01:00
Björn Fromme b1ff6989ec feat: api endpoints for pickups planning 2025-12-12 09:44:38 +01:00
Björn Fromme 1d97a19982 feat: always show all available ski passes but readonly if age doesn't match 2025-12-12 08:47:25 +01:00
Björn Fromme c3519124b7 feat: update labels of voucher fields
addresses #869bf8tzv
2025-12-12 08:09:34 +01:00
Björn Fromme 05c769bab2 feat: use query parameters for booking urls 2025-12-11 16:14:31 +01:00
Björn Fromme c1539a47f9 fix: properly assign readonly state to form fields for unavailable services 2025-12-11 12:07:19 +01:00
Björn Fromme f54f66cd32 fix: reset room assignments after updated selection if required 2025-12-11 11:27:48 +01:00
Björn Fromme c8a33cdf43 fix: assign correct return types 2025-12-11 11:26:46 +01:00
Björn Fromme b4c03160ca feat: consistent display of included services and prices 2025-12-11 11:17:03 +01:00
Björn Fromme 72cd36a573 feat: enable logging for contact form api endpoint 2025-12-11 09:33:41 +01:00
Björn Fromme 4d3a4b7c04 chore: update project dependencies 2025-12-10 18:01:34 +01:00
Björn Fromme b9dfeb2d3e feat: backport contact form api endpoint 2025-12-10 18:00:51 +01:00
Björn Fromme e42ef2d3c9 feat: show unavailable transportation services as readonly 2025-12-10 17:15:05 +01:00
Björn Fromme bb69a28ec2 fix: don't show incorrect notification about updated rentals 2025-12-10 15:40:17 +01:00
Björn Fromme e8c2261b7e feat: show inquiry status with rooms in step 1 2025-12-10 15:33:13 +01:00
Björn Fromme 7665385cbf feat: hide parking from participants under 18 2025-12-10 14:37:06 +01:00
Björn Fromme 346dee23e4 fix: don't auto assign discounted transport to babies 2025-12-10 14:09:52 +01:00
Björn Fromme 109f36e7f5 chore: simplify parameter handling 2025-12-10 13:57:48 +01:00
Björn Fromme 0e9c5e6e1a feat: configurable choices for body dimensions
closes #8697phk21
2025-12-10 13:48:47 +01:00
Björn Fromme 145a08e511 chore: update deployer config for prod 2025-12-10 13:10:17 +01:00
Björn Fromme 2b8046b416 feat: re-implement contact form submissions api endpoint for website 2025-12-10 09:29:19 +01:00
Björn Fromme e27b5da3c8 feat: adjust participant number size depending on value 2025-12-09 20:52:12 +01:00
Björn Fromme 613e0b9a5c feat: update deployer config to build assets upfront 2025-12-09 20:48:36 +01:00
Björn Fromme 0564e3c424 feat: align rendering of pickups field with other services 2025-12-09 20:43:58 +01:00
Björn Fromme 32c73ab7b1 fix: avoid loading indicator issues when using browser history for navigation 2025-12-09 15:13:04 +01:00
Björn Fromme 420efb25ad chore: update project dependencies 2025-12-09 12:56:31 +01:00
Björn Fromme 150998e120 fix: ensure flash message is displayed after redirect 2025-12-09 12:55:23 +01:00
Björn Fromme 31f414b4d8 feat: show room prices in room assignment form field 2025-12-09 12:55:00 +01:00
Björn Fromme 9c6860ecc6 fix: account for htmx issues in mobile safari with select fields 2025-12-09 11:42:31 +01:00
Björn Fromme 6b32b6baa4 fix: disable autocomplete in chrome for good 2025-12-09 11:33:19 +01:00
Björn Fromme 3527be9c29 feat: various improvements in styles and layout 2025-12-09 11:20:43 +01:00
Björn Fromme 0239aee89a fix: avoid stale caches 2025-12-09 10:25:11 +01:00
Björn Fromme f21f4a0385 feat: streamlined rendering of fields as static text in forms 2025-12-09 10:20:55 +01:00
Björn Fromme fa2b5e0d7f feat: render room assignment as radio buttons 2025-12-09 10:05:14 +01:00
Björn Fromme 1ac7720765 feat: replace overly complex and unnecessary form choice loader for rooms 2025-12-09 09:32:01 +01:00
Björn Fromme 4182c30b72 fix: ensure footer bar is visible on mobile safari 2025-12-09 09:21:58 +01:00
Björn Fromme e4aad8a456 feat: load cms data early to display image on login page 2025-12-08 17:39:29 +01:00
Björn Fromme d78638e6e5 feat: improved layout for participant form 2025-12-08 17:08:26 +01:00
Björn Fromme 1726523eaf fix: disable autocompletion on personal data fields 2025-12-08 16:20:20 +01:00
Björn Fromme 1aa564960d feat: body dimensions optional 2025-12-08 16:18:31 +01:00
Björn Fromme cd2765bab5 feat: improved error handling and redirect on invalid session 2025-12-08 16:00:02 +01:00
Björn Fromme 390ee81675 feat: indicate incomplete participant data in cards 2025-12-08 15:59:35 +01:00
Björn Fromme 6dbbfd87f8 feat: special treatment of services for participants of age 0-2 2025-12-08 15:26:30 +01:00
Björn Fromme 118f86b2a0 feat: increase availability cache ttl and ensure fresh data when entering form 2025-12-08 14:57:12 +01:00
Björn Fromme 27d77624da docs: upgrade plan to symfony 7.4 2025-12-07 18:48:40 +01:00
Björn Fromme 20a67e9b96 feat: optional return url 2025-12-07 18:47:18 +01:00
Björn Fromme 233748a6c5 chore: cleanup 2025-12-07 15:03:54 +01:00
Björn Fromme 67491a7f68 fix: remove obsolete htmx attributes from forms 2025-12-07 15:03:44 +01:00
Björn Fromme c7129d5791 chore: cleanup 2025-12-07 14:47:51 +01:00
Björn Fromme 4abee677f6 fix: enforce https 2025-12-07 14:24:08 +01:00
Björn Fromme 21600dc2d6 feat: implement hx-boost for reliable loading indication 2025-12-07 14:11:50 +01:00
Björn Fromme f0b84c9943 fix: ensure loading indicator is triggered 2025-12-06 18:13:38 +01:00
Björn Fromme 59418adc02 chore: update project dependencies 2025-12-06 15:05:06 +01:00
Björn Fromme de52907eec fix: remove form options cache causing issues 2025-12-06 15:02:34 +01:00
Björn Fromme bfb1a04ea0 feat: implement screendesign 2025-12-06 15:02:33 +01:00
Björn Fromme b206c3990b chore: update project dependencies 2025-12-06 15:02:13 +01:00
Björn Fromme 54a37c5bf7 feat: adjust loading indicator styles 2025-12-06 15:02:13 +01:00
Björn Fromme fa98ceac29 fix: add loading indicator to all 'back' buttons 2025-12-06 15:02:13 +01:00
Björn Fromme 1bab230f10 fix: consider mode in summary 2025-12-06 15:02:13 +01:00
Björn Fromme 5b55d0984a fix: correctly handle email uniqueness by excluding the applicant from validation 2025-12-06 15:02:13 +01:00
Björn Fromme 2b3a8f1c69 feat: request replay command for bpn api 2025-12-06 15:02:13 +01:00
Björn Fromme 696800aafd feat: refactoring and cleanup 2025-12-06 15:02:13 +01:00
Björn Fromme e7997f84eb fix: include user ini for adjusted php settings on prod host 2025-12-05 10:03:51 +01:00
Björn Fromme 8d3a7b99b4 fix: prevent type errors 2025-12-01 10:41:04 +01:00
Björn Fromme 61a8afdde7 fix: prevent null reference errors 2025-12-01 10:38:55 +01:00
Björn Fromme 1f3e79d57c fix: prevent null reference errors 2025-12-01 10:37:39 +01:00
Björn Fromme f4691ec67e feat: finalize voucher handling and discount display in summary and overview 2025-11-26 17:29:15 +01:00
Björn Fromme 32bef9a4e9 feat: special treatment of participants with age 0-2 (babies) 2025-11-26 15:38:49 +01:00
Björn Fromme 30704f936a fix: don't disable room selection field with single option 2025-11-25 18:14:33 +01:00
Björn Fromme 9167c84b4c fix: clear target path when canceling booking flow 2025-11-25 17:34:10 +01:00
Björn Fromme f5f5d43ab5 feat: conditionally render room assignment field in participant edit form 2025-11-25 17:30:23 +01:00
Björn Fromme 9b2ad3845d feat: prevent selection of baby rooms without regular rooms 2025-11-25 16:43:41 +01:00
Björn Fromme e2513d6245 chore: update claude settings 2025-11-25 16:43:05 +01:00
Björn Fromme 126fce9687 feat: step input for room type selection 2025-11-25 16:42:39 +01:00
Björn Fromme c1364a458b fix: correctly determine number of participants 2025-11-25 16:42:13 +01:00
Björn Fromme ecc4741f56 feat: correct determination of inquiry status and conditional voucher field display 2025-11-25 16:41:25 +01:00
Björn Fromme f33e55f201 feat: correct handling of vouchers 2025-11-24 10:20:21 +01:00
Björn Fromme ce1b9ece09 feat: layout improvements 2025-11-21 12:44:06 +01:00
Björn Fromme 9d28d2f102 feat: improved promotional and purchase vouchers 2025-11-21 12:43:51 +01:00
Björn Fromme aaa7e9f4c3 feat: promotional and purchase vouchers 2025-11-20 18:41:46 +01:00
Björn Fromme 26681e5c62 feat: fetch additional content from cms via api 2025-11-20 15:42:41 +01:00
Björn Fromme 33c3dc6022 feat: sort pickups by their times 2025-11-17 10:00:03 +01:00
Björn Fromme a6b0051f1b chore: update project dependencies 2025-11-17 09:51:13 +01:00
Björn Fromme d0d1edb3ae feat: sort pickups by their times 2025-11-17 09:50:00 +01:00
Björn Fromme 6e96f6fb44 fix: never validate insurance selection in edit mode 2025-11-13 12:44:19 +01:00
Björn Fromme c6b28e7f4e fix: don't validate insurance selection of participants when in bulk assignment 2025-11-13 12:29:27 +01:00
Björn Fromme 3ce4d81a4c chore: update project dependencies 2025-11-13 11:36:52 +01:00
Björn Fromme d5c572c25b feat: loading indicators for regular get requests 2025-11-13 11:34:45 +01:00
Björn Fromme bcded403be feat: improved timeout handling for api client 2025-11-13 11:15:31 +01:00
Björn Fromme aeb25f3b7e feat: remove 'remember me' functionality from login form in booking process 2025-11-13 10:54:40 +01:00
Björn Fromme 421851cc4c feat: surcharges and discounts per participant and in summary 2025-11-13 09:30:49 +01:00
Björn Fromme 66eb392151 fix: check field existence before rendering 2025-11-11 15:45:14 +01:00
Björn Fromme beaccd93e0 fix: show rental insurance field only when applicable 2025-11-11 15:39:56 +01:00
Björn Fromme 111cda95f3 chore: update project dependencies 2025-11-11 15:13:15 +01:00
Björn Fromme 84ed41f325 fix: tooltips for form fields not showing 2025-11-11 15:12:28 +01:00
Björn Fromme e7cf172b9f feat: add subtypes PAR and LVS as bookable additional services 2025-11-11 14:14:44 +01:00
Björn Fromme e52cb98163 chore: update project dependencies 2025-11-07 10:39:39 +01:00
Björn Fromme d85e81e8b9 fix: ensure valid applicant data 2025-11-07 10:39:16 +01:00
Björn Fromme 1e5fe23159 fix: don't rely on individual prices being available for all participants 2025-11-06 15:32:39 +01:00
Björn Fromme 2f78ddb8ad fix: don't rely on individual prices being available for all participants 2025-11-06 15:24:51 +01:00
Björn Fromme f19762d686 chore: update project dependencies 2025-11-06 14:55:23 +01:00
Björn Fromme eba2f8e503 fix: skip availability check for services that are not included in API response 2025-11-06 14:55:00 +01:00
Björn Fromme 0a0bef9e82 feat: ensure inquiry info is always visible 2025-10-31 16:40:14 +01:00
Björn Fromme 29f415a91f feat: improved dynamic validation 2025-10-31 16:23:06 +01:00
Björn Fromme a619add4e3 fix: ensure validation of participant data 2025-10-31 15:07:22 +01:00
Björn Fromme 34a8d42fc3 fix: keep browser history intact when navigating between cards view and participant form 2025-10-31 12:46:37 +01:00
Björn Fromme cfd346d5df wip: integrate with typo3 to fetch product and hotel data 2025-10-28 16:13:07 +01:00
Björn Fromme 3d694ed7eb fix: streamlined single room selection handling 2025-10-28 16:12:27 +01:00
Björn Fromme 5021f414d1 feat: improved mutability checks for personal data in edit or create mode 2025-10-28 15:34:09 +01:00
Björn Fromme 51dbf20118 feat: improved handling of fields to be rendered as static text 2025-10-27 13:38:40 +01:00
Björn Fromme a50bd205cd chore: update project dependencies 2025-10-27 08:33:59 +01:00
Björn Fromme da7b4dfb48 fix: temporarily disable all participant validation 2025-10-27 08:31:39 +01:00
Björn Fromme eee7be0c1e feat: gravatar integration 2025-10-25 14:09:19 +02:00
Björn Fromme d55a201681 feat: integrate with scheduler bundle 2025-10-24 17:57:13 +02:00
Björn Fromme ba0eab9e96 fix: adapt changes in create mode for edit mode, cleanup 2025-10-24 17:30:41 +02:00
Björn Fromme b63804df88 feat: authenticated booking 2025-10-24 17:07:08 +02:00
Björn Fromme 647a25a78f feat: performance improvements 2025-10-24 15:21:15 +02:00
Björn Fromme 6b0dfb3426 chore: fix deprecations in preparation uf upgrading to symfony 7.3 2025-10-24 13:59:54 +02:00
Björn Fromme c8bb051ae6 fix: incorrect and unnecessary template inheritance 2025-10-24 12:32:16 +02:00
Björn Fromme b326510b04 chore: consolidate documentation 2025-10-24 12:17:42 +02:00
Björn Fromme 293574187f feat: price info tooltip for bulk insurance booking
addresses #869axbjzz
2025-10-24 11:23:19 +02:00
Björn Fromme b74f84e8ad feat: rearrange field order
addresses #869axbhz3
2025-10-24 09:32:16 +02:00
Björn Fromme 19a272db96 feat: group rentals and rental insurance fields visually
addresses #869ay16cp
2025-10-24 09:28:41 +02:00
Björn Fromme 67843c2f2e feat: dedicated section for discounts in summary
addresses #869ay1724
2025-10-24 09:19:34 +02:00
Björn Fromme a01e966d6d feat: automatic unselection of discounted transportation 2025-10-24 09:04:20 +02:00
Björn Fromme 9140b97a71 fix: improved position of info icon 2025-10-23 11:54:44 +02:00
Björn Fromme 405f03ee7a fix: adopt wrapper dto to dynamic form field 2025-10-23 11:38:34 +02:00
Björn Fromme b88ad24c3d feat: display service descriptions as tooltip with info icon
addresses #869axbnj0
2025-10-23 11:07:47 +02:00
Björn Fromme bb630da5ed feat: remove room selection field entirely for single room type
addresses #869axcukn
2025-10-23 10:49:14 +02:00
Björn Fromme 39d944351c chore: cleanup, update documentation 2025-10-23 10:29:37 +02:00
Björn Fromme 2b272ef789 fix: validation error indication on cards 2025-10-23 10:19:18 +02:00
Björn Fromme 3e54a58b9b wip: email uniqueness validation 2025-10-23 09:29:27 +02:00
Björn Fromme 60176d19f4 wip: improved validation and feedback 2025-10-23 08:50:45 +02:00
Björn Fromme 9c716477aa feat: unique email addresses of participants unless child, cleanup
addresses #869axbn21
2025-10-22 17:42:17 +02:00
Björn Fromme be2fffad23 feat: additional conformation checkbox for terms and conditions
addresses #869axbm44
2025-10-22 16:19:05 +02:00
Björn Fromme 34230e5520 feat: improved layout for pickup selection to make price visible
addresses #869axbjmd
2025-10-22 16:01:17 +02:00
Björn Fromme 1949bf9b97 feat: prefer discounted transportation services
addresses #869axbjbz
2025-10-22 15:53:54 +02:00
Björn Fromme 7ab60b1048 feat: improved form field layout for date of birth 2025-10-22 10:37:20 +02:00
Björn Fromme 0e6c31b8ce feat: show placeholders for individual date parts in date of birth field 2025-10-22 10:10:02 +02:00
Björn Fromme a2cfb693e0 feat: replace date field for participant's birthday 2025-10-22 10:02:30 +02:00
Björn Fromme 10df3ebb35 wip: implement e2e tests with cypress 2025-10-21 20:25:18 +02:00
Björn Fromme ab91c138d5 feat: unassign rooms from other participants when unavailable 2025-10-21 17:02:26 +02:00
Björn Fromme cc1d1e5746 feat: automatically assign rooms only for unique room type selection 2025-10-20 15:29:33 +02:00
Björn Fromme 8c75d0070d chore: update project dependencies 2025-10-20 10:23:34 +02:00
Björn Fromme 4df04d0504 chore: cleanup, updated docs 2025-10-20 09:32:54 +02:00
Björn Fromme 38bc594ca4 feat: consolidated insurance service 2025-10-20 09:22:03 +02:00
Björn Fromme fb9c9d91ee feat: integrate with spatie/ray for debugging and performance optimization 2025-10-20 08:08:17 +02:00
Björn Fromme ee69346eb4 feat: extended pricing breakdown on confirmation page 2025-10-18 17:59:42 +02:00
Björn Fromme e6c47019d5 fix: fix floating point precision error 2025-10-18 17:44:24 +02:00
Björn Fromme b894bbf5e6 chore: update documentation 2025-10-18 17:17:49 +02:00
Björn Fromme 0f8fed605c chore: adjust and cleanup tests 2025-10-18 17:15:31 +02:00
Björn Fromme 479b177e90 wip: bulk insurance refactoring 2025-10-18 16:39:57 +02:00
Björn Fromme 08210b8e52 wip: bulk insurance booking fix 2025-10-18 13:07:27 +02:00
Björn Fromme b5dfe17b73 wip: finalize implementation 2025-10-18 12:11:24 +02:00
Björn Fromme 49b5ccf308 wip: finalize implementation 2025-10-18 11:46:12 +02:00
Björn Fromme 434c4d0a11 wip: finalize implementation 2025-10-17 18:46:25 +02:00
Björn Fromme dc7ed0728a feat: readonly room selection for single room types 2025-10-16 09:36:04 +02:00
Björn Fromme b1dbb15ad7 feat: display booked insurance in edit mode 2025-10-16 09:35:30 +02:00
Björn Fromme e76170b6dd chore: remove debug statements 2025-10-16 09:35:12 +02:00
Björn Fromme 8225d4e92d fix: show feedback modal 2025-10-16 09:12:43 +02:00
Björn Fromme a5addf8d33 fix: adopt changed template name 2025-10-15 21:29:12 +02:00
Björn Fromme 0542a669bd fix: adjust deployer config 2025-10-15 18:32:49 +02:00
Björn Fromme 49b7a3fe34 feat: refactor to cards 2025-10-15 18:31:10 +02:00
Björn Fromme ead2c092da fix: ensure skipass is selected 2025-10-15 11:40:51 +02:00
Björn Fromme 6e818c3480 wip: refactor to cards with individual participant forms 2025-10-14 21:27:32 +02:00
Björn Fromme a02490ea36 wip: add documentation for plan 2025-10-14 20:30:51 +02:00
Björn Fromme 9eda12981a feat: htmx powered requests, improved loading indicator
feat: loading indicator and htmx form submit
2025-10-14 18:07:59 +02:00
Björn Fromme 4939a1a9ad feat: inquiry bookings 2025-10-09 18:52:23 +02:00
Björn Fromme 989f599b54 chore: remove outdated documentation 2025-10-09 18:51:58 +02:00
Björn Fromme 67c642bc2f wip: modernized edit flow, fix insurance tier calculation 2025-10-09 17:42:39 +02:00
Björn Fromme cba0f747cd wip: modernized edit flow 2025-10-08 21:09:53 +02:00
Björn Fromme c3008d7f7a wip: insurance booking in edit flow 2025-10-07 18:09:16 +02:00
Björn Fromme 7304fb50c6 fix: set correct default agency 2025-10-07 17:27:26 +02:00
Björn Fromme ec1bba7c46 wip: backport booking create flow form handling to edit flow 2025-10-07 16:38:55 +02:00
Björn Fromme b66d453881 feat: unify pickup selection 2025-10-06 18:07:07 +02:00
Björn Fromme b7b80296e9 feat: comprehensive booking overview for confirmation 2025-10-06 16:43:55 +02:00
Björn Fromme 2f582f0548 fix: use correct country tokens 2025-10-06 15:58:44 +02:00
Björn Fromme fad28c2442 chore: update project dependencies 2025-10-06 11:22:42 +02:00
Björn Fromme 7f1ef4059d wip: submit booking to api 2025-10-06 11:22:02 +02:00
Björn Fromme 139ec3c1db wip: confirmation step 2025-10-05 13:46:19 +02:00
Björn Fromme 798beae597 feat: implement payment step 2025-10-05 13:29:19 +02:00
Björn Fromme 3edf5a80aa fix: don't submit data of removed fields 2025-10-04 18:08:11 +02:00
Björn Fromme fc93b28af0 wip: backport form handing system from create flow to edit flow 2025-10-04 12:12:16 +02:00
Björn Fromme cd82b70139 fix: ignore past travels in list view when patching data 2025-10-04 11:49:36 +02:00
Björn Fromme fba9edc931 feat: inform user about automatic reassignments or reset selections 2025-10-02 17:57:56 +02:00
Björn Fromme 8e43edcbaf feat: insurance info urls in tooltips 2025-10-02 17:28:53 +02:00
Björn Fromme 8984b2edd5 feat: customizable label for unavailable services 2025-10-02 16:56:37 +02:00
Björn Fromme 32ec2c1deb feat: make room selection fields read-only for single room type 2025-10-02 16:40:18 +02:00
Björn Fromme 25029dff5d feat: extended insurance parsing, pass info urls to view 2025-10-02 16:32:50 +02:00
Björn Fromme 875b181aff fix: filter rentals by skipass duration 2025-10-02 14:42:04 +02:00
Björn Fromme 0f3d9b87fa feat: auto-assign rooms 2025-10-02 12:25:42 +02:00
Björn Fromme d7929dd855 wip: improved insurance selection 2025-10-02 12:11:23 +02:00
Björn Fromme 8a495346d6 wip: check eligibility based on ski pass availability 2025-10-01 18:52:50 +02:00
Björn Fromme fef4997132 chore: update docs 2025-10-01 17:57:39 +02:00
Björn Fromme b4eaf695c7 feat: bulk insurance booking by applicant 2025-10-01 17:52:21 +02:00
Björn Fromme 372490ed5a feat: improved form layout 2025-09-30 17:11:30 +02:00
Björn Fromme e37b6234e8 chore: remove debugging statements 2025-09-30 16:47:29 +02:00
Björn Fromme 71b42786f7 feat: show room pricing details 2025-09-30 16:47:17 +02:00
Björn Fromme 009eabd09c fix: layout improvements 2025-09-30 16:08:59 +02:00
Björn Fromme 49a4393980 fix: consider participant's age at travel date 2025-09-30 16:08:20 +02:00
Björn Fromme c0e20a15fe fix: ensure mandatory services are selected 2025-09-30 16:08:02 +02:00
Björn Fromme 061317ed4c wip: insurance booking 2025-09-30 15:13:20 +02:00
Björn Fromme a5dce776de wip: insurance booking 2025-09-30 14:37:49 +02:00
Björn Fromme 90ae78262a wip: insurance booking 2025-09-29 19:54:20 +02:00
Björn Fromme 0809f07d46 wip: insurance booking phase 5 2025-09-26 16:54:48 +02:00
Björn Fromme 199ef08e35 wip: insurance booking phase 4 2025-09-26 16:48:48 +02:00
Björn Fromme 4930a2ba42 wip: insurance booking phase 3 2025-09-26 16:46:04 +02:00
Björn Fromme 0ceabe465b wip: insurance booking phases 1 and 2 2025-09-26 16:34:32 +02:00
Björn Fromme bd7b70e465 feat: correct calculation and display of individual pricing 2025-09-26 15:32:22 +02:00
Björn Fromme 55a24b99f0 chore: update project dependencies 2025-09-26 09:01:32 +02:00
Björn Fromme 122df1a3f5 feat: improved error handling in controllers, cleanup 2025-09-26 09:00:40 +02:00
Björn Fromme 391dd63ebf feat: improved error handling of xml parsers and loaders 2025-09-26 08:21:57 +02:00
Björn Fromme 9d44197246 feat: parser and loader for insurance data 2025-09-24 15:28:43 +02:00
Björn Fromme 582fb9b52d feat: functionality to determine family status of a booking 2025-09-24 12:58:42 +02:00
Björn Fromme eed7ba4d7b feat: prevent booking flow without available rooms 2025-09-24 11:14:45 +02:00
Björn Fromme 5642193610 feat: validate room selection 2025-09-24 10:59:23 +02:00
Björn Fromme 1a1e120cf6 feat: render tooltips 2025-09-24 10:44:01 +02:00
Björn Fromme cf66b85993 feat: streamlined tooltip data attributes 2025-09-24 10:30:14 +02:00
Björn Fromme 8677e9a8a5 chore: update project dependencies 2025-09-22 17:37:11 +02:00
Björn Fromme 906f591979 feat: mark unavailable services as read-only and add tooltip 2025-09-22 17:36:49 +02:00
Björn Fromme 97cc0ac422 feat: simplify validation 2025-09-19 16:37:48 +02:00
Björn Fromme bdc7100f74 feat: simplify handling of ski pass service 2025-09-19 16:19:01 +02:00
Björn Fromme 29a51ed66d feat: cached api results for availabilities 2025-09-19 16:09:41 +02:00
Björn Fromme c9a258a350 chore: streamline property naming 2025-09-19 16:09:27 +02:00
Björn Fromme 096dd96db0 feat: enrich travel data with live availabilities 2025-09-19 12:40:20 +02:00
Björn Fromme ddd5971c06 feat: replace xss extension with symfony component 2025-09-19 12:40:02 +02:00
Björn Fromme b7638f5e9e fix: use correct ids for user validation 2025-09-10 16:26:58 +02:00
Björn Fromme b197152f12 feat: restrict access to booking edit and invoice to applicant 2025-09-10 15:30:36 +02:00
Björn Fromme 297becf7a0 fix: filter selectable services by participant's age 2025-09-10 15:25:30 +02:00
Björn Fromme b6f991b291 wip: skipass-duration based rentals filtering 2025-09-10 14:26:18 +02:00
Björn Fromme 5469c834a6 wip: transportation services with discount 2025-09-10 14:08:44 +02:00
Björn Fromme a3ea02a136 wip: service descriptions and car license plate field 2025-09-10 12:53:33 +02:00
Björn Fromme 195246af89 wip: rentals insurance field 2025-09-03 17:54:19 +02:00
Björn Fromme 2953ed0b2d wip: improved refresh logic 2025-09-03 16:48:23 +02:00
Björn Fromme ccb2fa75ac wip: transportation services in summary 2025-09-03 14:58:24 +02:00
Björn Fromme a33e6a0dd4 wip: update documentation 2025-09-02 20:09:29 +02:00
Björn Fromme 435e3a79e8 wip: dynamic availability of services 2025-09-02 20:03:22 +02:00
Björn Fromme 21054f0c45 wip: implement transportation, pickups and parking 2025-09-02 19:32:02 +02:00
Björn Fromme 605b6ca64c wip: transportation services 2025-09-02 18:28:51 +02:00
Björn Fromme bc9616e7de wip: prepare transportation services 2025-09-02 17:52:42 +02:00
Björn Fromme 491169b9d7 wip: update docs 2025-09-02 17:21:50 +02:00
Björn Fromme 0e0ce254a9 wip: show pricing 2025-09-02 16:59:55 +02:00
Björn Fromme 7b25fbf28b chore: adjust schedule for XML cleanup to run more often 2025-09-02 09:29:36 +02:00
Björn Fromme 2a5100e76d feat: update scheduler config 2025-09-02 08:51:12 +02:00
Björn Fromme e98695ea06 feat: integrate with zenstruck schedule bundle 2025-09-02 08:47:57 +02:00
Björn Fromme 1c2421fb7e fix: respect environment variable to toggle BPN debug mode 2025-09-02 08:40:17 +02:00
Björn Fromme 76aeb101bd chore: update project dependencies 2025-09-02 08:29:22 +02:00
Björn Fromme 60b655a195 wip: dynamic services fields 2025-08-27 17:49:49 +02:00
Björn Fromme 369d660e24 wip: age based filtering of options 2025-08-27 15:02:45 +02:00
Björn Fromme 47703dc205 wip: age based filtering of options 2025-08-27 13:46:00 +02:00
Björn Fromme 25bbf3d44f wip: age based filtering of options 2025-08-27 12:42:02 +02:00
Björn Fromme 803b10f981 chore: update project dependencies 2025-08-27 10:00:01 +02:00
Björn Fromme b992e4a5ea wip: conditional mandatory body dimensions 2025-07-25 21:47:00 +02:00
Björn Fromme 9c5597eb23 wip: additional services with constraints 2025-07-25 18:12:55 +02:00
Björn Fromme 2ec61d5086 wip: courses 2025-07-25 16:53:48 +02:00
Björn Fromme 8bae958e24 wip: booking process 2025-07-25 15:47:11 +02:00
Björn Fromme e7f0c09b36 wip: major refactoring 2025-07-25 11:54:07 +02:00
Björn Fromme ae2ed306b9 wip: form refactoring 2025-07-25 09:28:13 +02:00
Björn Fromme 2b122a7cc4 wip: improved booking summary 2025-07-24 12:44:38 +02:00
Björn Fromme 787e76c21c wip: refactor 2025-07-24 11:59:40 +02:00
Björn Fromme 7b1f2e7468 wip: booking summary for step 1 2025-07-24 11:59:27 +02:00
Björn Fromme 3f94c51bc8 wip: refactor 2025-07-24 11:12:06 +02:00
Björn Fromme 64d51c01b2 wip: refactor 2025-07-24 10:03:02 +02:00
Björn Fromme 955dbd2f05 fix: correct handling of readonly checkboxes with tooltips 2025-07-24 09:33:27 +02:00
Björn Fromme 318a326fdb chore: update browserslist 2025-07-24 09:33:05 +02:00
Björn Fromme 86223dc8a6 wip: field states and dependencies 2025-07-23 18:38:31 +02:00
Björn Fromme 4bb62830a4 wip: refactor forms 2025-07-23 18:10:27 +02:00
Björn Fromme 4ce731bfcb wip: refactor forms 2025-07-23 17:15:39 +02:00
Björn Fromme f225dac5fe wip: collapsible forms 2025-07-23 15:48:59 +02:00
Björn Fromme 5e1f2a8711 wip: refactor forms 2025-07-23 15:34:54 +02:00
Björn Fromme 8746397d83 wip: feedback about booked and assigned rooms 2025-07-23 11:39:03 +02:00
Björn Fromme e8c27cb51b wip: refactoring 2025-07-23 11:08:29 +02:00
Björn Fromme d2a80ea8fd wip: refactoring 2025-07-23 10:28:38 +02:00
Björn Fromme c85c72863c wip: refactoring 2025-07-23 10:27:04 +02:00
Björn Fromme 77afc0fe7b Merge branch 'master' into booking 2025-07-22 09:03:38 +02:00
Björn Fromme 7a53908b80 chore: update deployer config with extended rsync excludes 2025-07-22 09:02:47 +02:00
Björn Fromme ca4495169f Merge branch 'master' into booking 2025-07-22 08:59:19 +02:00
Björn Fromme d1344bbfb4 chore: remove project name from ddev config to enable git worktrees 2025-07-22 08:58:44 +02:00
305 changed files with 9058 additions and 16269 deletions

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
## Description: Run Claude Code
## Usage: claude [args]
## Example: ddev claude
## Example: ddev claude --help
## Example: ddev claude doctor
# Ensure ~/.local/bin is in PATH
export PATH="$HOME/.local/bin:$PATH"
# Check if claude is installed
if [ ! -f "$HOME/.local/bin/claude" ]; then
echo "Claude Code is not installed. Installing now..."
curl -fsSL https://claude.ai/install.sh | bash
fi
# Run claude with all arguments
exec "$HOME/.local/bin/claude" "$@"
-14
View File
@@ -40,12 +40,6 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
MAILER_DSN=null://null
###< symfony/mailer ###
MAILJET_API_KEY=
MAILJET_API_SECRET=
MAILJET_API_BASE_URL=https://api.mailjet.com/v3/REST
MAILJET_NEWSLETTER_LIST_ID=
APP_NEWSLETTER_CONFIRMATION_TTL_HOURS=1
APP_BPN_USER=
APP_BPN_PASSWORD=
APP_BPN_IP=
@@ -66,14 +60,6 @@ APP_CUSTOMER_SERVICE_EMAIL="[email protected]"
# Travel Data Service Configuration
APP_TRAVEL_PREFER_REMOTE=false
APP_TRAVEL_ENABLE_FALLBACK=true
APP_TRAVEL_SNAPSHOT_RETENTION_BUFFER_DAYS=14
# Feature Flags
FEATURE_TRAVEL_SNAPSHOT=true
# Emails
APP_DEFAULT_EMAIL_FROM=[email protected]
APP_DEFAULT_EMAIL_TO=[email protected]
# Booking Configuration
# Status for new bookings: 'F' (Fixed/Final), 'O' (Option - requires agency confirmation)
-4
View File
@@ -33,7 +33,3 @@ yarn-error.log
###< friendsofphp/php-cs-fixer ###
/ray.php
###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###
+1 -1
View File
@@ -60,7 +60,7 @@ Authorization: Bearer {{$auth.token("oauth2_api")}}
### API travel
# @no-cookie-jar
GET {{base_url}}/api/travels/DPWMP140326
GET {{base_url}}/api/travels/SBW131225
Accept: application/json
Authorization: Bearer {{$auth.token("oauth2_api")}}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

+11 -16
View File
@@ -1,7 +1,7 @@
.button {
@apply inline-flex items-center justify-center space-x-2 h-8 leading-8 md:h-10 md:leading-10 px-4 md:px-8 cursor-pointer;
@apply uppercase leading-none text-center text-sm md:text-base;
@apply transition-colors outline-none focus:outline-2 focus:outline-offset-2 focus:outline-primary-dark;
@apply inline-flex items-center justify-center space-x-2 h-10 leading-10 px-4 md:px-8 cursor-pointer;
@apply uppercase leading-none text-center;
@apply transition-colors outline-none focus:outline-2 focus:outline-offset-2 focus:outline-primary-light;
@apply rounded-md;
}
@@ -20,47 +20,42 @@
}
.button--secondary {
@apply bg-none bg-primary-light text-white;
@apply hover:bg-primary-light/50;
}
.button--neutral {
@apply bg-none bg-gray-200;
@apply hover:bg-gray-200/50;
@apply bg-none bg-primary-dark text-white;
@apply hover:bg-primary-light/80;
}
.sbw {
.button--primary {
@apply bg-none bg-sbw-secondary text-white;
@apply hover:bg-none hover:bg-sbw-primary/50;
@apply hover:bg-none hover:bg-sbw-primary/80;
}
.button--secondary {
@apply bg-none bg-sbw-primary-dark text-white;
@apply hover:bg-none hover:bg-sbw-primary/50;
@apply hover:bg-none hover:bg-sbw-primary/80;
}
}
.snz {
.button--primary {
@apply bg-none bg-snz-secondary text-white;
@apply hover:bg-none hover:bg-snz-primary/50;
@apply hover:bg-none hover:bg-snz-primary/80;
}
.button--secondary {
@apply bg-none bg-snz-primary-dark text-white;
@apply hover:bg-none hover:bg-snz-primary/50;
@apply hover:bg-none hover:bg-snz-primary/80;
}
}
.ser {
.button--primary {
@apply bg-none bg-ser-secondary text-white;
@apply hover:bg-none hover:bg-ser-primary/50;
@apply hover:bg-none hover:bg-ser-primary/80;
}
.button--secondary {
@apply bg-none bg-ser-primary text-white;
@apply hover:bg-none hover:bg-ser-primary/50;
@apply hover:bg-none hover:bg-ser-primary/80;
}
}
-4
View File
@@ -16,7 +16,6 @@
"doctrine/orm": "^3.3",
"easycorp/easyadmin-bundle": "^4.27",
"fakerphp/faker": "^1.24",
"flagception/flagception-bundle": "^6.1",
"league/flysystem-bundle": "^3.4",
"league/flysystem-sftp-v3": "^3.29",
"league/oauth2-server-bundle": "^1.0",
@@ -120,9 +119,6 @@
"require-dev": {
"deployer/deployer": "^7.5",
"friendsofphp/php-cs-fixer": "^3.75",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^9.5",
"spatie/ray": "^1.43",
"spatie/x-ray": "^1.2",
Generated
+2445 -1284
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -18,5 +18,4 @@ return [
Zenstruck\ScheduleBundle\ZenstruckScheduleBundle::class => ['all' => true],
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
Flagception\Bundle\FlagceptionBundle\FlagceptionBundle::class => ['all' => true],
];
-2
View File
@@ -1,2 +0,0 @@
flagception:
features: {}
+2 -2
View File
@@ -13,7 +13,7 @@ framework:
max_retries: 3
multiplier: 2
failed: 'doctrine://default?queue_name=failed'
sync: 'sync://'
# sync: 'sync://'
default_bus: messenger.bus.default
@@ -21,7 +21,7 @@ framework:
messenger.bus.default: []
routing:
Symfony\Component\Mailer\Messenger\SendEmailMessage: sync
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
Symfony\Component\Notifier\Message\ChatMessage: async
Symfony\Component\Notifier\Message\SmsMessage: async
+2 -4
View File
@@ -59,7 +59,7 @@ when@test:
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
when@prod: &prod_config
when@prod:
monolog:
handlers:
database:
@@ -104,6 +104,4 @@ when@prod: &prod_config
type: stream
channels: [deprecation]
path: php://stderr
formatter: monolog.formatter.json
when@staging: *prod_config
formatter: monolog.formatter.json
-2
View File
@@ -1,8 +1,6 @@
twig:
file_name_pattern: '*.twig'
form_themes: ['forms.html.twig']
paths:
'%kernel.project_dir%/assets/images': images
globals:
htmx_change_trigger: 'change delay:100ms'
website_base_url: '%env(APP_WEBSITE_BASE_URL)%'
+2 -18
View File
@@ -24,22 +24,6 @@ zenstruck_schedule:
frequency: "30 1 * * *"
description: "Removes expired drafts"
- task: app:cleanup:newsletter-opt-in-requests
frequency: "45 1 * * *"
description: "Removes expired pending newsletter double opt-in requests"
- task: league:oauth2-server:clear-expired-tokens
frequency: "0 * * * *"
description: "Removes expired oauth2 tokens hourly"
- task: app:bpn:refresh-travel-snapshot --refresh-after 60
frequency: "10 8-19 * * *"
description: "Syncs travel data snapshots with BusPro XML data hourly during peak hours"
- task: app:bpn:refresh-travel-snapshot --refresh-after 180
frequency: "10 20-23,0-7 * * *"
description: "Syncs travel data snapshots with BusPro XML data every 3 hours outside peak hours"
when@staging:
zenstruck_schedule:
mailer:
@@ -53,8 +37,8 @@ when@prod:
tasks:
- task: app:bpn:xml-sync
frequency: "*/15 8-19 * * *"
description: "Syncs BusPro XML data every 15 min. during peak hours"
description: "Sync BusPro XML data every 15 min. during peak hours"
- task: app:bpn:xml-sync
frequency: "0 20-23,0-7 * * *"
description: "Syncs BusPro XML data hourly outside peak hours"
description: "Sync BusPro XML data hourly outside peak hours"
+7 -31
View File
@@ -9,10 +9,6 @@ parameters:
path_to_keys: '%kernel.project_dir%/config/secret'
bpn_debug: '%env(APP_BPN_DEBUG)%'
default_booking_status: '%env(DEFAULT_BOOKING_STATUS)%'
newsletter_confirmation_ttl_hours: '%env(int:APP_NEWSLETTER_CONFIRMATION_TTL_HOURS)%'
travel_snapshot_retention_buffer_days: '%env(int:APP_TRAVEL_SNAPSHOT_RETENTION_BUFFER_DAYS)%'
default_email_from: '%env(APP_DEFAULT_EMAIL_FROM)%'
default_email_to: '%env(APP_DEFAULT_EMAIL_TO)%'
# Body dimensions choices for BodyDimensionsType
body_dimensions.height_choices:
@@ -103,21 +99,17 @@ services:
arguments:
$path: '%path_to_keys%'
App\Service\TravelSnapshotManager:
arguments:
$retentionBufferDays: '%travel_snapshot_retention_buffer_days%'
App\Service\TravelDataProvider:
App\Service\TravelDataService:
arguments:
$logger: '@monolog.logger.core'
$preferRemote: '%env(bool:APP_TRAVEL_PREFER_REMOTE)%'
$enableFallback: '%env(bool:APP_TRAVEL_ENABLE_FALLBACK)%'
App\Service\BookingEditDataLoader:
App\Service\BookingEditDataLoaderService:
arguments:
$bpnCache: '@bpn.cache'
App\Service\VoucherValidator:
App\Service\VoucherValidationService:
arguments:
$cache: '@cache.app'
$logger: '@monolog.logger.bpn'
@@ -156,16 +148,16 @@ services:
- '@App\Form\Service\ParticipantPurchaseVoucherFieldHandler'
- '@App\Form\Service\ParticipantPromoVoucherFieldHandler'
# Booking Status Rules
# Participant Status Rules
App\BusProNet\Service\StatusRule\ChaperonServiceStatusRule: ~
# Booking Status Rule Registry
App\BusProNet\Service\BookingStatusRuleRegistry:
# Participant Status Rule Registry
App\BusProNet\Service\ParticipantStatusRuleRegistry:
arguments:
$rules:
- '@App\BusProNet\Service\StatusRule\ChaperonServiceStatusRule'
App\Service\CmsDataProvider:
App\Service\CmsDataService:
arguments:
$httpClient: '@typo3.client'
$apiKey: 'AbcAbc123'# dummy key, not yet implemented
@@ -174,23 +166,7 @@ services:
tags:
- { name: monolog.processor }
App\Service\NewsletterManager:
arguments:
$newsletterConfirmationTtlHours: '%newsletter_confirmation_ttl_hours%'
App\Service\DomainConfigProvider:
arguments:
$domainConfig: '%domain_config%'
App\Email\Mailer:
arguments:
$defaults:
from: '%default_email_from%'
to: '%default_email_to%'
App\Service\MailjetApiClient:
arguments:
$mailjetApiKey: '%env(default::MAILJET_API_KEY)%'
$mailjetApiSecret: '%env(default::MAILJET_API_SECRET)%'
$mailjetApiBaseUrl: '%env(default::MAILJET_API_BASE_URL)%'
$mailjetNewsletterListId: '%env(default::MAILJET_NEWSLETTER_LIST_ID)%'
-196
View File
@@ -1,196 +0,0 @@
# Booking Flow Reference
Last updated: 2026-04-16
This document traces the booking create and edit flows from controller entry point through to session/DTO state. It is intended as orientation for developers unfamiliar with the flow, not as a substitute for reading the code.
---
## Shared Concepts
### `BookingDto`
The central data object for both flows. Holds room selections, participants, payment method, and travel reference. Lives in the HTTP session between requests. Has two modes: `MODE_CREATE` and `MODE_EDIT`.
### `BookingSessionManager`
Owns all reads and writes to session-stored `BookingDto` instances. Also manages the baseline room snapshot used for change detection in the create flow.
### `BookingCreateContextFactory`
Assembles the view model (`BookingCreateContext`) passed to create-flow templates. Handles room grouping (by-pax vs. by-room) and wires summary sidebar data.
---
## Create Flow
```
Step 1 (room selection)
→ Step 2 (participants)
→ Step 2 sub-form (per-participant, HTMX)
→ Step 3 (payment + API pre-validation)
→ Step 4 (confirmation + final submission)
→ Success
```
### Entry / Bootstrap
`BookingExceptionHandlerTrait::getOrCreateBookingCreateDto()` is called by every step controller. If no DTO exists in session, it calls `BookingConfigurator::startFreshBooking()` which loads travel data and initialises a fresh `BookingDto`.
### Step 1 — Room Selection
**Controller:** `Create/Step1Controller`
**Route:** `GET|POST /bookings/create/rooms`
1. Load or create DTO via `getOrCreateBookingCreateDto()`
2. `BookingSessionManager::getOrCreateBaselineSnapshot()` — saves the current room selection as a comparison point for change detection
3. Render `BookingCreateStep1Type` form
4. On submit:
- If room selection changed from baseline: `BookingDto::resetParticipantAssignments()` — clears stale assignments
- `BookingConfigurator::updateBookingStatusFromRoomSelection()` — may switch booking to inquiry mode if capacity constraints require it
- `BookingSessionManager::saveBookingDto()`, advance `currentStep` to 2
- `BookingSessionManager::clearBaselineSnapshot()`
- Redirect to Step 2
HTMX refresh (`/bookings/create/refresh`): processes the form without validation and returns updated room selection + summary sidebar blocks.
### Step 2 — Participants (Card Overview)
**Controller:** `Create/Step2Controller`
**Route:** `GET|POST /bookings/create/participants`
1. Load DTO from session (or redirect to Step 1 if missing)
2. `TravelDataProvider::enrichWithFreshAvailabilities()` — refreshes room availability
3. `ensureCorrectNumberOfParticipants()` — syncs the `BookingDto::participants` array length with the room selections (e.g., 2× double room → 4 participants). Preserves existing participant data for slots that still exist.
4. `ParticipantDataPrefiller::shouldPrepopulateApplicant()` + `prepopulateApplicantFromUser()` — prefills participant[0] from user profile on first visit
5. `RoomAssigner::validateAndResetInvalidAssignments()` — clears any room assignments that no longer match the current room selection (handles back-navigation from Step 2 → Step 1 → Step 2)
6. `RoomAssigner::assignRoomsIfNeeded()` — auto-assigns participants to rooms
7. `BookingConfigurator::preselectDefaultServices()` — selects mandatory and auto-book services for all participants
8. `BookingConfigurator::applyCreateBookingStatusRules()` — re-evaluates booking status (book / inquiry / not-bookable)
9. `BookingSessionManager::saveBookingDto()`
10. On form submit (all participants valid): advance to Step 3, redirect
### Step 2 — Individual Participant Form (HTMX)
**Controller:** `Create/Step2ParticipantController`
**Routes:** `GET|POST /bookings/create/participants/{index}` and `/participants/{index}/refresh`
Each participant card lazy-loads its form via HTMX. The controller:
1. Verifies the participant slot exists
2. Refreshes availability
3. Handles dummy data fill (`ParticipantDataPrefiller::isDummyDataFillRequested()` / `fillDummyParticipant()`)
4. On submit: re-applies status rules, saves to session, redirects to card overview
5. `ParticipantFormSupport` is used for form creation options and notification draining
### Step 3 — Payment + API Pre-Validation
**Controller:** `Create/Step3Controller`
**Route:** `GET|POST /bookings/create/payment`
1. Load DTO from session
2. `BookingConfigurator::applyCreateBookingStatusRules()`
3. On submit:
- `ApiClient::createBookingInquiry()` — submits booking to API for validation without committing it
- If inquiry fails with "nicht möglich" + "Anfrage" in message: auto-switch to inquiry mode, advance to Step 4
- If inquiry fails otherwise: show error, stay on step
- Price verification: `BookingPriceCalculator::calculateGrandTotal()` is compared against the API response total (accounting for promotional/goodwill voucher discounts and API-applied group discounts). Mismatch triggers `BookingPriceMismatchAnalyzer` for detailed logging.
- On success: advance `currentStep` to 4, redirect
### Step 4 — Confirmation + Final Submission
**Controller:** `Create/Step4Controller`
**Route:** `GET|POST /bookings/create/confirmation`
1. Load DTO from session
2. Newsletter subscription check for opt-in display
3. On submit:
- `BookingConfigurator::applyCreateBookingStatusRules()`
- `ApiClient::createBooking()` — final booking submission (already validated in Step 3)
- Newsletter double-opt-in if selected
- On success: store booking number + total in flash (for analytics), clear travel data cache, `BookingSessionManager::clearBookingDto()`, redirect to success page
---
## Edit Flow
```
Entry (start)
→ Load (session or API + draft restore)
→ Participant sub-forms (HTMX, per-participant)
→ Submission
```
### Entry
**Controller:** `Edit/IndexController::start()`
**Route:** `GET /bookings/{id}/edit/start`
Clears any existing session DTO for edit mode and invalidates the API booking cache, then redirects to the edit page. This ensures a clean load from API on every intentional re-entry.
### Load
**Controller:** `Edit/IndexController::index()`
**Route:** `GET|POST /bookings/{id}/edit`
Loading is delegated entirely to `BookingEditDataLoader::loadFormData()`:
**If session DTO exists and matches the requested booking ID:**
- `TravelDataProvider::enrichWithFreshAvailabilities()` — refreshes room availability
- `TravelDataProvider::getMutabilityData()` + `patchMutability()` — applies cached mutability state to DTO
**If no session DTO (first load or after `start`):**
`initializeFromApi()`:
1. `fetchBookingData()` — `ApiClient::getBooking()` with 5-minute cache (tagged by user ID for bulk invalidation)
2. `TravelDataProvider::getTravelData()` — loads travel data (XML or snapshot)
3. `TravelDataProvider::getAvailabilityData(forceRefresh: true)` + `patchAvailabilities()` — force-refreshes availability at edit start, populates cache for subsequent loads within the session
4. `TravelDataProvider::getMutabilityData(cached: true)` + `patchMutability()` — applies which service categories are currently editable
5. `BookingDataProcessor::createBookingDtoFromBooking()` — hydrates `BookingDto` from API booking entity
6. Agency code resolved via `AgencyLoader` (used by field state conditions)
7. `BookingChangeTracker::generateFingerprint()` — sets `originalFingerprint` on DTO **before** draft is applied, so dirty detection compares against original API data
8. `BookingEditDraftManager::findDraft()` + `applyDraftToDto()` — if draft exists, merges user edits on top of fresh API data. Sets `draftWasRestored = true` if successful.
9. `BookingSessionManager::saveBookingDto()`
Back in the controller: shows "draft restored" flash if applicable, fetches booking data for surcharge/status display, renders the card overview with `BookingEditContextFactory::createOverviewContext()`.
### Individual Participant Form (HTMX)
**Controller:** `Edit/ParticipantController`
**Routes:** `GET|POST /bookings/{id}/edit/participants/{index}` and `/{index}/refresh`
Per-participant forms are lazy-loaded, matching the create flow pattern.
1. `BookingEditContextFactory::prepareBookingDto()` — refreshes availabilities on the DTO travel object
2. `ParticipantFormSupport` — form creation, notification draining
3. On submit: `BookingSessionManager::saveBookingDto()` + `BookingEditDraftManager::saveDraft()` — persists participant edits to both session and draft
### Submission
**Service:** `BookingEditSubmitter::handleSubmission()`
Called from `Edit/IndexController` on valid form submit.
1. Invalidate API cache, fetch fresh booking data
2. Force-refresh mutability data (`TravelDataProvider::getMutabilityData(forceRefresh: true)`) and patch DTO travel
3. `BookingEditSubmitGuard::reconcileImmutableCategories()` — reverts any DTO fields that have become immutable since the session was loaded. Shows flash if anything was reverted.
4. `ApiClient::updateBooking()` — submit
5. On success: invalidate cache again, `BookingSessionManager::clearBookingDto()`, `BookingEditDraftManager::deleteDraft()`
### Other Edit Routes
| Route | Action |
|-------|--------|
| `GET /bookings/{id}/edit/reload` | Shows confirmation modal |
| `POST /bookings/{id}/edit/reload` | Clears session + **deletes draft**, reloads from API |
| `GET /bookings/{id}/edit/cancel` | Clears session, **preserves draft**, redirects to booking list |
The distinction between reload and cancel is intentional: cancel keeps the draft so the user can return to their changes later; reload discards everything.
---
## Key Invariants
- `currentStep` on the DTO gates forward navigation in create mode; controllers redirect to the current step if a higher step is requested directly.
- The original fingerprint is set before draft application in edit mode. Dirty detection (`BookingChangeTracker::isDirty()`) always compares the live session DTO against the original API state, not against the draft.
- Mutability is always patched from fresh or cached data before rendering. The DTO travel object is the authoritative source of which fields are editable at render time.
- Drafts survive cancel but not reload, and are deleted on successful submission.
-122
View File
@@ -1,122 +0,0 @@
# Service Simplification Plan
Status: active
Last updated: 2026-04-13
## Purpose
This document tracks the next pass of service simplification work. The goal is to reduce orchestration density, make the booking flow easier to follow for a human reader, and keep responsibilities aligned with the actual boundaries in the code.
The emphasis is not on deleting services for its own sake. The emphasis is on:
- keeping one clear owner for each meaningful boundary
- removing thin wrappers and pass-through helpers
- avoiding services that mostly shuffle data between layers
- keeping presentation concerns out of calculation and orchestration code
## Current Read
The codebase is already in a better place than it was at the start of the refactor, but a few services still carry more than one responsibility:
- `BookingService` now mostly covers booking bootstrap, service preselection, and booking status rules.
- `BookingParticipantCountService` was removed — its logic lives as a private method in the one controller that needed it (`Step2Controller`).
- `BookingRoomSelectionService` was removed — its logic lives as a private method in `BookingCreateContextFactory`.
- `BookingSummaryParticipantCountService` was removed — its logic lives as a private method in `BookingSummaryDataService`.
- `ParticipantPrepopulationService` now owns applicant prefill plus the create-mode dummy-data shortcut.
- `BookingEditParticipantContextFactory` now prepares the edit participant page context directly, replacing the older pass-through participant form service.
- `BookingPriceCalculatorService` is focused on pricing, but it still sits close to display-oriented behavior in adjacent code paths.
- `TravelDataService` remains broad and is likely the next larger boundary after booking orchestration is reduced.
One registry stands out as a real orchestration boundary and should be left alone for now:
- `ParticipantFieldHandlerRegistry`
It is not just a lookup table. It owns execution order, edit-mode mutability gating, and synchronization of submitted form data back into the DTO state.
## Next Pass
### 1. Keep pricing calculation focused
Primary goal: keep pricing code about pricing, not rendering.
Concrete next steps:
- keep `BookingPriceCalculatorService` as the pricing boundary
- continue removing display formatting from pricing code paths
- keep any remaining view-specific formatting in the presentation layer or a dedicated UI helper
- avoid introducing another service that only formats values already known to the view
Decision rule:
- if a value is only needed for display, prefer exposing the raw numeric/domain value and formatting it as close to the UI as possible
### 2. Leave the field-handler registry in place
Primary goal: avoid unnecessary churn in a class that is already a meaningful orchestration layer.
Concrete next steps:
- do not refactor `ParticipantFieldHandlerRegistry` in this pass
- revisit only if a later change can split ordering, mutability, and synchronization into clear collaborators without making the flow harder to trace
Decision rule:
- if a registry owns actual workflow behavior, treat it as a boundary rather than a smell
## Follow-Up Queue
After the booking service pass, the next likely candidates are:
### `TravelDataService`
This is the largest broad service still in the codebase. It likely needs a later pass if the application should become easier to follow end to end.
Likely directions:
- separate runtime travel loading from cache/snapshot maintenance if the public API still feels too wide
- keep the read path explicit and avoid hiding maintenance work behind one large method surface
### `BookingPriceCalculatorService`
This service should stay focused on pricing logic, but it may still have room for further internal cleanup if more display or transport aggregation concerns surface.
Likely directions:
- keep calculation responsibilities together
- avoid dragging presentation behavior back into the calculator
- split only if a sub-boundary becomes obvious and reusable
### `ParticipantFieldHandlerRegistry`
This stays on the list only as a future optional refactor, not as an immediate target.
Likely directions, only if justified later:
- isolate ordering/sorting logic if it becomes independently meaningful
- split synchronization code if a clearer DTO/form boundary emerges
- otherwise leave it as the central orchestration point for participant field processing
## Current Notes
- `templates/booking/_summary_travel_info.html.twig` already renders the summary participant count directly, so the remaining work here is naming and contract clarity rather than Twig branching.
- The summary count still needs a clear name if the code should distinguish the display-oriented count from the canonical participant total in the DTO/service layer.
- `ParticipantFormSupportService` was reviewed and kept: it is shared between two controllers (`Step2ParticipantController` and `Edit/ParticipantController`) with real shared logic, not just delegation.
## Progress Tracker
| Item | Status | Notes |
|------|--------|-------|
| Participant card DTO cleanup | Done | Card data now uses typed DTOs instead of nested array payloads |
| Room label formatting cleanup | Done | Pricing labels now have a dedicated presentation helper |
| Booking service split | Done | Session lifecycle, hydration, baseline snapshot, return URL handling, room grouping, and participant count shaping moved out of `BookingService` |
| Dummy prefill extraction | Done | Moved into `ParticipantPrepopulationService` |
| Micro-service consolidation | Done | `BookingRoomSelectionService`, `BookingParticipantCountService`, `BookingSummaryParticipantCountService` inlined into their single callers |
| Pricing service review | Pending | Keep focused on calculation, not rendering |
| Travel data service review | Pending | Broad boundary, likely later pass |
| Participant field registry review | Deferred | Real orchestration boundary, intentionally left alone for now |
## Acceptance Criteria
The next booking-service pass is only worth keeping if it:
- reduces the number of unrelated responsibilities in `BookingService`
- makes the booking flow easier to trace from controller to session/DTO state
- preserves existing booking behavior and test coverage
- does not replace one large service with several generic "manager" classes
## Working Agreement
- Update this document as decisions are made.
- Record rejected simplification ideas here with a short reason.
- Keep the plan aligned with actual code, not with an abstract architecture ideal.
- If a future simplification does not clearly reduce cognitive load, do not add it.
+4 -16
View File
@@ -886,9 +886,10 @@ Keys stored in `config/secret/` directory.
**Location:** `src/Security/Voter/BookingVoter.php`
This voter currently exists as legacy authorization logic and is not actively invoked by booking controllers.
Current booking routes (`/bookings/*`) are guarded with `ROLE_USER`, while final document access checks are enforced by BusProNet.
| Operation | Requirements |
|-----------|--------------|
| `VIEW` | User owns booking (addressId match) |
| `EDIT` | User owns booking AND booking is editable |
### 7.4 OAuth2
@@ -1153,19 +1154,6 @@ php bin/console app:cleanup:xml-dumps
Removes XML debug dumps older than 3 days.
#### app:cleanup:newsletter-opt-in-requests
```bash
php bin/console app:cleanup:newsletter-opt-in-requests
```
Removes expired pending newsletter double opt-in requests.
- Request TTL is controlled by `NEWSLETTER_CONFIRMATION_TTL_HOURS` (default: 1 hour).
- Expired pending requests are removed immediately when they are encountered (new request / confirmation attempt).
- Scheduled cleanup removes all currently expired pending requests (`expires_at <= now`) as a safety net.
- Confirmed requests are retained for audit/legal traceability.
### 10.3 Setup Commands
#### app:crypto:generate-keys
+6 -41
View File
@@ -34,41 +34,6 @@
}
}
},
"staging": {
"Security": {
"Auth": {
"oauth2_email": {
"Type": "OAuth2",
"Grant Type": "Authorization Code",
"Client ID": "{{oauth2_client_id}}",
"Client Secret": "{{oauth2_client_secret}}",
"Auth URL": "https://my.ep-reisen.net/authorize",
"Token URL": "https://my.ep-reisen.net/token",
"Redirect URL": "https://myep-team.ep-reisen.de/auth/check",
"Scope": "email"
},
"oauth2_profile": {
"Type": "OAuth2",
"Grant Type": "Authorization Code",
"Client ID": "{{oauth2_client_id}}",
"Client Secret": "{{oauth2_client_secret}}",
"Auth URL": "https://my.ep-reisen.net/authorize",
"Token URL": "https://my.ep-reisen.net/token",
"Redirect URL": "https://myep-team.ep-reisen.de/auth/check",
"Scope": "email profile"
},
"oauth2_api": {
"Type": "OAuth2",
"Grant Type": "Client Credentials",
"Client ID": "{{oauth2_api_client_id}}",
"Client Secret": "{{oauth2_api_client_secret}}",
"Auth URL": "https://my.ep-reisen.net/authorize",
"Token URL": "https://my.ep-reisen.net/token",
"Scope": "api"
}
}
}
},
"prod": {
"Security": {
"Auth": {
@@ -77,8 +42,8 @@
"Grant Type": "Authorization Code",
"Client ID": "{{oauth2_client_id}}",
"Client Secret": "{{oauth2_client_secret}}",
"Auth URL": "https://my.ep-reisen.de/authorize",
"Token URL": "https://my.ep-reisen.de/token",
"Auth URL": "https://myep.ep-reisen.de/authorize",
"Token URL": "https://myep.ep-reisen.de/token",
"Redirect URL": "https://myep-team.ep-reisen.de/auth/check",
"Scope": "email"
},
@@ -87,8 +52,8 @@
"Grant Type": "Authorization Code",
"Client ID": "{{oauth2_client_id}}",
"Client Secret": "{{oauth2_client_secret}}",
"Auth URL": "https://my.ep-reisen.de/authorize",
"Token URL": "https://my.ep-reisen.de/token",
"Auth URL": "https://myep.ep-reisen.de/authorize",
"Token URL": "https://myep.ep-reisen.de/token",
"Redirect URL": "https://myep-team.ep-reisen.de/auth/check",
"Scope": "email profile"
},
@@ -97,8 +62,8 @@
"Grant Type": "Client Credentials",
"Client ID": "{{oauth2_api_client_id}}",
"Client Secret": "{{oauth2_api_client_secret}}",
"Auth URL": "https://my.ep-reisen.de/authorize",
"Token URL": "https://my.ep-reisen.de/token",
"Auth URL": "https://myep.ep-reisen.de/authorize",
"Token URL": "https://myep.ep-reisen.de/token",
"Scope": "api"
}
}
-191
View File
@@ -1,191 +0,0 @@
###
# Mailjet API test requests for IntelliJ HTTP Client
#
# 1) Fill in variables below (or move them to http-client.private.env.json).
# 2) Set `mailjet_api_key` and `mailjet_api_secret` in your env file.
# IntelliJ HTTP Client will inject them into the Authorization header below.
#
# Required variables:
# - mailjet_base_url (example: https://api.mailjet.com/v3/REST)
# - mailjet_api_key
# - mailjet_api_secret
# - mailjet_contact_email
# - mailjet_list_id
#
# @no-cookie-jar
### Mailjet health check (authenticated)
# @no-cookie-jar
GET {{mailjet_base_url}}/apikey
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
### Find contact by email
# @no-cookie-jar
GET {{mailjet_base_url}}/contact?Email={{mailjet_contact_email}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
> {%
if (response.body && response.body.Data && response.body.Data.length > 0) {
client.global.set("contact_id", String(response.body.Data[0].ID));
}
%}
### Create contact (run if not found)
# @no-cookie-jar
POST {{mailjet_base_url}}/contact
Accept: application/json
Content-Type: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
{
"Email": "{{mailjet_contact_email}}",
"IsExcludedFromCampaigns": false
}
> {%
if (response.body && response.body.Data && response.body.Data.length > 0) {
client.global.set("contact_id", String(response.body.Data[0].ID));
}
%}
### Get contact by ID (after find/create)
# @no-cookie-jar
GET {{mailjet_base_url}}/contact/{{contact_id}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
### Mark contact as subscribed (opt-in)
# @no-cookie-jar
PUT {{mailjet_base_url}}/contact/{{contact_id}}
Accept: application/json
Content-Type: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
{
"IsExcludedFromCampaigns": false
}
### Mark contact as unsubscribed (opt-out)
# @no-cookie-jar
PUT {{mailjet_base_url}}/contact/{{contact_id}}
Accept: application/json
Content-Type: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
{
"IsExcludedFromCampaigns": true
}
### Get newsletter list by ID
# @no-cookie-jar
GET {{mailjet_base_url}}/contactslist/{{mailjet_list_id}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
### List all available contact lists
# @no-cookie-jar
GET {{mailjet_base_url}}/contactslist?Limit=1000
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
### Check list recipient status (before actions)
# @no-cookie-jar
GET {{mailjet_base_url}}/listrecipient?ContactsList={{mailjet_list_id}}&Contact={{contact_id}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
> {%
if (response.body && response.body.Data && response.body.Data.length > 0) {
client.global.set("listrecipient_id", String(response.body.Data[0].ID));
}
%}
### Subscribe to list (addnoforce)
# @no-cookie-jar
POST {{mailjet_base_url}}/contactslist/{{mailjet_list_id}}/managecontact
Accept: application/json
Content-Type: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
{
"Action": "addnoforce",
"Email": "{{mailjet_contact_email}}"
}
### Verify list recipient after addnoforce
# @no-cookie-jar
GET {{mailjet_base_url}}/listrecipient?ContactsList={{mailjet_list_id}}&Contact={{contact_id}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
### Unsubscribe from list (unsub)
# @no-cookie-jar
POST {{mailjet_base_url}}/contactslist/{{mailjet_list_id}}/managecontact
Accept: application/json
Content-Type: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
{
"Action": "unsub",
"Email": "{{mailjet_contact_email}}"
}
### Verify list recipient after unsub
# @no-cookie-jar
GET {{mailjet_base_url}}/listrecipient?ContactsList={{mailjet_list_id}}&Contact={{contact_id}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
### Re-subscribe attempt with addnoforce (expected to keep unsubscribed state)
# @no-cookie-jar
POST {{mailjet_base_url}}/contactslist/{{mailjet_list_id}}/managecontact
Accept: application/json
Content-Type: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
{
"Action": "addnoforce",
"Email": "{{mailjet_contact_email}}"
}
### Verify list recipient after addnoforce re-subscribe attempt
# @no-cookie-jar
GET {{mailjet_base_url}}/listrecipient?ContactsList={{mailjet_list_id}}&Contact={{contact_id}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
### Re-subscribe with addforce (expected to re-subscribe)
# @no-cookie-jar
POST {{mailjet_base_url}}/contactslist/{{mailjet_list_id}}/managecontact
Accept: application/json
Content-Type: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
{
"Action": "addforce",
"Email": "{{mailjet_contact_email}}"
}
### Verify list recipient after addforce
# @no-cookie-jar
GET {{mailjet_base_url}}/listrecipient?ContactsList={{mailjet_list_id}}&Contact={{contact_id}}
Accept: application/json
Authorization: Basic {{mailjet_api_key}} {{mailjet_api_secret}}
-26
View File
@@ -1,26 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260318113000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create newsletter_opt_in_confirmation table for double opt-in confirmations';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE TABLE newsletter_opt_in_confirmation (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(255) NOT NULL, token_hash VARCHAR(64) NOT NULL, expires_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', confirmed_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)', created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', UNIQUE INDEX UNIQ_NEWSLETTER_OPT_IN_TOKEN_HASH (token_hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE newsletter_opt_in_confirmation');
}
}
-28
View File
@@ -1,28 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260320071724 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add error_code column and index to log_entry table';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE log_entry ADD error_code VARCHAR(12) DEFAULT NULL');
$this->addSql('CREATE INDEX IDX_LOG_ENTRY_ERROR_CODE ON log_entry (error_code)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX IDX_LOG_ENTRY_ERROR_CODE ON log_entry');
$this->addSql('ALTER TABLE log_entry DROP error_code');
}
}
-26
View File
@@ -1,26 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260321120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create travel_snapshot table for DB-primary travel persistence';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE travel_snapshot (id INT AUTO_INCREMENT NOT NULL, date_id INT NOT NULL, hotel_id INT NOT NULL, date_code VARCHAR(64) DEFAULT NULL, label VARCHAR(255) DEFAULT NULL, product_id INT DEFAULT NULL, product_code VARCHAR(64) DEFAULT NULL, hotel_code VARCHAR(64) DEFAULT NULL, hotel_label VARCHAR(255) DEFAULT NULL, date_from DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', payload LONGTEXT NOT NULL, payload_hash VARCHAR(64) NOT NULL, captured_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', extended_refreshed_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX uniq_snapshot_date_hotel (date_id, hotel_id), INDEX idx_snapshot_date_code (date_code), INDEX idx_snapshot_product_id (product_id), INDEX idx_snapshot_date_to (date_to), INDEX idx_snapshot_extended_refreshed_at (extended_refreshed_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE travel_snapshot');
}
}
-45
View File
@@ -1,45 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260323182524 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE booking_edit_draft CHANGE form_data form_data JSON NOT NULL');
$this->addSql('ALTER TABLE log_entry CHANGE context context JSON DEFAULT NULL, CHANGE extra extra JSON DEFAULT NULL');
$this->addSql('ALTER TABLE newsletter_opt_in_confirmation RENAME INDEX uniq_newsletter_opt_in_token_hash TO UNIQ_70505214B3BC57DA');
$this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE hotel_codes hotel_codes JSON NOT NULL');
$this->addSql('DROP INDEX IDX_75EA56E0FB7336F0 ON messenger_messages');
$this->addSql('DROP INDEX IDX_75EA56E0E3BD61CE ON messenger_messages');
$this->addSql('DROP INDEX IDX_75EA56E016BA31DB ON messenger_messages');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0E3BD61CE16BA31DBBF396750 ON messenger_messages (queue_name, available_at, delivered_at, id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE newsletter_opt_in_confirmation RENAME INDEX uniq_70505214b3bc57da TO UNIQ_NEWSLETTER_OPT_IN_TOKEN_HASH');
$this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COLLATE `utf8mb4_bin`, CHANGE hotel_codes hotel_codes JSON NOT NULL COLLATE `utf8mb4_bin`');
$this->addSql('DROP INDEX IDX_75EA56E0FB7336F0E3BD61CE16BA31DBBF396750 ON messenger_messages');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('ALTER TABLE log_entry CHANGE context context JSON DEFAULT NULL COLLATE `utf8mb4_bin`, CHANGE extra extra JSON DEFAULT NULL COLLATE `utf8mb4_bin`');
$this->addSql('ALTER TABLE booking_edit_draft CHANGE form_data form_data JSON NOT NULL COLLATE `utf8mb4_bin`');
}
}
-30
View File
@@ -1,30 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Changes travel_snapshot.payload from TEXT to LONGTEXT so large
* plain JSON snapshot payloads can be stored safely.
*/
final class Version20260324120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Change travel_snapshot.payload from TEXT to LONGTEXT for plain JSON snapshot payloads';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE travel_snapshot CHANGE payload payload LONGTEXT NOT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE travel_snapshot CHANGE payload payload TEXT NOT NULL');
}
}
+881 -428
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -5,7 +5,7 @@
"@babel/preset-env": "^7.16.0",
"@hotwired/stimulus": "^3.0.0",
"@symfony/stimulus-bridge": "^3.2.0",
"@symfony/webpack-encore": "^6.0.0",
"@symfony/webpack-encore": "^5.0.0",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15",
"autoprefixer": "^10.4.20",
@@ -20,7 +20,7 @@
"tippy.js": "^6.3.7",
"toastify-js": "^1.12.0",
"webpack": "^5.74.0",
"webpack-cli": "^6.0.1",
"webpack-cli": "^5.1.0",
"webpack-notifier": "^1.15.0"
},
"license": "WTFPL",
-13
View File
@@ -1,13 +0,0 @@
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon
parameters:
level: 6
paths:
- src
tmpDir: var/phpstan
symfony:
containerXmlPath: var/cache/dev/App_KernelDevDebugContainer.xml
doctrine:
objectManagerLoader: tests/doctrine-object-manager.php
-43
View File
@@ -7,13 +7,11 @@ use App\BusProNet\Exception\ApiClientException;
use App\BusProNet\Exception\ImmediateConnectionCloseException;
use App\BusProNet\Exception\ResponseParserException;
use App\BusProNet\Exception\TimeoutException;
use App\BusProNet\Model\Agency;
use App\BusProNet\Model\BaseData;
use App\BusProNet\Model\Booking;
use App\BusProNet\Model\BookingResponse;
use App\BusProNet\Model\BookingUpdate;
use App\BusProNet\Model\CrmAttributes;
use App\BusProNet\Model\ExtendedServiceAvailabilityResponse;
use App\BusProNet\Model\Notification;
use App\BusProNet\Model\PersonalData;
use App\BusProNet\Model\PromoVoucher;
@@ -40,7 +38,6 @@ class ApiClient
public const TYPE_BASE_DATA_COUNTRIES = 'STAMMLAENDER';
public const TYPE_MUTABLE_DATA = 'MOEGLICHEAENDERUNGEN';
public const TYPE_AVAILABILITY = 'VERFUEGBARKEIT';
public const TYPE_AVAILABILITY_EXTENDED = 'VERFUEGBARKEIT2';
public const TYPE_AVAILABILITY_HOTEL = 'VERFUEGBARKEITHOTEL';
public const TYPE_BOOKING_UPDATE = 'BUCHUNGAENDERUNG';
public const TYPE_BOOKING = 'BUCHUNG';
@@ -50,13 +47,11 @@ class ApiClient
public const TYPE_PURCHASE_VOUCHER = 'GUTSCHEINPRUEFUNGEINLOESUNG';
public const TYPE_PROMO_VOUCHER = 'AKTIONSGUTSCHEIN';
/** @var array<string, mixed> */
private array $config;
private float $operationStartTime;
private int $selectedPort;
private int $requestCounter = 0;
/** @param array<string, mixed> $options */
public function __construct(
private readonly SerializerInterface $serializer,
private readonly ApiResponseParser $responseParser,
@@ -320,21 +315,6 @@ class ApiClient
return $this->sendRequest(static::TYPE_AVAILABILITY, $data);
}
/**
* @throws ApiClientException
*/
public function getAvailabilitiesExtended(int $dateId): Notification|ExtendedServiceAvailabilityResponse
{
$data = [
'user' => $this->config['bpn_username'],
'key' => $this->createKey($this->config['bpn_username'], $this->config['bpn_password'], static::TYPE_AVAILABILITY_EXTENDED),
'satz' => ['@typ' => static::TYPE_AVAILABILITY_EXTENDED],
'idreise' => $dateId,
];
return $this->sendRequest(static::TYPE_AVAILABILITY_EXTENDED, $data);
}
/**
* @throws ApiClientException
*/
@@ -616,10 +596,6 @@ class ApiClient
/**
* @throws ApiClientException
*/
/**
* @param array<string, mixed> $data
* @param array<string, mixed> $additionalArgs
*/
private function sendRequest(string $type, array $data, array $additionalArgs = [], bool $debug = false): mixed
{
return $this->executeWithRetry(fn () => $this->doSendRequest($type, $data, $additionalArgs, $debug), $type);
@@ -628,7 +604,6 @@ class ApiClient
/**
* @throws ApiClientException
*/
/** @param array<string, mixed> $data */
private function sendRequestRaw(array $data): string
{
return $this->executeWithRetry(fn () => $this->doSendRequestRaw($data));
@@ -684,10 +659,6 @@ class ApiClient
* @throws ApiClientException
* @throws ImmediateConnectionCloseException
*/
/**
* @param array<string, mixed> $data
* @param array<string, mixed> $additionalArgs
*/
private function doSendRequest(string $type, array $data, array $additionalArgs = [], bool $debug = false): mixed
{
$requestId = $this->getRequestId();
@@ -745,8 +716,6 @@ class ApiClient
}
/**
* @param array<string, mixed> $data
*
* @throws ApiClientException
* @throws ImmediateConnectionCloseException
*/
@@ -808,8 +777,6 @@ class ApiClient
}
/**
* @return resource
*
* @throws ApiClientException
* @throws TimeoutException
*/
@@ -873,8 +840,6 @@ class ApiClient
}
/**
* @param resource $socket
*
* @throws TimeoutException
*/
private function send($socket, string $data): void
@@ -893,8 +858,6 @@ class ApiClient
}
/**
* @param resource $socket
*
* @throws TimeoutException
* @throws ImmediateConnectionCloseException
*/
@@ -957,17 +920,11 @@ class ApiClient
return $response;
}
/** @param resource $socket */
private function disconnect($socket): void
{
@fclose($socket);
}
/**
* @param array<string, mixed> $options
*
* @return array<string, mixed>
*/
private function resolveOptions(array $options): array
{
$optionsResolver = new OptionsResolver();
@@ -12,8 +12,8 @@ use App\Form\Model\BankAccountDto;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
use App\Form\Model\RoomSelectionDto;
use App\Service\BookingPriceCalculator;
use App\Service\InsuranceManager;
use App\Service\BookingPriceCalculatorService;
use App\Service\InsuranceService;
/**
* Processes booking form data and converts it into BusProNet API payload format.
@@ -25,8 +25,8 @@ use App\Service\InsuranceManager;
class BookingDataProcessor
{
public function __construct(
private readonly InsuranceManager $insuranceService,
private readonly BookingPriceCalculator $priceCalculatorService,
private readonly InsuranceService $insuranceService,
private readonly BookingPriceCalculatorService $priceCalculatorService,
private readonly ServiceMappingCollector $mappingCollector,
private readonly ParticipantServiceProcessor $serviceProcessor,
private readonly BookingPayloadBuilder $payloadBuilder,
@@ -73,12 +73,14 @@ class BookingDataProcessor
if (0 === $index) {
// Copy address if first participant has no street (indicating empty/incomplete address)
// This allows applicant and first participant to be different people with different addresses
$isEmpty = null === $participantData->address
|| null === $participantData->address->street
|| '' === trim($participantData->address->street);
if (null !== $booking->applicant->address) {
$isEmpty = null === $participantData->address
|| null === $participantData->address->street
|| '' === trim($participantData->address->street);
if ($isEmpty) {
$participantData->address = clone $booking->applicant->address;
if ($isEmpty) {
$participantData->address = clone $booking->applicant->address;
}
}
// Copy body dimensions from applicant if not present in participant
@@ -282,7 +284,7 @@ class BookingDataProcessor
*
* @param BookingDto|null $formData The booking edit form data containing updated participant and service selections
*
* @return array<string, mixed> The structured payload array ready for BusProNet API submission
* @return array The structured payload array ready for BusProNet API submission
*/
public function createUpdateRequestPayload(?BookingDto $formData): array
{
@@ -343,7 +345,7 @@ class BookingDataProcessor
* @param BookingDto $bookingDto The booking creation form data
* @param string $bookingType Either 'Anfrage' (inquiry) or 'Buchung' (final booking)
*
* @return array<string, mixed> The structured payload array for BusProNet API submission
* @return array The structured payload array for BusProNet API submission
*/
public function createBookingRequestPayload(BookingDto $bookingDto, string $bookingType): array
{
@@ -386,7 +388,7 @@ class BookingDataProcessor
$participantPrices[$index] = $this->priceCalculatorService->calculateIndividualParticipantPriceExcludingInsurance($bookingDto, $index);
}
// Use InsuranceManager for proper type-based assignment with price tier matching
// Use InsuranceService for proper type-based assignment with price tier matching
$assignments = $this->insuranceService->batchAssignInsuranceToParticipants(
$selectableInsurances,
$applicant->insurance,
@@ -6,8 +6,8 @@ namespace App\BusProNet\DataProcessor;
use App\BusProNet\Constants;
use App\BusProNet\Model\Booking;
use App\BusProNet\Service\ParticipantStatusRuleRegistry;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
/**
* Builds API payload structures for BusProNet booking requests.
@@ -17,10 +17,9 @@ use App\Form\Model\ParticipantDto;
*/
class BookingPayloadBuilder
{
private const DEFAULT_PARTICIPANT_STATUS = 'F';
public function __construct(
private readonly ServiceMappingCollector $mappingCollector,
private readonly ParticipantStatusRuleRegistry $statusRuleRegistry,
) {
}
@@ -31,7 +30,7 @@ class BookingPayloadBuilder
*
* @param Booking $bookingData The booking data object
*
* @return array<string, mixed> The base payload structure
* @return array The base payload structure
*/
public function buildBasePayload(Booking $bookingData): array
{
@@ -67,8 +66,8 @@ class BookingPayloadBuilder
*
* Bank account information is required for direct debit payments.
*
* @param array<string, mixed> $payload The payload array to modify
* @param Booking $bookingData The booking data object
* @param array $payload The payload array to modify
* @param Booking $bookingData The booking data object
*/
public function addBankAccountToPayload(array &$payload, Booking $bookingData): void
{
@@ -87,9 +86,9 @@ class BookingPayloadBuilder
*
* Includes status, personal data, and wishes (room remarks, license plate) for each participant.
*
* @param array<string, mixed> $payload The payload array to modify
* @param Booking $bookingData The booking data object
* @param array<int, ParticipantDto> $participantDtos The participant DTOs from the form (for wishes data)
* @param array $payload The payload array to modify
* @param Booking $bookingData The booking data object
* @param array $participantDtos The participant DTOs from the form (for wishes data)
*/
public function buildParticipantPayload(array &$payload, Booking $bookingData, array $participantDtos): void
{
@@ -142,8 +141,8 @@ class BookingPayloadBuilder
* Includes additional services, transportation services, and accommodation details
* with participant mappings and quantities.
*
* @param array<string, mixed> $payload The payload array to modify
* @param Booking $bookingData The booking data object
* @param array $payload The payload array to modify
* @param Booking $bookingData The booking data object
*/
public function buildServicesPayload(array &$payload, Booking $bookingData): void
{
@@ -199,8 +198,8 @@ class BookingPayloadBuilder
*
* Only included in payload if there are actual pickup assignments for bus transportation.
*
* @param array<string, mixed> $payload The payload array to modify
* @param Booking $bookingData The booking data object
* @param array $payload The payload array to modify
* @param Booking $bookingData The booking data object
*/
public function buildPickupPayload(array &$payload, Booking $bookingData): void
{
@@ -224,8 +223,8 @@ class BookingPayloadBuilder
*
* Only included in payload if there are actual drop-off assignments for bus transportation.
*
* @param array<string, mixed> $payload The payload array to modify
* @param Booking $bookingData The booking data object
* @param array $payload The payload array to modify
* @param Booking $bookingData The booking data object
*/
public function buildDropOffPayload(array &$payload, Booking $bookingData): void
{
@@ -250,7 +249,7 @@ class BookingPayloadBuilder
* @param BookingDto $bookingDto The booking creation form data
* @param string $bookingType Either 'Anfrage' (inquiry) or 'Buchung' (final booking)
*
* @return array<string, mixed> The structured payload array for BusProNet API submission
* @return array The structured payload array for BusProNet API submission
*/
public function buildCreatePayload(BookingDto $bookingDto, string $bookingType): array
{
@@ -303,7 +302,7 @@ class BookingPayloadBuilder
foreach ($bookingDto->participants as $index => $participant) {
$participantData = [
'@id' => $index + 1,
'status' => self::DEFAULT_PARTICIPANT_STATUS,
'status' => $this->statusRuleRegistry->evaluateStatus($participant),
'name' => $participant->lastName,
'vorname' => $participant->firstName,
'geschlecht' => $participant->gender ?? '',
@@ -440,11 +439,11 @@ class BookingPayloadBuilder
* Generic helper method that converts service ID => participant IDs mappings
* into XML payload structure.
*
* @param array<string, mixed> $payload The payload array to modify
* @param string $sectionKey The section key (e.g., 'beförderungen', 'versicherungen')
* @param string $itemKey The item key (e.g., 'beförderung', 'versicherung')
* @param string $idAttributeName The ID attribute name (e.g., '@idleistung', '@idversicherung')
* @param array<int|string, int[]> $serviceMap Map of service ID to participant IDs
* @param array $payload The payload array to modify
* @param string $sectionKey The section key (e.g., 'beförderungen', 'versicherungen')
* @param string $itemKey The item key (e.g., 'beförderung', 'versicherung')
* @param string $idAttributeName The ID attribute name (e.g., '@idleistung', '@idversicherung')
* @param array $serviceMap Map of service ID to participant IDs
*/
public function addServicesFromMap(
array &$payload,
@@ -476,9 +475,9 @@ class BookingPayloadBuilder
* - abreise (departure date)
* - anzahl (number of rooms of this type booked)
*
* @param array<string, mixed> $payload The payload array to modify
* @param array<int|string, int[]> $roomMap Map of room ID to participant IDs
* @param BookingDto $bookingDto The booking data for accessing room details and quantities
* @param array $payload The payload array to modify
* @param array $roomMap Map of room ID to participant IDs
* @param BookingDto $bookingDto The booking data for accessing room details and quantities
*/
public function addRoomMappingsToPayload(array &$payload, array $roomMap, BookingDto $bookingDto): void
{
@@ -521,8 +520,8 @@ class BookingPayloadBuilder
/**
* Adds purchase vouchers to the payload.
*
* @param array<string, mixed> $payload The payload array to modify
* @param BookingDto $bookingDto The booking data
* @param array $payload The payload array to modify
* @param BookingDto $bookingDto The booking data
*/
public function addPurchaseVouchersToPayload(array &$payload, BookingDto $bookingDto): void
{
@@ -6,6 +6,7 @@ namespace App\BusProNet\DataProcessor;
use App\BusProNet\Model\Address;
use App\BusProNet\Model\Booking;
use App\BusProNet\Model\Communication;
use App\BusProNet\Model\PersonalData;
use App\Form\Model\ParticipantDto;
@@ -85,6 +86,9 @@ class PersonalDataSynchronizer
}
if ($participant->email || $participant->mobile) {
if (null === $bookingData->participants[$participant->index]->communication) {
$bookingData->participants[$participant->index]->communication = new Communication();
}
$bookingData->participants[$participant->index]->communication->email = $participant->email;
$bookingData->participants[$participant->index]->communication->mobile = $participant->mobile;
}
@@ -123,6 +127,10 @@ class PersonalDataSynchronizer
$applicant->dateOfBirth = new \DateTimeImmutable('-20 years');
}
if (null === $applicant->communication) {
$applicant->communication = new Communication();
}
if (null === $applicant->communication->mobile || '' === $applicant->communication->mobile) {
$applicant->communication->mobile = '12345';
}
@@ -20,7 +20,7 @@ class ServiceMappingCollector
*
* Groups participants by their assigned room ID.
*
* @return array<int, list<int>> Map of room ID to participant IDs
* @return array<string, array<int>> Map of room ID to participant IDs
*/
public function collectRoomMappings(BookingDto $bookingDto): array
{
@@ -14,7 +14,6 @@ class CountryDataProvider
{
}
/** @return array<string, Country> */
public function getAll(): array
{
try {
-1
View File
@@ -10,7 +10,6 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
/** @extends AbstractType<string> */
class CountryType extends AbstractType
{
public function __construct(private readonly CountryDataProvider $countries)
@@ -12,7 +12,6 @@ namespace App\BusProNet\Model;
*/
class AgeConstraintResult
{
/** @param array<string, mixed> $metadata */
public function __construct(
public readonly string $type,
public readonly ?int $ageFrom = null,
+1 -2
View File
@@ -12,7 +12,6 @@ namespace App\BusProNet\Model;
*/
class BaseData
{
/** @param array<array-key, mixed> $items */
public function __construct(private readonly array $items)
{
}
@@ -20,7 +19,7 @@ class BaseData
/**
* Retrieves all items in the base data collection.
*
* @return array<array-key, mixed> The complete items array
* @return array The complete items array
*/
public function getItems(): array
{
+1 -37
View File
@@ -36,50 +36,14 @@ class Booking
public ?string $paymentType = null;
public ?string $paymentLabel = null;
public ?BankAccount $bankAccount = null;
/**
* @var array<int, string>
*/
public array $participantsStatus = [];
/**
* @var array<int, PersonalData>
*/
public array $participants = [];
/**
* @var array<int, Service>
*/
public array $transportationServices = [];
/**
* @var array<int, Service>
*/
public array $additionalServices = [];
/**
* @var array<int, Room>
*/
public array $rooms = [];
/**
* @var array<int, Pickup>
*/
public array $pickups = [];
/**
* @var array<int, Pickup>
*/
public array $dropOffs = [];
/**
* @var array<int, Surcharge>
*/
public array $surcharges = [];
/**
* @var array<string|int, Insurance>
*/
public array $insurances = [];
public ?int $invoiceNumber = null;
public ?float $totalPrice = null;
@@ -220,7 +184,7 @@ class Booking
public function getInsuranceForParticipant(int $participantIndex): ?Insurance
{
foreach ($this->insurances as $insurance) {
if (in_array($participantIndex, $insurance->mapping, true)) {
if (in_array($participantIndex, $insurance->mapping ?? [], true)) {
return $insurance;
}
}
-15
View File
@@ -12,23 +12,8 @@ namespace App\BusProNet\Model;
*/
class CrmAttributes
{
/**
* @var array<int, CrmSelectionGroup>|null
*/
public ?array $selectionGroups = null;
/**
* @var array<int, CrmAction>|null
*/
public ?array $crmActions = null;
/**
* @var array<int, string>
*/
public array $hotelCodes = [];
/**
* @var array<int, string>
*/
public array $roles = [];
}
+4 -4
View File
@@ -15,15 +15,15 @@ use Symfony\Component\Serializer\Attribute\Groups;
*/
class CrmSelection
{
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?int $id = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?string $label = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $mutable = false;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $selected = false;
}
+4 -7
View File
@@ -19,7 +19,7 @@ class CrmSelectionGroup
* Maps BusPro IDs of CRM selection groups representing
* included services.
*
* @var array<int, string>
* @var array<string, string>
*/
public static array $includedServicesMapping = [
7 => 'Skipass',
@@ -32,16 +32,13 @@ class CrmSelectionGroup
90 => 'Transport',
];
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?int $id = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?string $label = null;
/**
* @var array<int, CrmSelection>|null
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?array $selections = null;
/**
+115
View File
@@ -0,0 +1,115 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Model;
/**
* Represents error codes and messages for the BusProNet API.
*
* This class provides a static mapping of error codes to their corresponding
* German error messages for consistent error handling across the application.
* Error codes range from 100-999 and cover various API scenarios.
*/
class Error
{
/**
* @var array<int, string>
*/
private static array $errors = [
100 => 'Anfrageknoten fehlt',
101 => 'Satzknoten fehlt in Anfrageknoten',
102 => 'Ungültiger Satztyp [#1#]',
103 => 'User fehlt',
104 => 'User fehlerhaft',
105 => 'Key fehlt',
106 => 'Key fehlerhaft',
200 => 'Keine Einträge vorhanden',
201 => 'Keine Partner zur Auswahl gefunden',
202 => 'Keinen Partner mit der ID [#1#] gefunden',
203 => 'Ungültiger Termin',
300 => 'IDReise fehlt',
301 => 'Reise nicht gefunden',
302 => 'IDLeistung (Hin & Rück) fehlt',
303 => 'IDLeistung passt nicht zu IDReise',
304 => 'Es konnte nicht für alle Teilnehmer ein Sitzplatz ermittelt werden',
305 => 'Anzahl Personen fehlt',
306 => 'Leistungen mit ID #1# nicht gefunden',
307 => 'Leistungen mit ID #1# passen nicht zur Reise mit ID #2#',
308 => 'Keine Zahlungsarten gefunden',
400 => 'IDPartner fehlt',
401 => 'Partner nicht gefunden',
402 => 'Bis-Termin fehlt',
403 => 'Keine Unterbringungsleistungen gefunden',
500 => 'Art fehlt',
501 => 'Reise- und Buchungszeitraum fehlen',
502 => 'Keine Kunden gefunden',
600 => 'Keine Gutscheine gefunden',
601 => 'Gutschein-IDs fehlen',
602 => 'Gutscheine mit ID #1# nicht gefunden',
610 => 'Buchungsart fehlt',
611 => 'Buchungsart falsch',
612 => 'Gutscheinart fehlt',
613 => 'Gutscheinart falsch',
614 => 'Gutscheinstamm-ID fehlt',
615 => 'Gutschein (Stamm) mit ID #1# nicht gefunden',
616 => 'Kapazität beim Gutschein #1# nicht ausreichend',
617 => 'Rechnungsempfänger fehlt',
618 => 'Zahlungsart fehlt',
619 => 'Agentur-ID fehlt',
620 => 'Agentur mit ID #1# nicht gefunden',
650 => '#1#',
700 => 'Keine Agenturen gefunden',
701 => 'Agentur mit ID #1# nicht gefunden',
800 => 'Produkt-ID fehlt',
801 => 'Produkt mit ID #1# nicht gefunden',
805 => 'Es wurden keine Produkte gefunden',
810 => 'Stammdaten (#1#) nicht gefunden',
900 => 'Buchungsart fehlt',
901 => 'Buchungsart falsch',
902 => 'Status fehlt',
903 => 'Status falsch',
904 => 'Agentur-ID fehlt',
905 => 'Agentur mit ID #1# nicht gefunden',
906 => 'Reise-ID fehlt',
907 => 'Reise mit ID #1# nicht gefunden',
908 => 'Reise mit ID #1# ist storniert',
909 => 'Beförderungen fehlen',
910 => 'Leistung mit ID #1# gehört nicht zur Reise',
911 => 'Leistung mit ID #1# gehört nicht zum Produkt',
912 => 'Beförderungsleistung für die #1# fehlt',
913 => 'Unterbringungen fehlen',
914 => 'Partner-ID fehlt',
915 => 'Partner mit ID #1# nicht gefunden',
916 => 'Ferienziel-Unterbringungen fehlen',
917 => 'Ferienziel: Zimmer-IDZ fehlt',
918 => 'Ferienziel: Kategorie fehlt',
919 => 'Ferienziel: Verpflegungs-ID fehlt',
920 => 'Ferienziel: Anreise fehlt',
921 => 'Ferienziel: Anreise passt nicht zur Beförderungsleistung (Hinfahrt)',
922 => 'Ferienziel: Abreise fehlt',
923 => 'Ferienziel: Abreise passt nicht zur Beförderungsleistung (Rückfahrt)',
924 => 'Ferienziel: Keine Preise zu den Daten gefunden',
925 => 'Ferienziel: Preis zu den Daten nicht gefunden',
930 => 'Zustiege fehlen',
931 => 'Zustieg mit ID #1# nicht gefunden',
932 => 'Zustieg mit ID #1# bei Leistung #2# nicht freigegeben',
933 => 'Sitzplan mit ID #1# bei Leistung #2# nicht freigegeben',
935 => 'Versicherung mit ID #1# nicht gefunden',
940 => 'Zahlungsart fehlt',
941 => 'Zahlungsart-ID fehlt',
942 => 'Zahlungsart mit ID #1# nicht gültig',
950 => 'Anmelder fehlt',
951 => 'Teilnehmerliste fehlt',
952 => 'Teilnehmer-ID fehlt',
960 => 'Preisfehler: Struct #1# / Obj #2#',
961 => 'Buchung konnte nicht gespeichert werden',
980 => 'Reise ist fürs Internet gesperrt',
981 => 'Reise ist nicht mehr buchbar (#1#)',
982 => 'Optionsbuchungen nicht zugelassen',
983 => 'Anfragebuchung nicht zugelassen',
984 => 'Leistung mit ID #1# nicht fürs Internet buchbar',
985 => 'Zustieg mit ID #1# nicht fürs Internet buchbar',
999 => 'Systemfehler: #1#',
];
}
@@ -1,26 +0,0 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Model;
/**
* Extended availability details for one service from VERFUEGBARKEIT2.
*
* This model augments classic availability with optional timing/date/description
* fields used to enrich persisted travel snapshots.
*/
class ExtendedAvailability
{
public ?int $serviceId = null;
public ?string $status = null;
public ?int $available = null;
public ?float $price = null;
public ?\DateTimeImmutable $dateFrom = null;
public ?\DateTimeImmutable $dateTo = null;
public ?string $timeFrom = null;
public ?string $description = null;
public ?int $ageFrom = null;
public ?int $ageTo = null;
public ?bool $mandatory = null;
}
@@ -1,30 +0,0 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Model;
/**
* Response model for extended availability endpoint payloads.
*/
class ExtendedServiceAvailabilityResponse
{
/**
* @param array<int, ExtendedAvailability> $services
* @param array<string> $allowedBookingStatus
*/
public function __construct(
private readonly array $services,
public readonly array $allowedBookingStatus = [],
public readonly ?string $travelStatus = null,
) {
}
/**
* @return array<int, ExtendedAvailability>
*/
public function getServices(): array
{
return $this->services;
}
}
+2 -2
View File
@@ -14,9 +14,9 @@ use Symfony\Component\Serializer\Attribute\Groups;
*/
class Guide
{
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?string $name = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?string $phone = null;
}
+7 -7
View File
@@ -15,24 +15,24 @@ use Symfony\Component\Serializer\Attribute\Groups;
*/
class Hotel
{
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $id = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $code = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $name = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $city = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $street = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $phone = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $country = null;
}
-2
View File
@@ -56,9 +56,7 @@ class PersonalData
#[Assert\Valid(groups: ['personal_data'])]
public Communication $communication;
/** @var list<string> */
public array $roles = [];
/** @var list<string> */
public array $hotelCodes = [];
public function __construct()
+9 -10
View File
@@ -17,35 +17,34 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
*/
class Pickup
{
#[Groups(['api:list', 'snapshot'])]
#[Groups(['api:list'])]
public ?int $id = null;
#[Groups(['api:list', 'snapshot'])]
#[Groups(['api:list'])]
public ?string $code = null;
#[Groups(['api:list', 'snapshot'])]
#[Groups(['api:list'])]
public ?string $city = null;
#[Groups(['api:list', 'snapshot'])]
#[Groups(['api:list'])]
public ?string $postalCode = null;
#[Groups(['api:list', 'snapshot'])]
#[Groups(['api:list'])]
public ?string $street = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i'])]
public ?\DateTimeImmutable $time = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?float $price = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?float $priceOutbound = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?float $priceInbound = null;
/** @var list<int> */
#[Groups(['api:booking'])]
public array $mapping = [];
+11 -13
View File
@@ -20,19 +20,19 @@ class Room
public const SELECTION_TYPE_BY_PAX = 'by_pax';
public const SELECTION_TYPE_BY_ROOM = 'by_room';
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $id = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $category = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $boardId = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $code = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $label = null;
#[Groups(['booking'])]
@@ -46,35 +46,33 @@ class Room
#[Groups(['booking'])]
public ?int $totalCount = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $minPax = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $maxPax = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $nights = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $status = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $available = null;
#[Groups(['booking'])]
public ?string $board = null;
/** @var list<int> */
#[Groups(['booking'])]
public array $mapping = [];
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?float $price = null;
#[Groups(['booking'])]
public ?float $totalPrice = null;
/** @var array<int, float|null> */
#[Groups(['booking'])]
public array $individualPrice = [];
+24 -30
View File
@@ -17,90 +17,84 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
*/
class Service
{
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?int $id = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $category = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $status = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public bool $mandatory = false;
#[Groups(['api:single', 'api:list', 'snapshot'])]
public bool $autoBook = false;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $label = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
public ?\DateTimeImmutable $dateFrom = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $timeFrom = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $dayTime = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
public ?\DateTimeImmutable $dateTo = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $subType = null;
#[Groups(['booking'])]
public ?int $totalCount = null;
/** @var list<int> */
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $mapping = [];
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?float $price = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?float $totalPrice = null;
/** @var array<int, float|null> */
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $individualPrice = [];
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?int $available = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $source = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $direction = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?int $ageFrom = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?int $ageTo = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?int $birthYearFrom = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?int $birthYearTo = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $ageConstraintType = null;
/** @var array<string, mixed>|null */
#[Groups(['api:single'])]
public ?array $ageConstraintMetadata = null;
#[Groups(['api:single'])]
public ?string $rawAgeConstraintData = null;
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public ?string $description = null;
/**
@@ -110,6 +104,6 @@ class Service
* When false, this service's price is excluded when determining which insurance
* tier is appropriate for a participant.
*/
#[Groups(['api:single', 'api:list', 'snapshot'])]
#[Groups(['api:single', 'api:list'])]
public bool $includeInInsuranceCalculation = true;
}
-2
View File
@@ -13,9 +13,7 @@ namespace App\BusProNet\Model;
class Surcharge
{
public ?string $label = null;
/** @var list<int> */
public array $mapping = [];
public ?float $totalPrice = null;
/** @var array<int, float|null> */
public array $individualPrice = [];
}
+27 -48
View File
@@ -20,43 +20,40 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
class Travel
{
use SortByPriceTrait;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $id = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $code = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $productCode = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
public ?int $productId = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $label = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?int $hotelId = null;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?Hotel $hotel = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
public ?\DateTimeImmutable $dateFrom = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
public ?\DateTimeImmutable $dateTo = null;
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?string $type = null;
/**
* Travel booking status from BusProNet API.
* Possible values: 'Frei', 'Anfrage', 'Buchungsstop'.
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?string $status = null;
/**
@@ -65,71 +62,53 @@ class Travel
*
* @var array<string>
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $allowedBookingStatus = [];
#[Groups(['api:list', 'api:single', 'snapshot'])]
#[Groups(['api:list', 'api:single'])]
public ?float $priceFrom = null;
/**
* @var array<int, CrmSelectionGroup>
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $selectionGroups = [];
/**
* @var array<int, Service>
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $additionalServices = [];
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $additionalServicesMutable = true;
/**
* @var array<int, Service>
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $transportationServices = [];
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $transportationServicesMutable = true;
/**
* @var array<int, Pickup>
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $pickups = [];
/**
* @var array<int, Pickup>
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $dropOffs = [];
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $pickupsMutable = true;
/**
* @var array<int, Room>
*/
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public array $rooms = [];
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $roomsMutable = true;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $participantDataMutable = true;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public bool $participantCountMutable = true;
#[Groups(['api:single', 'snapshot'])]
#[Groups(['api:single'])]
public ?Guide $guide = null;
/**
* @var array<string|int, Insurance> Available insurances for this travel package
* @var array<Insurance> Available insurances for this travel package
*/
#[Groups(['api:single'])]
public array $insurances = [];
@@ -203,7 +182,7 @@ class Travel
* Maps selection group IDs to their corresponding services based on
* the predefined included services mapping.
*
* @return array<int, CrmSelectionGroup> The included services from selection groups
* @return array<int, Service> The included services from selection groups
*/
public function getIncludedServices(): array
{
@@ -1,58 +0,0 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Service;
use App\BusProNet\Service\Contract\BookingStatusRuleInterface;
use App\Form\Model\BookingDto;
/**
* Registry for booking status evaluation rules.
*
* Evaluates registered rules in priority order and returns the first matching
* status. Falls back to 'F' when no rule applies.
*/
class BookingStatusRuleRegistry
{
private const DEFAULT_STATUS = 'F';
/**
* @var BookingStatusRuleInterface[]
*/
private array $sortedRules;
/**
* @param BookingStatusRuleInterface[] $rules
*/
public function __construct(array $rules)
{
$this->sortedRules = $this->sortRulesByPriority($rules);
}
public function evaluateStatus(BookingDto $bookingDto): string
{
foreach ($this->sortedRules as $rule) {
if (true === $rule->evaluate($bookingDto)) {
return $rule->getStatus();
}
}
return self::DEFAULT_STATUS;
}
/**
* @param BookingStatusRuleInterface[] $rules
*
* @return BookingStatusRuleInterface[]
*/
private function sortRulesByPriority(array $rules): array
{
usort($rules, static fn (
BookingStatusRuleInterface $a,
BookingStatusRuleInterface $b,
): int => $b->getPriority() <=> $a->getPriority());
return $rules;
}
}
@@ -1,36 +0,0 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Service\Contract;
use App\Form\Model\BookingDto;
/**
* Defines the contract for booking status evaluation rules.
*
* Rules are evaluated in priority order. The first matching rule determines
* the enforced booking status.
*/
interface BookingStatusRuleInterface
{
/**
* Evaluates whether this rule applies to the given booking.
*/
public function evaluate(BookingDto $bookingDto): bool;
/**
* Returns the status code to assign when this rule matches.
*/
public function getStatus(): string;
/**
* Returns the rule priority (higher values evaluated first).
*/
public function getPriority(): int;
/**
* Returns a human-readable rule description.
*/
public function getDescription(): string;
}
@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Service\Contract;
use App\Form\Model\ParticipantDto;
/**
* Defines the contract for participant status evaluation rules.
*
* Status rules are evaluated in priority order to determine the appropriate
* status code for a participant during booking creation. The first rule that
* matches (evaluate returns true) determines the participant's status.
*/
interface ParticipantStatusRuleInterface
{
/**
* Evaluates whether this rule applies to the given participant.
*
* @param ParticipantDto $participant The participant to evaluate
*
* @return bool True if this rule applies, false otherwise
*/
public function evaluate(ParticipantDto $participant): bool;
/**
* Returns the status code to assign when this rule matches.
*
* @return string The status code (e.g., 'O' for Option, 'F' for Final)
*/
public function getStatus(): string;
/**
* Returns the priority of this rule.
*
* Higher priority rules are evaluated first. Rules with the same priority
* are evaluated in registration order.
*
* @return int The priority value (higher = evaluated first)
*/
public function getPriority(): int;
/**
* Returns a human-readable description of this rule.
*
* Used for debugging and logging purposes.
*
* @return string Description of what this rule checks
*/
public function getDescription(): string;
}
@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Service;
use App\BusProNet\Service\Contract\ParticipantStatusRuleInterface;
use App\Form\Model\ParticipantDto;
/**
* Registry for participant status evaluation rules.
*
* Manages a collection of status rules and evaluates them in priority order
* to determine the appropriate status code for a participant during booking
* creation. Returns a default status of 'F' (Final) when no rules match.
*/
class ParticipantStatusRuleRegistry
{
private const DEFAULT_STATUS = 'F';
/**
* @var ParticipantStatusRuleInterface[]
*/
private array $sortedRules;
/**
* @param ParticipantStatusRuleInterface[] $rules The rules to register
*/
public function __construct(array $rules)
{
$this->sortedRules = $this->sortRulesByPriority($rules);
}
/**
* Evaluates all rules to determine the participant's status.
*
* Rules are evaluated in priority order (highest first). The first rule
* that matches determines the status. Returns 'F' if no rules match.
*
* @param ParticipantDto $participant The participant to evaluate
*
* @return string The determined status code
*/
public function evaluateStatus(ParticipantDto $participant): string
{
foreach ($this->sortedRules as $rule) {
if (true === $rule->evaluate($participant)) {
return $rule->getStatus();
}
}
return self::DEFAULT_STATUS;
}
/**
* Sorts rules by priority in descending order.
*
* @param ParticipantStatusRuleInterface[] $rules The rules to sort
*
* @return ParticipantStatusRuleInterface[] The sorted rules
*/
private function sortRulesByPriority(array $rules): array
{
usort($rules, static fn (
ParticipantStatusRuleInterface $a,
ParticipantStatusRuleInterface $b,
): int => $b->getPriority() <=> $a->getPriority());
return $rules;
}
}
@@ -5,37 +5,26 @@ declare(strict_types=1);
namespace App\BusProNet\Service\StatusRule;
use App\BusProNet\Model\Service;
use App\BusProNet\Service\Contract\BookingStatusRuleInterface;
use App\Form\Model\BookingDto;
use App\BusProNet\Service\Contract\ParticipantStatusRuleInterface;
use App\Form\Model\ParticipantDto;
/**
* Status rule for bookings with chaperon (Begleitperson) services.
* Status rule for participants with chaperon (Begleitperson) services.
*
* Assigns 'Option' status to bookings where any participant has selected any
* service containing 'Begleitperson' in its label.
* Assigns 'Option' status to participants who have selected any service
* containing 'Begleitperson' in its label. This applies to accompanying
* persons whose booking confirmation may depend on the main participant.
*/
class ChaperonServiceStatusRule implements BookingStatusRuleInterface
class ChaperonServiceStatusRule implements ParticipantStatusRuleInterface
{
private const STATUS = 'O';
private const PRIORITY = 100;
private const SEARCH_TERM = 'begleitperson';
/**
* @see BookingStatusRuleInterface::evaluate()
* @see ParticipantStatusRuleInterface::evaluate()
*/
public function evaluate(BookingDto $bookingDto): bool
{
foreach ($bookingDto->participants as $participant) {
if (true === $this->participantHasChaperonService($participant)) {
return true;
}
}
return false;
}
private function participantHasChaperonService(ParticipantDto $participant): bool
public function evaluate(ParticipantDto $participant): bool
{
// Check array services
$arrayServices = [
@@ -47,7 +36,7 @@ class ChaperonServiceStatusRule implements BookingStatusRuleInterface
foreach ($arrayServices as $services) {
foreach ($services as $service) {
if (true === $this->containsSearchTerm($service->label)) {
if ($service instanceof Service && true === $this->containsSearchTerm($service->label)) {
return true;
}
}
@@ -69,7 +58,7 @@ class ChaperonServiceStatusRule implements BookingStatusRuleInterface
}
/**
* @see BookingStatusRuleInterface::getStatus()
* @see ParticipantStatusRuleInterface::getStatus()
*/
public function getStatus(): string
{
@@ -77,7 +66,7 @@ class ChaperonServiceStatusRule implements BookingStatusRuleInterface
}
/**
* @see BookingStatusRuleInterface::getPriority()
* @see ParticipantStatusRuleInterface::getPriority()
*/
public function getPriority(): int
{
@@ -85,7 +74,7 @@ class ChaperonServiceStatusRule implements BookingStatusRuleInterface
}
/**
* @see BookingStatusRuleInterface::getDescription()
* @see ParticipantStatusRuleInterface::getDescription()
*/
public function getDescription(): string
{
+2 -2
View File
@@ -28,9 +28,9 @@ trait SortByPriceTrait
* collections in the application. Items are sorted from lowest to highest price,
* with null prices being treated as zero (appearing first).
*
* @param array<array-key, object> $items Array of objects with a price property to sort
* @param array $items Array of objects with a price property to sort
*
* @return array<array-key, object> The sorted array of objects (ascending by price)
* @return array The sorted array of objects (ascending by price)
*/
protected function sortByPrice(array $items): array
{
@@ -7,7 +7,6 @@ use Carbon\Exceptions\InvalidFormatException;
trait TypeConversionTrait
{
/** @return list<string> */
protected function stringToArray(?string $string, string $separator = ','): array
{
if (true === empty($string)) {
-7
View File
@@ -11,7 +11,6 @@ use Symfony\Contracts\Cache\ItemInterface;
class HotelLoader extends AbstractLoader
{
/** @return array<int, Hotel> */
public function loadAll(?string $filename = 'hotel.xml'): array
{
try {
@@ -92,12 +91,6 @@ class HotelLoader extends AbstractLoader
public function patchHotelDetails(Travel $travel): void
{
$hotelId = $travel->hotelId;
if (null === $hotelId) {
$travel->hotel = null;
return;
}
try {
$hotel = $this->loadById($hotelId);
$travel->hotel = $hotel;
+1 -2
View File
@@ -22,12 +22,11 @@ class InsuranceLoader extends AbstractLoader
parent::__construct($cache, $xmlExport);
}
/** @return array<string|int, Insurance> */
public function loadAll(?string $filename = 'versicherungen.xml'): array
{
try {
return $this->cache->get('bpn_insurances', function (ItemInterface $item) use ($filename) {
$item->expiresAfter(24 * 60 * 60);
$item->expiresAfter(3 * 60 * 60);
$crawler = $this->loadXml($filename);
-9
View File
@@ -10,7 +10,6 @@ use Symfony\Contracts\Cache\ItemInterface;
class PickupLoader extends AbstractLoader
{
/** @return array<int|string, Pickup> */
public function loadAll(?string $filename = 'zustiege.xml'): array
{
try {
@@ -66,11 +65,6 @@ class PickupLoader extends AbstractLoader
$travel->dropOffs = $this->patchAndOrderDropOffs($travel->dropOffs, $travel->pickups);
}
/**
* @param array<int, Pickup> $pickups
*
* @return array<int, Pickup>
*/
private function patchAndSortPickups(array $pickups): array
{
$this->enrichPickupDetails($pickups);
@@ -143,9 +137,6 @@ class PickupLoader extends AbstractLoader
{
foreach ($pickups as $pickup) {
$pickupData = $this->loadById($pickup->id);
if (null === $pickupData) {
continue;
}
$pickup->code = $pickupData->code;
$pickup->postalCode = $pickupData->postalCode;
+3 -4
View File
@@ -51,7 +51,7 @@ class TravelLoader extends AbstractLoader
* including ID, code, label, dates, and associated hotels. The mapping is
* cached for 3 hours to improve performance.
*
* @return array<int, array<string, mixed>> Mapping of travel IDs to their metadata and file paths
* @return array<int, array> Mapping of travel IDs to their metadata and file paths
*/
public function generateFilesMap(): array
{
@@ -74,7 +74,7 @@ class TravelLoader extends AbstractLoader
$travelDataNodes = $crawler->filterXPath('//reisen/reise/termin');
$travelDataNodes->each(function (Crawler $node) use (&$mapping, $hotels, $file) {
$travelId = (int) $node->attr('idbuspro');
$travelId = $node->attr('idbuspro');
$mapping[$travelId] = [
'id' => $travelId,
@@ -102,7 +102,7 @@ class TravelLoader extends AbstractLoader
return $mapping;
});
} catch (InvalidArgumentException $e) {
throw new \RuntimeException('Cache key error in generateFilesMap', 0, $e);
return [];
}
}
@@ -173,7 +173,6 @@ class TravelLoader extends AbstractLoader
*
* @throws TravelNotFoundException When travel ID is not found
* @throws HotelNotInTravelException When hotel ID exists but not for this travel
* @throws \RuntimeException When cached mapping generation fails unexpectedly
*/
public function loadById(int $dateId, ?int $hotelId = null, ?string $filename = null): Travel
{
@@ -39,7 +39,6 @@ abstract class AbstractParser
return 0 < $node->count() && $this->stringToBool($node->text());
}
/** @return list<string> */
protected function getArrayValue(Crawler $node, string $separator = ','): array
{
if (0 === $node->count()) {
@@ -48,23 +47,4 @@ abstract class AbstractParser
return $this->stringToArray($node->text(), $separator);
}
protected function getAttrOrNullValue(Crawler $node, string $attribute): ?string
{
if (0 === $node->count()) {
return null;
}
return $node->attr($attribute);
}
protected function getRequiredAttrValue(Crawler $node, string $attribute, string $context): string
{
$value = $this->getAttrOrNullValue($node, $attribute);
if (null === $value || '' === trim($value)) {
throw new \InvalidArgumentException(sprintf('Missing required attribute "%s" in %s.', $attribute, $context));
}
return $value;
}
}
@@ -53,7 +53,6 @@ class AgeConstraintParserRegistry
return $this->mergeConstraintResults($results, $constraintData);
}
/** @param list<AgeConstraintResult> $results */
private function mergeConstraintResults(array $results, string $rawData): AgeConstraintResult
{
if (empty($results)) {
+48 -62
View File
@@ -11,7 +11,6 @@ class ApiResponseParser extends AbstractParser
/**
* @throws ResponseParserException
*/
/** @param array<string, mixed> $additionalArgs */
public function parseXmlString(string $type, string $xml, array $additionalArgs = []): mixed
{
$crawler = new Crawler($xml);
@@ -26,69 +25,56 @@ class ApiResponseParser extends AbstractParser
$resultNode = $crawler->filterXPath('//ergebnis');
try {
switch ($responseType) {
case ApiClient::TYPE_NOTIFICATION:
return (new NotificationParser())->parse($crawler);
case ApiClient::TYPE_CUSTOMER_DATA:
$subType = $this->getStringOrNullValue($resultNode->filterXPath('//art'));
if (null === $subType || '' === $subType) {
throw new ResponseParserException('Unable to determine customer data subtype from XML response');
}
switch ($responseType) {
case ApiClient::TYPE_NOTIFICATION:
return (new NotificationParser())->parse($crawler);
case ApiClient::TYPE_CUSTOMER_DATA:
$subType = $resultNode->filterXPath('//art')->text();
switch ($subType) {
case 'Adressdaten':
case 'Adressdaten_Ändern':
case 'Newsletter':
return (new PersonalDataParser())->parse($resultNode);
case 'Adresse_Neu':
return (new ContactFormResponseParser())->parse($resultNode);
case 'SelektionCRM':
case 'SelektionCRM_Ändern':
return (new CrmAttributesResponseParser())->parse($resultNode);
case 'Vorgänge':
return (new BookingsParser())->parse($resultNode);
case 'Vorgang_Details':
return (new BookingParser())->parse($resultNode);
case 'Dokumentdruck':
return (new DocumentsParser())->parseDocuments($resultNode);
case 'Vorgangdruck':
return (new DocumentsParser())->parseConfirmation($resultNode);
}
break;
case ApiClient::TYPE_BASE_DATA_COUNTRIES:
return (new CountriesParser())->parse($resultNode);
case ApiClient::TYPE_MUTABLE_DATA:
return (new MutableDataParser())->parse($resultNode);
case ApiClient::TYPE_AVAILABILITY:
return (new AvailabilitiesParser())->parseServices($resultNode);
case ApiClient::TYPE_AVAILABILITY_EXTENDED:
return (new ExtendedAvailabilitiesParser())->parseServices($resultNode);
case ApiClient::TYPE_AVAILABILITY_HOTEL:
return (new AvailabilitiesParser())->parseRooms($resultNode);
case ApiClient::TYPE_BOOKING_UPDATE:
return (new BookingUpdateParser())->parse($resultNode);
case ApiClient::TYPE_BOOKING:
return (new BookingResponseParser())->parse($resultNode);
case ApiClient::TYPE_PRODUCTS:
return (new ProductsParser())->parse($resultNode);
case ApiClient::TYPE_PRODUCT_DATA:
$travelNode = $crawler->filterXPath('//reise/termin');
switch ($subType) {
case 'Adressdaten':
case 'Adressdaten_Ändern':
case 'Newsletter':
return (new PersonalDataParser())->parse($resultNode);
case 'Adresse_Neu':
return (new ContactFormResponseParser())->parse($resultNode);
case 'SelektionCRM':
case 'SelektionCRM_Ändern':
return (new CrmAttributesResponseParser())->parse($resultNode);
case 'Vorgänge':
return (new BookingsParser())->parse($resultNode);
case 'Vorgang_Details':
return (new BookingParser())->parse($resultNode);
case 'Dokumentdruck':
return (new DocumentsParser())->parseDocuments($resultNode);
case 'Vorgangdruck':
return (new DocumentsParser())->parseConfirmation($resultNode);
}
break;
case ApiClient::TYPE_BASE_DATA_COUNTRIES:
return (new CountriesParser())->parse($resultNode);
case ApiClient::TYPE_MUTABLE_DATA:
return (new MutableDataParser())->parse($resultNode);
case ApiClient::TYPE_AVAILABILITY:
return (new AvailabilitiesParser())->parseServices($resultNode);
case ApiClient::TYPE_AVAILABILITY_HOTEL:
return (new AvailabilitiesParser())->parseRooms($resultNode);
case ApiClient::TYPE_BOOKING_UPDATE:
return (new BookingUpdateParser())->parse($resultNode);
case ApiClient::TYPE_BOOKING:
return (new BookingResponseParser())->parse($resultNode);
case ApiClient::TYPE_PRODUCTS:
return (new ProductsParser())->parse($resultNode);
case ApiClient::TYPE_PRODUCT_DATA:
$travelNode = $crawler->filterXPath('//reise/termin');
if (0 === $travelNode->count()) {
throw new ResponseParserException('No travel data node found in product data response');
}
return (new TravelParser())->parse($travelNode->first(), ...$additionalArgs);
case ApiClient::TYPE_AGENCIES:
return (new AgencyParser())->parse($resultNode);
case ApiClient::TYPE_PURCHASE_VOUCHER:
return (new PurchaseVoucherParser())->parse($resultNode);
case ApiClient::TYPE_PROMO_VOUCHER:
return (new PromoVoucherParser())->parse($resultNode);
}
} catch (\InvalidArgumentException $e) {
throw new ResponseParserException('Invalid XML response structure: '.$e->getMessage(), 0, $e);
return (new TravelParser())->parse($travelNode->first(), ...$additionalArgs);
case ApiClient::TYPE_AGENCIES:
return (new AgencyParser())->parse($resultNode);
case ApiClient::TYPE_PURCHASE_VOUCHER:
return (new PurchaseVoucherParser())->parse($resultNode);
case ApiClient::TYPE_PROMO_VOUCHER:
return (new PromoVoucherParser())->parse($resultNode);
}
throw new ResponseParserException('Unable to parse XML response');
@@ -15,7 +15,6 @@ use Symfony\Component\DomCrawler\Crawler;
*/
class BookingInsurancesParser extends AbstractParser
{
/** @return array<string, Insurance> */
public function parse(Crawler $result): array
{
$insurances = [];
+11 -17
View File
@@ -40,10 +40,10 @@ class BookingParser extends AbstractParser
$travelData = $node->filterXPath('//reise');
$booking->travelName = $this->getAttrOrNullValue($travelData, 'bezeichnung');
$booking->travelName = $travelData->attr('bezeichnung');
$booking->dateId = $this->getIntOrNullValue($node->filterXPath('//idreise'));
$booking->travelCode = $this->getAttrOrNullValue($travelData, 'code');
$booking->travelDate = $this->stringToDate($this->getAttrOrNullValue($travelData, 'termin'));
$booking->travelCode = $travelData->attr('code');
$booking->travelDate = $this->stringToDate($travelData->attr('termin'));
$booking->hotelId = $this->getIntOrNullValue($node->filterXPath('//idpartner'));
$booking->hotelName = $this->getStringOrNullValue($node->filterXPath('//partner'));
@@ -56,17 +56,17 @@ class BookingParser extends AbstractParser
$booking->participants = $this->parseParticipants($node->filterXPath('//teilnehmerliste/teilnehmer'));
$paymentData = $node->filterXPath('//zahlung');
$booking->paymentId = $this->getAttrOrNullValue($paymentData, 'idzahlungsart');
$booking->paymentLabel = $this->getAttrOrNullValue($paymentData, 'bezeichnung');
$booking->paymentType = $this->getAttrOrNullValue($paymentData, 'art');
$booking->paymentId = (int) $paymentData->attr('idzahlungsart');
$booking->paymentLabel = $paymentData->attr('bezeichnung');
$booking->paymentType = $paymentData->attr('art');
if (0 < $paymentData->children()->count()) {
$bankDataNode = $paymentData->children()->first();
$bankAccount = new BankAccount();
$bankAccount->iban = $this->getAttrOrNullValue($bankDataNode, 'iban');
$bankAccount->bic = $this->getAttrOrNullValue($bankDataNode, 'bic');
$bankAccount->bankName = $this->getAttrOrNullValue($bankDataNode, 'kreditinstitut');
$bankAccount->holder = $this->getAttrOrNullValue($bankDataNode, 'kontoinhaber');
$bankAccount->iban = $bankDataNode->attr('iban');
$bankAccount->bic = $bankDataNode->attr('bic');
$bankAccount->bankName = $bankDataNode->attr('kreditinstitut');
$bankAccount->holder = $bankDataNode->attr('kontoinhaber');
$booking->bankAccount = $bankAccount;
}
@@ -112,18 +112,12 @@ class BookingParser extends AbstractParser
return $booking;
}
/** @return array<int, PersonalData> */
private function parseParticipants(Crawler $node): array
{
$participants = [];
$node->each(function (Crawler $node) use (&$participants) {
$id = (int) ($this->getAttrOrNullValue($node, 'id') ?? 0);
if ($id <= 0) {
return;
}
$id = (int) $node->attr('id');
$participants[$id - 1] = $this->parsePersonalData($node);
});
@@ -32,11 +32,7 @@ class BookingResponseParser extends AbstractParser
{
public function parse(Crawler $node): BookingResponse
{
$status = $this->getStringOrNullValue($node->filterXPath('//buchung'));
if (null === $status || '' === $status) {
throw new \InvalidArgumentException('Missing required booking status in booking response.');
}
$status = $node->filterXPath('//buchung')->text();
$bookingNumber = $this->getIntOrNullValue($node->filterXPath('//vorgang'));
$totalPrice = $this->getFloatOrNullValue($node->filterXPath('//gesamtpreis'));
$message = $this->getStringOrNullValue($node->filterXPath('//hinweis'));
@@ -64,24 +60,18 @@ class BookingResponseParser extends AbstractParser
$priceItems = [];
$node->filterXPath('//preise/preis')->each(function (Crawler $priceNode) use (&$priceItems): void {
$position = (int) $this->getRequiredAttrValue($priceNode, 'position', 'booking response price item');
$type = $this->getRequiredAttrValue($priceNode, 'art', 'booking response price item');
$label = $this->getRequiredAttrValue($priceNode, 'bezeichnung', 'booking response price item');
$unitPrice = $this->stringToFloat($this->getRequiredAttrValue($priceNode, 'preis', 'booking response price item'));
$totalPrice = $this->stringToFloat($this->getRequiredAttrValue($priceNode, 'gesamtpreis', 'booking response price item'));
$priceItems[] = new PriceItem(
position: $position,
type: $type,
subType: $this->getAttrOrNullValue($priceNode, 'unterart'),
label: $label,
dateFrom: $this->getAttrOrNullValue($priceNode, 'terminvon'),
dateTo: $this->getAttrOrNullValue($priceNode, 'terminbis'),
quantity: (int) ($this->getAttrOrNullValue($priceNode, 'anzahl') ?? 0),
assignment: $this->getAttrOrNullValue($priceNode, 'zuordnung'),
unitPrice: $unitPrice,
totalPrice: $totalPrice,
id: $this->getAttrOrNullValue($priceNode, 'id')
position: (int) $priceNode->attr('position'),
type: $priceNode->attr('art'),
subType: $priceNode->attr('unterart'),
label: $priceNode->attr('bezeichnung'),
dateFrom: $priceNode->attr('terminvon'),
dateTo: $priceNode->attr('terminbis'),
quantity: (int) $priceNode->attr('anzahl'),
assignment: $priceNode->attr('zuordnung'),
unitPrice: $this->stringToFloat($priceNode->attr('preis')),
totalPrice: $this->stringToFloat($priceNode->attr('gesamtpreis')),
id: $priceNode->attr('id')
);
});
@@ -104,26 +94,25 @@ class BookingResponseParser extends AbstractParser
$finalPaymentAmount = null;
$finalPaymentDate = null;
$depositNode = $paymentNode->filterXPath('.//anzahlung');
$depositNode = $paymentNode->filterXPath('//anzahlung');
if ($depositNode->count() > 0) {
$depositAmount = $this->stringToFloat($this->getAttrOrNullValue($depositNode, 'betrag'));
$depositDate = $this->getAttrOrNullValue($depositNode, 'termin');
$depositAmount = $this->stringToFloat($depositNode->attr('betrag'));
$depositDate = $depositNode->attr('termin');
}
$finalPaymentNode = $paymentNode->filterXPath('.//restzahlung');
$finalPaymentNode = $paymentNode->filterXPath('//restzahlung');
if ($finalPaymentNode->count() > 0) {
$finalPaymentAmount = $this->stringToFloat($this->getAttrOrNullValue($finalPaymentNode, 'betrag'));
$finalPaymentDate = $this->getAttrOrNullValue($finalPaymentNode, 'termin');
$finalPaymentAmount = $this->stringToFloat($finalPaymentNode->attr('betrag'));
$finalPaymentDate = $finalPaymentNode->attr('termin');
}
// Parse purchase vouchers (kaufgutschein elements)
$appliedPurchaseVouchers = [];
$voucherNodes = $paymentNode->filterXPath('.//kaufgutschein');
$voucherNodes = $paymentNode->filterXPath('//kaufgutschein');
$voucherNodes->each(function (Crawler $voucherNode) use (&$appliedPurchaseVouchers): void {
$amount = $this->getAttrOrNullValue($voucherNode, 'betrag');
$appliedPurchaseVouchers[] = [
'nummer' => $this->getAttrOrNullValue($voucherNode, 'nummer') ?? '',
'betrag' => $this->stringToFloat($amount),
'nummer' => $voucherNode->attr('nummer') ?? '',
'betrag' => $this->stringToFloat($voucherNode->attr('betrag')),
];
});
@@ -9,12 +9,10 @@ class BookingUpdateParser extends AbstractParser
{
public function parse(Crawler $node): BookingUpdate
{
$changeStatus = $this->getStringOrNullValue($node->filterXPath('//aenderung'));
$bookingUpdate = new BookingUpdate();
$bookingUpdate->valid = 'möglich' === $changeStatus;
$bookingUpdate->success = 'erfolgt' === $changeStatus;
$bookingUpdate->status = $this->getStringOrNullValue($node->filterXPath('//status'));
$bookingUpdate->valid = 'möglich' === $node->filterXPath('//aenderung')->text();
$bookingUpdate->success = 'erfolgt' === $node->filterXPath('//aenderung')->text();
$bookingUpdate->status = $node->filterXPath('//status')->text();
return $bookingUpdate;
}
@@ -21,6 +21,7 @@ class BookingsParser extends AbstractParser
$booking = new Booking();
$booking->id = $this->getIntOrNullValue($node->filterXPath('//id'));
$booking->applicantId = $this->getIntOrNullValue($node->filterXPath('//idadresse_anmelder'));
$booking->bookingNumber = $this->getIntOrNullValue($node->filterXPath('//vorgangsnummer'));
$booking->status = $this->getStringOrNullValue($node->filterXPath('//status'));
$booking->participantCount = $this->getIntOrNullValue($node->filterXPath('//personen'));
@@ -11,12 +11,8 @@ class ContactFormResponseParser extends AbstractParser
{
public function parse(Crawler $node): RegistrationResponse
{
$addressId = $this->getIntOrNullValue($node->filterXPath('//idadresse'));
$personId = $this->getIntOrNullValue($node->filterXPath('//idperson'));
if (null === $addressId || null === $personId) {
throw new \InvalidArgumentException('Missing required idadresse or idperson in contact form response.');
}
$addressId = (int) $node->filterXPath('//idadresse')->text();
$personId = (int) $node->filterXPath('//idperson')->text();
$isNewRecord = $this->getBoolValue($node->filterXPath('//neuanlage'));
return new RegistrationResponse(
@@ -27,7 +27,7 @@ class CrmAttributesResponseParser
$result
->filterXPath('//selektionsmerkmale/selektionsgruppe')
->each(function (Crawler $node) use (&$groups, &$roles) {
->each(function (Crawler $node) use (&$groups, &$roles, &$hotelCode) {
$group = new CrmSelectionGroup();
$group->id = (int) $node->attr('id');
$group->label = $node->attr('bezeichnung');
@@ -47,14 +47,14 @@ class CrmAttributesResponseParser
$roles[] = 'ROLE_HOUSE_MANAGER';
$hotelCodes[] = $matches[1];
}
if (self::BPN_CRM_ID_ADMIN === $attribute->id && true === $attribute->selected) {
if (static::BPN_CRM_ID_ADMIN === $attribute->id && true === $attribute->selected) {
$roles[] = 'ROLE_ADMIN';
$roles[] = 'ROLE_HOUSE_MANAGER';
}
if (self::BPN_CRM_ID_MANAGER === $attribute->id && true === $attribute->selected) {
if (static::BPN_CRM_ID_MANAGER === $attribute->id && true === $attribute->selected) {
$roles[] = 'ROLE_MANAGER';
}
if (self::BPN_CRM_ID_TEAMER === $attribute->id && true === $attribute->selected) {
if (static::BPN_CRM_ID_TEAMER === $attribute->id && true === $attribute->selected) {
$roles[] = 'ROLE_TEAMER';
}
@@ -90,7 +90,7 @@ class CrmAttributesResponseParser
;
if (true === in_array('ROLE_ADMIN', $roles, true)) {
$hotelCodes[] = self::BPN_DEFAULT_HOTEL_CODE;
$hotelCodes[] = static::BPN_DEFAULT_HOTEL_CODE;
}
$response = new CrmAttributes();
+3 -18
View File
@@ -44,30 +44,15 @@ class DocumentsParser
private function decode(Crawler $node): string
{
if (0 === $node->count()) {
throw new \InvalidArgumentException('Missing PDF node in document response.');
}
$parts = explode(',', $node->text(), 2);
if (2 !== count($parts)) {
throw new \InvalidArgumentException('Invalid PDF payload in document response.');
}
[, $pdfData] = $parts;
[, $pdfData] = explode(',', $node->text());
return base64_decode($pdfData);
}
/** @return array{string, string} */
private function getFileInfo(Crawler $node): array
{
$pdfData = $this->decode($node->filterXPath('.//pdf'));
$filenameNode = $node->filterXPath('.//datei');
if (0 === $filenameNode->count()) {
throw new \InvalidArgumentException('Missing filename node in document response.');
}
$filename = $filenameNode->text();
$pdfData = $this->decode($node->filterXPath('//pdf'));
$filename = $node->filterXPath('//datei')->text();
return [$filename, $pdfData];
}
@@ -1,75 +0,0 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\XmlParser;
use App\BusProNet\Model\ExtendedAvailability;
use App\BusProNet\Model\ExtendedServiceAvailabilityResponse;
use Symfony\Component\DomCrawler\Crawler;
/**
* Parser for VERFUEGBARKEIT2 service payloads.
*
* Extracts extended service-level attributes (dates, times, hints, constraints)
* plus optional travel-level booking-status metadata.
*/
class ExtendedAvailabilitiesParser extends AbstractParser
{
/**
* Parses extended availability services from API result node.
*/
public function parseServices(Crawler $result): ExtendedServiceAvailabilityResponse
{
$availabilities = [];
$result
->filterXPath('//leistungen/leistung')
->each(function (Crawler $node) use (&$availabilities) {
$serviceId = (int) $node->attr('id');
$availability = new ExtendedAvailability();
$availability->serviceId = $serviceId;
$availability->status = $node->attr('status');
$availability->available = (int) $node->attr('frei');
$availability->price = $this->stringToFloat($node->attr('preis'));
$availability->dateFrom = $this->stringToDate($node->attr('termin'));
$availability->dateTo = $this->stringToDate($node->attr('bis'));
$availability->timeFrom = $node->attr('uhrzeit_von');
$availability->description = $node->attr('hinweis');
$ageFrom = $node->attr('altervon');
if (null !== $ageFrom && '' !== trim($ageFrom)) {
$availability->ageFrom = (int) $ageFrom;
}
$ageTo = $node->attr('alterbis');
if (null !== $ageTo && '' !== trim($ageTo)) {
$availability->ageTo = (int) $ageTo;
}
$mandatory = $node->attr('pflicht');
if (null !== $mandatory && '' !== trim($mandatory)) {
$availability->mandatory = $this->stringToBool($mandatory);
}
$availabilities[$serviceId] = $availability;
})
;
$allowedBookingStatus = [];
$travelStatus = null;
$reiseNode = $result->filterXPath('//reise');
if (0 < $reiseNode->count()) {
$travelStatus = $reiseNode->attr('status');
$bookingStatusPossible = $reiseNode->attr('buchungstatusmoeglich') ?? '';
if ('' !== trim($bookingStatusPossible)) {
$allowedBookingStatus = str_split($bookingStatusPossible);
}
}
return new ExtendedServiceAvailabilityResponse($availabilities, $allowedBookingStatus, $travelStatus);
}
}
+11 -11
View File
@@ -37,7 +37,7 @@ class InsuranceParser extends AbstractParser
// Parse all individual insurances for reference lookup
$insurance = $this->parseInsuranceNode($node, false);
if (null !== $insurance->id) {
if (null !== $insurance && null !== $insurance->id) {
// Set complementary flag from XML attribute
$insurance->complementary = $isComplementary;
@@ -53,7 +53,7 @@ class InsuranceParser extends AbstractParser
$xmlContent->filterXPath('//versicherungspakete/versicherungspaket')
->each(function (Crawler $node) use (&$insurances, $individualInsurances) {
$insurance = $this->parseInsuranceNode($node, true, $individualInsurances);
if (null !== $insurance->id) {
if (null !== $insurance && null !== $insurance->id) {
// Parse contained insurance IDs
$insurance->containedInsuranceIds = $this->parseContainedInsuranceIds($node);
@@ -75,8 +75,8 @@ class InsuranceParser extends AbstractParser
/**
* Determines if a package contains any family insurances.
*
* @param Crawler $packageNode The package XML node
* @param array<string, Insurance> $individualInsurances Parsed individual insurances for reference
* @param Crawler $packageNode The package XML node
* @param array<int, Insurance> $individualInsurances Parsed individual insurances for reference
*
* @return bool True if any contained insurance is a family insurance
*/
@@ -96,13 +96,13 @@ class InsuranceParser extends AbstractParser
/**
* Parses a single insurance or package node.
*
* @param Crawler $node The XML node to parse
* @param bool $isPackage Whether this is a package node
* @param array<string, Insurance> $individualInsurances Individual insurances for package family detection
* @param Crawler $node The XML node to parse
* @param bool $isPackage Whether this is a package node
* @param array<int, Insurance> $individualInsurances Individual insurances for package family detection
*
* @return Insurance The parsed insurance object
* @return Insurance|null The parsed insurance object
*/
private function parseInsuranceNode(Crawler $node, bool $isPackage, array $individualInsurances = []): Insurance
private function parseInsuranceNode(Crawler $node, bool $isPackage, array $individualInsurances = []): ?Insurance
{
$insurance = new Insurance();
$insurance->package = $isPackage;
@@ -159,7 +159,7 @@ class InsuranceParser extends AbstractParser
*
* @param Crawler $xmlContent The XML content to scan
*
* @return list<string> Array of referenced insurance IDs
* @return array<int> Array of referenced insurance IDs
*/
private function collectReferencedInsuranceIds(Crawler $xmlContent): array
{
@@ -180,7 +180,7 @@ class InsuranceParser extends AbstractParser
*
* @param Crawler $node The package XML node
*
* @return list<string> Array of contained insurance IDs
* @return array<int> Array of contained insurance IDs (always int, as they reference individual insurances)
*/
private function parseContainedInsuranceIds(Crawler $node): array
{
@@ -57,7 +57,7 @@ class PersonalDataParser extends AbstractParser
$remarksNode = $addressDataNode->filterXPath('//bemerkung');
if (0 < $remarksNode->count()) {
$personalData->remarks = $this->getStringOrNullValue($remarksNode);
$personalData->remarks = $remarksNode->text();
}
return $personalData;
@@ -7,7 +7,6 @@ use Symfony\Component\DomCrawler\Crawler;
class PickupsParser extends AbstractParser
{
/** @return array<int, Pickup> */
public function parse(Crawler $result): array
{
$pickups = [];
-1
View File
@@ -7,7 +7,6 @@ use Symfony\Component\DomCrawler\Crawler;
class RoomsParser extends AbstractParser
{
/** @return array<int, Room> */
public function parse(Crawler $result): array
{
$rooms = [];
@@ -8,7 +8,6 @@ use Symfony\Component\DomCrawler\Crawler;
class ServicesParser extends AbstractParser
{
/** @return array<int, Service> */
public function parse(Crawler $result, string $category, string $source): array
{
$services = [];
@@ -7,7 +7,6 @@ use Symfony\Component\DomCrawler\Crawler;
class SurchargesParser extends AbstractParser
{
/** @return list<Surcharge> */
public function parse(Crawler $result): array
{
$surcharges = [];
+61 -86
View File
@@ -49,45 +49,35 @@ class TravelParser extends AbstractParser
*/
public function parse(Crawler $node, ?int $hotelId = null): Travel
{
if (0 === $node->count()) {
throw new \InvalidArgumentException('Cannot parse travel from empty XML node.');
}
$hotelNode = $this->getHotelNode($node, $hotelId);
$dateFrom = $this->stringToDate($this->getRequiredAttrValue($node, 'termin', 'travel termin node'));
$dateTo = $this->stringToDate($this->getRequiredAttrValue($node, 'bis', 'travel termin node'));
$dateFrom = $this->stringToDate($node->attr('termin'));
$dateTo = $this->stringToDate($node->attr('bis'));
$travel = new Travel();
$travel->id = (int) $this->getRequiredAttrValue($node, 'idbuspro', 'travel termin node');
$travel->hotelId = null !== $hotelNode
? (int) $this->getRequiredAttrValue($hotelNode, 'idbuspro', 'travel hotel node')
: null;
$travel->label = $this->getStringOrNullValue($node->filterXPath('.//text'));
$travel->id = (int) $node->attr('idbuspro');
$travel->hotelId = (int) $hotelNode->attr('idbuspro');
$travel->label = $this->getStringOrNullValue($node->filterXPath('//text'));
$travel->dateFrom = $dateFrom;
$travel->dateTo = $dateTo;
$travel->code = $this->getAttrOrNullValue($node, 'code');
$travel->productId = null !== $this->getAttrOrNullValue($node, 'idprodukt')
? (int) $this->getAttrOrNullValue($node, 'idprodukt')
: null;
$travel->code = $node->attr('code');
// Parse product code from parent reise node using DOM
$domNode = $node->getNode(0);
if (null !== $domNode && $domNode->parentNode instanceof \DOMElement) {
if (null !== $domNode && null !== $domNode->parentNode) {
$travel->productCode = $domNode->parentNode->getAttribute('code');
}
$travel->type = $this->getAttrOrNullValue($node, 'reiseart');
$travel->priceFrom = $this->stringToFloat($this->getStringOrNullValue($node->filterXPath('.//abpreis')));
$travel->selectionGroups = $this->getSelectionGroups($node->filterXPath('.//selektiongruppe'));
// Parse only termin-level additional services; exclude hotel-nested duplicates that can override flags.
$travel->type = $node->attr('reiseart');
$travel->priceFrom = $this->stringToFloat($this->getStringOrNullValue($node->filterXPath('//abpreis')));
$travel->selectionGroups = $this->getSelectionGroups($node->filterXPath('//selektiongruppe'));
$travel->additionalServices = $this
->getAdditionalServices($node->filterXPath('.//lei_sonstiges[not(ancestor::hotel)]/leistung'));
->getAdditionalServices($node->filterXPath('//lei_sonstiges/leistung'));
$travel->transportationServices = $this
->getTransportationServices($node->filterXPath('.//lei_befoerderung/leistung'));
$travel->rooms = null !== $hotelNode ? $this->getRooms($hotelNode) : [];
$travel->pickups = $this->getPickups($node->filterXPath('.//zustiege/zustieg'), $dateFrom, true);
$travel->dropOffs = $this->getPickups($node->filterXPath('.//zustiege_rueck/zustieg_rueck'), $dateTo, false);
->getTransportationServices($node->filterXPath('//lei_befoerderung/leistung'));
$travel->rooms = $this->getRooms($hotelNode);
$travel->pickups = $this->getPickups($node->filterXPath('//zustiege/zustieg'), $dateFrom, true);
$travel->dropOffs = $this->getPickups($node->filterXPath('//zustiege_rueck/zustieg_rueck'), $dateTo, false);
// Merge drop-off prices into pickups for split pricing support
$this->mergeDropOffPricesIntoPickups($travel->pickups, $travel->dropOffs);
@@ -112,19 +102,19 @@ class TravelParser extends AbstractParser
$selectionGroups = [];
$node->each(function (Crawler $groupNode) use (&$selectionGroups) {
$groupId = (int) $this->getRequiredAttrValue($groupNode, 'idbuspro', 'selection group node');
$groupId = (int) $groupNode->attr('idbuspro');
$selectionGroup = new CrmSelectionGroup();
$selectionGroup->id = $groupId;
$selectionGroup->label = $this->getAttrOrNullValue($groupNode, 'bezeichnung');
$selectionGroup->label = $groupNode->attr('bezeichnung');
$groupNode
->filterXPath('.//selektion')
->filterXPath('//selektion')
->each(function (Crawler $selectionNode) use (&$selectionGroups, &$selectionGroup, $groupId) {
$selectionId = (int) $this->getRequiredAttrValue($selectionNode, 'idbuspro', 'selection node');
$selectionId = (int) $selectionNode->attr('idbuspro');
$selection = new CrmSelection();
$selection->id = $selectionId;
$selection->label = $this->getAttrOrNullValue($selectionNode, 'bezeichnung');
$selectionGroups[$groupId]['selections'][$selectionId] = $this->getAttrOrNullValue($selectionNode, 'bezeichnung');
$selection->label = $selectionNode->attr('bezeichnung');
$selectionGroups[$groupId]['selections'][$selectionId] = $selectionNode->attr('bezeichnung');
$selectionGroup->selections[] = $selection;
})
;
@@ -150,26 +140,23 @@ class TravelParser extends AbstractParser
$additionalServices = [];
$node->each(function (Crawler $serviceNode) use (&$additionalServices) {
$serviceId = (int) $this->getRequiredAttrValue($serviceNode, 'idbuspro', 'additional service node');
$serviceId = (int) $serviceNode->attr('idbuspro');
$service = new Service();
$service->source = Constants::SOURCE_TRAVEL;
$service->category = Constants::CATEGORY_ADDITIONAL;
$service->id = $serviceId;
$service->subType = $this->getAttrOrNullValue($serviceNode, 'unterart');
$service->mandatory = $this->stringToBool($this->getAttrOrNullValue($serviceNode, 'pflicht'));
$autoBookValue = $this->getAttrOrNullValue($serviceNode, 'automatisch_buchen');
$service->autoBook = $this->stringToBool($autoBookValue)
|| 'true' === strtolower((string) $autoBookValue);
$service->dateFrom = $this->stringToDate($this->getAttrOrNullValue($serviceNode, 'termin'));
$service->dateTo = $this->stringToDate($this->getAttrOrNullValue($serviceNode, 'bis'));
$service->label = $this->getStringOrNullValue($serviceNode->filterXPath('.//text'));
$service->subType = $serviceNode->attr('unterart');
$service->mandatory = $this->stringToBool($serviceNode->attr('pflicht'));
$service->dateFrom = $this->stringToDate($serviceNode->attr('termin'));
$service->dateTo = $this->stringToDate($serviceNode->attr('bis'));
$service->label = $this->getStringOrNullValue($serviceNode->filterXPath('//text'));
$service->price = $this
->stringToFloat($this->getStringOrNullValue($serviceNode->filterXPath('.//preis')));
$service->status = $this->getStringOrNullValue($serviceNode->filterXPath('.//status'));
->stringToFloat($this->getStringOrNullValue($serviceNode->filterXPath('//preis')));
$service->status = $this->getStringOrNullValue($serviceNode->filterXPath('//status'));
// Parse optional description from hinweis node
$description = $this->getStringOrNullValue($serviceNode->filterXPath('.//hinweis'));
$description = $this->getStringOrNullValue($serviceNode->filterXPath('//hinweis'));
if (null !== $description && '' !== trim($description)) {
$service->description = $description;
}
@@ -178,7 +165,7 @@ class TravelParser extends AbstractParser
$this->parseServiceAgeConstraints($serviceNode, $service);
// Parse insurance calculation flag
$service->includeInInsuranceCalculation = $this->stringToBool($this->getAttrOrNullValue($serviceNode, 'versicherungsberechnung'));
$service->includeInInsuranceCalculation = $this->stringToBool($serviceNode->attr('versicherungsberechnung'));
$additionalServices[$serviceId] = $service;
});
@@ -201,34 +188,34 @@ class TravelParser extends AbstractParser
$transportationServices = [];
$node->each(function (Crawler $serviceNode) use (&$transportationServices) {
$serviceId = (int) $this->getRequiredAttrValue($serviceNode, 'idbuspro', 'transportation service node');
$serviceId = (int) $serviceNode->attr('idbuspro');
$service = new Service();
$service->source = Constants::SOURCE_TRAVEL;
$service->category = Constants::CATEGORY_TRANSPORTATION;
$service->id = $serviceId;
$service->subType = $this->getAttrOrNullValue($serviceNode, 'unterart');
$service->dateFrom = $this->stringToDate($this->getAttrOrNullValue($serviceNode, 'termin'));
$service->dateTo = $this->stringToDate($this->getAttrOrNullValue($serviceNode, 'bis'));
$service->label = $this->getStringOrNullValue($serviceNode->filterXPath('.//text'));
$service->direction = $this->getStringOrNullValue($serviceNode->filterXPath('.//richtung'));
$service->status = $this->getStringOrNullValue($serviceNode->filterXPath('.//status'));
$service->subType = $serviceNode->attr('unterart');
$service->dateFrom = $this->stringToDate($serviceNode->attr('termin'));
$service->dateTo = $this->stringToDate($serviceNode->attr('bis'));
$service->label = $this->getStringOrNullValue($serviceNode->filterXPath('//text'));
$service->direction = $this->getStringOrNullValue($serviceNode->filterXPath('//richtung'));
$service->status = $this->getStringOrNullValue($serviceNode->filterXPath('//status'));
$service->price = $this
->stringToFloat($this->getStringOrNullValue($serviceNode->filterXPath('.//preis')));
->stringToFloat($this->getStringOrNullValue($serviceNode->filterXPath('//preis')));
// Parse optional description from hinweis node
$description = $this->getStringOrNullValue($serviceNode->filterXPath('.//hinweis'));
$description = $this->getStringOrNullValue($serviceNode->filterXPath('//hinweis'));
if (null !== $description && '' !== trim($description)) {
$service->description = $description;
}
if (null !== $timeFrom = $this->getAttrOrNullValue($serviceNode, 'uhrzeit_von')) {
if (null !== $timeFrom = $serviceNode->attr('uhrzeit_von')) {
$service->timeFrom = $timeFrom;
$service->dayTime = (new DayTimeUtility())->mapTime($timeFrom);
}
// Parse insurance calculation flag
$service->includeInInsuranceCalculation = $this->stringToBool($this->getAttrOrNullValue($serviceNode, 'versicherungsberechnung'));
$service->includeInInsuranceCalculation = $this->stringToBool($serviceNode->attr('versicherungsberechnung'));
$transportationServices[$serviceId] = $service;
});
@@ -255,8 +242,8 @@ class TravelParser extends AbstractParser
$guideNode = $guideNodes->first();
$guide = new Guide();
$guide->name = $this->getStringOrNullValue($guideNode->filterXPath('.//name'));
$guide->phone = $this->getStringOrNullValue($guideNode->filterXPath('.//telefon'));
$guide->name = $this->getStringOrNullValue($guideNode->filterXPath('//name'));
$guide->phone = $this->getStringOrNullValue($guideNode->filterXPath('//telefon'));
return $guide;
}
@@ -324,26 +311,16 @@ class TravelParser extends AbstractParser
* @param Crawler $node The XML node containing hotel data
* @param int|null $hotelId Optional hotel ID to filter by
*
* @return Crawler|null The hotel XML node or null if none exists and no specific hotel was requested
* @return Crawler The hotel XML node
*/
public function getHotelNode(Crawler $node, ?int $hotelId): ?Crawler
public function getHotelNode(Crawler $node, ?int $hotelId): Crawler
{
// In case not hotel id is provided, take the first hotel node (which is most probably the only one)
if (null === $hotelId) {
$hotelNode = $node->filterXPath('.//hotel');
if (0 === $hotelNode->count()) {
return null;
}
return $hotelNode->first();
return $node->filterXPath('//hotel')->first();
}
$hotelNode = $node->filterXPath(sprintf('.//hotel[@idbuspro="%d"]', $hotelId));
if (0 === $hotelNode->count()) {
throw new \InvalidArgumentException(sprintf('No hotel node found for idbuspro %d.', $hotelId));
}
$hotelNode = $node->filterXPath(sprintf('//hotel[@idbuspro="%d"]', $hotelId));
return $hotelNode->first();
}
@@ -360,7 +337,7 @@ class TravelParser extends AbstractParser
*/
public function getRooms(Crawler $node): array
{
$roomNodes = $node->filterXPath('.//zimmer/preis');
$roomNodes = $node->filterXPath('//zimmer/preis');
if (0 === $roomNodes->count()) {
return [];
@@ -369,29 +346,27 @@ class TravelParser extends AbstractParser
$rooms = [];
$roomNodes->each(function (Crawler $roomNode) use (&$rooms) {
$roomCode = $this->getAttrOrNullValue($roomNode, 'zimmercode');
$roomCode = $roomNode->attr('zimmercode');
if (true === in_array($roomCode, $this->ignoredRoomCodes, true)) {
return;
}
$roomId = (int) $this->getRequiredAttrValue($roomNode, 'idbuspro_zimmer', 'room price node');
$roomId = (int) $roomNode->attr('idbuspro_zimmer');
$room = new Room();
$room->id = $roomId;
$room->code = $roomCode;
$room->category = $this->getAttrOrNullValue($roomNode, 'kat');
$room->boardId = (int) $this->getAttrOrNullValue($roomNode, 'idbuspro_vp');
$room->label = $this->getAttrOrNullValue($roomNode, 'zimmertext');
$room->minPax = (int) $this->getAttrOrNullValue($roomNode, 'minpax');
$room->maxPax = (int) $this->getAttrOrNullValue($roomNode, 'maxpax');
$room->nights = (int) $this->getAttrOrNullValue($roomNode, 'naechte');
$roomPrice = $this->getAttrOrNullValue($roomNode, 'preis');
$room->price = null !== $roomPrice && '' !== $roomPrice
? $this->stringToFloat($roomPrice)
: null;
$room->status = $this->getAttrOrNullValue($roomNode, 'status');
$room->available = (int) $this->getAttrOrNullValue($roomNode, 'verfuegbar');
$room->category = $roomNode->attr('kat');
$room->boardId = (int) $roomNode->attr('idbuspro_vp');
$room->label = $roomNode->attr('zimmertext');
$room->minPax = (int) $roomNode->attr('minpax');
$room->maxPax = (int) $roomNode->attr('maxpax');
$room->nights = (int) $roomNode->attr('naechte');
$room->price = $roomNode->attr('preis') ?
$this->stringToFloat($roomNode->attr('preis')) : null;
$room->status = $roomNode->attr('status');
$room->available = (int) $roomNode->attr('verfuegbar');
$rooms[$roomId] = $room;
});
@@ -1,96 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\BusProNet\XmlLoader\TravelLoader;
use App\Service\TravelSnapshotManager;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\LockableTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'app:bpn:refresh-travel-snapshot',
description: 'Refreshes active travel snapshots using extended availability data.',
)]
/**
* Console entrypoint for refreshing persisted travel snapshots.
*
* Runs extended availability enrichment in batch mode and triggers
* retention cleanup in the same invocation.
*/
class BpnRefreshTravelSnapshotCommand extends Command
{
use LockableTrait;
public function __construct(
private readonly TravelSnapshotManager $snapshotService,
private readonly LoggerInterface $logger,
private readonly TravelLoader $travelLoader,
) {
parent::__construct();
}
/**
* Configures refresh-control and cleanup options.
*/
protected function configure(): void
{
$this
->addOption('limit', null, InputOption::VALUE_REQUIRED, 'Maximum number of snapshots to process', '500')
->addOption('force', 'f', InputOption::VALUE_NONE, 'Refresh even if snapshot was refreshed recently')
->addOption('refresh-after', null, InputOption::VALUE_REQUIRED, 'Minimum minutes since last refresh before a snapshot is eligible (ignored with --force)', '360')
;
}
/**
* Executes snapshot refresh and purge flow.
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
if (false === $this->lock('bpn_xml_sync')) {
$this->logger->info('Snapshot refresh skipped: xml-sync is running');
return Command::SUCCESS;
}
$limit = (int) $input->getOption('limit');
$force = true === $input->getOption('force');
$refreshAfterMinutes = (int) $input->getOption('refresh-after');
$xmlFileMap = null;
try {
$xmlFileMap = $this->travelLoader->generateFilesMap();
} catch (\Throwable $e) {
$this->logger->warning('Failed to load XML files map for snapshot refresh filtering; skipping all candidates', [
'error' => $e->getMessage(),
]);
}
// Phase 2 — enrich non-XML-backed snapshots via extended-availability API
$xmlDateIds = null !== $xmlFileMap ? array_keys($xmlFileMap) : null;
$result = $this->snapshotService->refreshExtendedSnapshots($limit, $force, $refreshAfterMinutes, $xmlDateIds);
$io->success(sprintf(
'Snapshot refresh complete: %d processed, %d updated, %d failed',
$result['processed'],
$result['updated'],
$result['failed']
));
$this->logger->info('Travel snapshot refresh finished', $result);
$deleted = $this->snapshotService->purgeExpiredSnapshots();
$io->note(sprintf('Deleted %d expired snapshots.', $deleted));
return Command::SUCCESS;
}
}
+21 -87
View File
@@ -5,9 +5,6 @@ declare(strict_types=1);
namespace App\Command;
use App\BusProNet\Model\XmlExportInfo;
use App\BusProNet\XmlLoader\TravelLoader;
use App\Service\TravelDataProvider;
use App\Service\TravelSnapshotManager;
use League\Flysystem\FilesystemException;
use League\Flysystem\FilesystemOperator;
use League\Flysystem\StorageAttributes;
@@ -33,6 +30,7 @@ class BpnXmlSyncCommand extends Command
'bpn_travels_mapping',
'bpn_hotels',
'bpn_pickups',
'bpn_insurances',
];
public function __construct(
@@ -40,9 +38,6 @@ class BpnXmlSyncCommand extends Command
private readonly FilesystemOperator $xmlExport,
private readonly CacheInterface $cache,
private readonly LoggerInterface $logger,
private readonly TravelLoader $travelLoader,
private readonly TravelDataProvider $travelDataService,
private readonly TravelSnapshotManager $snapshotService,
) {
parent::__construct();
}
@@ -58,7 +53,7 @@ class BpnXmlSyncCommand extends Command
{
$io = new SymfonyStyle($input, $output);
if (false === $this->lock('bpn_xml_sync')) {
if (false === $this->lock()) {
$io->warning('Sync is already running in another process');
$this->logger->info('XML sync skipped: another instance is running');
@@ -76,11 +71,19 @@ class BpnXmlSyncCommand extends Command
return Command::SUCCESS;
}
$io->text($this->formatInfoLine('Remote', $remoteInfo, $output));
$io->text(sprintf(
'Remote: %s (%d files)',
$remoteInfo->lastTransfer->format('d.m.Y H:i:s'),
$remoteInfo->fileCount
));
$localInfo = $this->readLocalInfo();
if (null !== $localInfo) {
$io->text($this->formatInfoLine('Local', $localInfo, $output));
$io->text(sprintf(
'Local: %s (%d files)',
$localInfo->lastTransfer->format('d.m.Y H:i:s'),
$localInfo->fileCount
));
} else {
$io->text('Local: no data');
}
@@ -103,7 +106,7 @@ class BpnXmlSyncCommand extends Command
$io->section('Syncing files');
try {
$syncResult = $this->syncFiles($io);
$syncedCount = $this->syncFiles($io);
} catch (FilesystemException $e) {
$io->error(sprintf('Sync failed: %s', $e->getMessage()));
$this->logger->error('XML sync failed during file transfer', ['exception' => $e]);
@@ -112,49 +115,11 @@ class BpnXmlSyncCommand extends Command
}
$this->invalidateCaches();
$io->info(sprintf('Invalidated %d cache keys', count(self::CACHE_KEYS_TO_INVALIDATE)));
$io->text(sprintf('Invalidated %d cache keys', count(self::CACHE_KEYS_TO_INVALIDATE)));
$io->section('Refreshing snapshots');
$xmlFileMap = null;
$snapshotResult = null;
$orphanedDeleted = null;
try {
$xmlFileMap = $this->travelLoader->generateFilesMap();
} catch (\Throwable $e) {
$this->logger->warning('Failed to generate XML file map after sync; snapshot refresh skipped', [
'error' => $e->getMessage(),
]);
}
if (null !== $xmlFileMap) {
$total = array_sum(array_map(fn ($entry) => count($entry['hotels']), $xmlFileMap));
$io->progressStart($total);
$snapshotResult = $this->travelDataService->syncSnapshotsFromXml(
$xmlFileMap,
function () use ($io): void { $io->progressAdvance(); },
);
$io->progressFinish();
$orphanedDeleted = $this->snapshotService->purgeOrphanedFutureSnapshots(array_keys($xmlFileMap));
}
$successMessage = sprintf('Sync complete: %d files updated, %d files deleted', $syncResult['updated'], $syncResult['deleted']);
if (null !== $snapshotResult) {
$successMessage .= sprintf(', snapshots: %d processed, %d failed', $snapshotResult['processed'], $snapshotResult['failed']);
}
if (null !== $orphanedDeleted) {
$successMessage .= sprintf(', orphaned deleted: %d', $orphanedDeleted);
}
$io->success($successMessage);
$io->success(sprintf('Synced %d files', $syncedCount));
$this->logger->info('XML sync completed', [
'files_updated' => $syncResult['updated'],
'files_deleted' => $syncResult['deleted'],
'snapshots_processed' => $snapshotResult['processed'] ?? null,
'snapshots_failed' => $snapshotResult['failed'] ?? null,
'orphaned_deleted' => $orphanedDeleted,
'files_synced' => $syncedCount,
'remote_timestamp' => $remoteInfo->lastTransfer->format('c'),
]);
@@ -192,29 +157,19 @@ class BpnXmlSyncCommand extends Command
}
/**
* @return array<string, int>
*
* @throws FilesystemException
*/
private function syncFiles(SymfonyStyle $io): array
private function syncFiles(SymfonyStyle $io): int
{
$remoteFiles = $this->xmlSource
$files = $this->xmlSource
->listContents('.')
->filter(fn (StorageAttributes $attributes) => $attributes->isFile())
->map(fn (StorageAttributes $attributes) => $attributes->path())
->toArray();
$localFiles = $this->xmlExport
->listContents('.')
->filter(fn (StorageAttributes $attributes) => $attributes->isFile())
->map(fn (StorageAttributes $attributes) => $attributes->path())
->toArray();
$io->progressStart(count($files));
$filesToDelete = array_diff($localFiles, $remoteFiles);
$io->progressStart(count($remoteFiles));
foreach ($remoteFiles as $path) {
foreach ($files as $path) {
$content = $this->xmlSource->read($path);
$this->xmlExport->write($path, $content);
$io->progressAdvance();
@@ -222,14 +177,7 @@ class BpnXmlSyncCommand extends Command
$io->progressFinish();
foreach ($filesToDelete as $path) {
$this->xmlExport->delete($path);
}
return [
'updated' => count($remoteFiles),
'deleted' => count($filesToDelete),
];
return count($files);
}
private function invalidateCaches(): void
@@ -238,18 +186,4 @@ class BpnXmlSyncCommand extends Command
$this->cache->delete($key);
}
}
private function formatInfoLine(string $label, XmlExportInfo $info, OutputInterface $output): string
{
if ($output->isVerbose()) {
return sprintf(
'%s: %s (%d files)',
$label,
$info->lastTransfer->format('d.m.Y H:i:s'),
$info->fileCount
);
}
return sprintf('%s: %d files', $label, $info->fileCount);
}
}
@@ -1,48 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Repository\NewsletterOptInConfirmationRepository;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'app:cleanup:newsletter-opt-in-requests',
description: 'Removes expired pending newsletter double opt-in requests',
)]
class CleanupNewsletterOptInRequestsCommand extends Command
{
public function __construct(
private readonly NewsletterOptInConfirmationRepository $confirmationRepository,
private readonly LoggerInterface $logger,
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$deletedCount = $this->confirmationRepository->deleteExpiredPending();
if (0 === $deletedCount) {
$io->success('No expired pending newsletter opt-in requests found.');
return Command::SUCCESS;
}
$this->logger->info('Deleted expired pending newsletter opt-in requests', [
'count' => $deletedCount,
]);
$io->success(sprintf('Deleted %d expired pending newsletter opt-in request(s).', $deletedCount));
return Command::SUCCESS;
}
}
@@ -6,7 +6,7 @@ namespace App\Command;
use App\BusProNet\Model\Booking;
use App\Repository\BookingEditDraftRepository;
use App\Service\BookingEditDataLoader;
use App\Service\BookingEditDataLoaderService;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
@@ -23,7 +23,7 @@ class DraftBackfillBookingNumberCommand extends Command
{
public function __construct(
private readonly BookingEditDraftRepository $draftRepository,
private readonly BookingEditDataLoader $dataLoader,
private readonly BookingEditDataLoaderService $dataLoader,
private readonly EntityManagerInterface $entityManager,
) {
parent::__construct();
+3 -4
View File
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace App\Command;
use App\Repository\BookingEditDraftRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
@@ -21,7 +20,6 @@ class DraftInspectCommand extends Command
{
public function __construct(
private readonly BookingEditDraftRepository $draftRepository,
private readonly EntityManagerInterface $entityManager,
) {
parent::__construct();
}
@@ -104,10 +102,11 @@ class DraftInspectCommand extends Command
return Command::SUCCESS;
}
$em = $this->draftRepository->getEntityManager();
foreach ($drafts as $draft) {
$this->entityManager->remove($draft);
$em->remove($draft);
}
$this->entityManager->flush();
$em->flush();
$io->success(sprintf('Deleted %d draft(s).', \count($drafts)));
}
@@ -1,75 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Entity\LogEntry;
use App\Repository\LogEntryRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'app:log-entry:backfill-error-codes',
description: 'Backfills error_code column from extra data in existing log entries'
)]
class LogEntryBackfillErrorCodesCommand extends Command
{
private const BATCH_SIZE = 100;
public function __construct(
private readonly LogEntryRepository $logEntryRepository,
private readonly EntityManagerInterface $entityManager,
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$io->info('Starting backfill of error codes...');
$totalProcessed = 0;
$totalUpdated = 0;
while (true) {
$entries = $this->logEntryRepository->createQueryBuilder('l')
->where('l.errorCode IS NULL')
->andWhere('l.extra LIKE :pattern')
->setParameter('pattern', '%error_code%')
->orderBy('l.id', 'ASC')
->setMaxResults(self::BATCH_SIZE)
->getQuery()
->getResult();
if ([] === $entries) {
break;
}
foreach ($entries as $entry) {
/** @var LogEntry $entry */
$extra = $entry->getExtra();
if (isset($extra['error_code']) && null === $entry->getErrorCode()) {
$entry->setErrorCode($extra['error_code']);
++$totalUpdated;
}
++$totalProcessed;
}
$this->entityManager->flush();
$this->entityManager->clear();
$io->writeln(sprintf('Processed %d entries, %d updated so far', $totalProcessed, $totalUpdated));
}
$message = sprintf('Backfill complete. Processed %d entries, updated %d with error codes.', $totalProcessed, $totalUpdated);
$io->success($message);
return Command::SUCCESS;
}
}
@@ -9,13 +9,9 @@ use App\BusProNet\Exception\ApiClientException;
use App\BusProNet\Model\Notification;
use App\BusProNet\Model\PersonalData;
use App\Entity\User;
use App\Exception\NewsletterProviderException;
use App\Form\PersonalDataType;
use App\Repository\NewsletterOptInConfirmationRepository;
use App\Security\Crypt;
use App\Service\BookingEditDataLoader;
use App\Service\MailjetApiClient;
use App\Service\NewsletterManager;
use App\Service\BookingEditDataLoaderService;
use App\Service\ProfileCompletenessChecker;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
@@ -37,22 +33,19 @@ class PersonalDataController extends AbstractController
public const SESSION_REDIRECT_KEY = '_profile_completion_redirect';
/**
* @param ApiClient $apiClient BusProNet API client for data operations
* @param Crypt $crypt Encryption service for password handling
* @param BookingEditDataLoader $dataLoader Data loader for cache invalidation
* @param ProfileCompletenessChecker $completenessChecker Profile validation service
* @param EntityManagerInterface $entityManager Entity manager for persisting user changes
* @param LoggerInterface $logger Logger for audit trails and debugging
* @param ApiClient $apiClient BusProNet API client for data operations
* @param Crypt $crypt Encryption service for password handling
* @param BookingEditDataLoaderService $dataLoader Data loader for cache invalidation
* @param ProfileCompletenessChecker $completenessChecker Profile validation service
* @param EntityManagerInterface $entityManager Entity manager for persisting user changes
* @param LoggerInterface $logger Logger for audit trails and debugging
*/
public function __construct(
private readonly ApiClient $apiClient,
private readonly Crypt $crypt,
private readonly BookingEditDataLoader $dataLoader,
private readonly BookingEditDataLoaderService $dataLoader,
private readonly ProfileCompletenessChecker $completenessChecker,
private readonly EntityManagerInterface $entityManager,
private readonly MailjetApiClient $newsletterService,
private readonly NewsletterManager $doubleOptInService,
private readonly NewsletterOptInConfirmationRepository $newsletterConfirmationRepository,
private readonly LoggerInterface $logger,
) {
}
@@ -137,27 +130,9 @@ class PersonalDataController extends AbstractController
return $this->redirectToRoute('app_personal_data');
}
$newsletterSubscribed = false;
$newsletterPendingConfirmation = false;
try {
$newsletterSubscribed = $this->newsletterService->isSubscribed($email);
} catch (NewsletterProviderException $e) {
$this->logger->warning('Unable to read newsletter subscription status', [
'email' => $email,
'error' => $e->getMessage(),
]);
$this->addFlash('error', 'Der Newsletter-Status konnte gerade nicht geladen werden.');
}
if (!$newsletterSubscribed) {
$newsletterPendingConfirmation = null !== $this->newsletterConfirmationRepository->findPendingByEmail($email);
}
return $this->render('account/personal_data.html.twig', [
'personalData' => $personalData,
'personalDataForm' => $personalDataForm->createView(),
'newsletterSubscribed' => $newsletterSubscribed,
'newsletterPendingConfirmation' => $newsletterPendingConfirmation,
]);
}
@@ -174,43 +149,43 @@ class PersonalDataController extends AbstractController
*/
#[Route('/personal-data/newsletter', name: 'app_personal_data_newsletter', methods: ['POST'])]
#[IsGranted('ROLE_USER')]
public function newsletter(Request $request): Response
public function newsletter(): Response
{
/** @var User $user */
$user = $this->getUser();
$email = $user->getEmail();
$shouldSubscribe = $request->request->getBoolean('subscribed');
$password = $this->crypt->decrypt($user->getPassword());
try {
if ($shouldSubscribe) {
if ($this->newsletterService->isSubscribed($email)) {
$this->addFlash('info', 'Du bist bereits zum Newsletter angemeldet.');
} else {
$hasPendingConfirmation = null !== $this->newsletterConfirmationRepository->findPendingByEmail($email);
$this->doubleOptInService->requestConfirmation($email);
if ($hasPendingConfirmation) {
$this->addFlash('success', 'Wir haben dir eine neue Bestätigungs-E-Mail gesendet.');
} else {
$this->addFlash('success', 'Bitte bestätige deine Newsletter-Anmeldung über den Link in der E-Mail.');
}
}
} else {
$this->newsletterService->unsubscribe($email);
$this->addFlash('success', 'Du wurdest vom Newsletter abgemeldet.');
}
$personalData = $this
->apiClient
->getPersonalData($email, $password);
} catch (ApiClientException $e) {
$this->addFlash('error', 'Deine persönlichen Daten konnten nicht abgerufen werden');
$this->logger->info('Updated newsletter registration intent', [
return $this->redirectToRoute('app_personal_data');
}
if ($personalData instanceof Notification) {
$this->logger->error('Unable to fetch personal data', [
'code' => $personalData->code,
'error' => $personalData->message,
]);
$this->addFlash('error', 'Deine persönlichen Daten konnten nicht abgerufen werden');
return $this->redirectToRoute('app_personal_data');
}
$personalData->communication->newsletter = !$personalData->communication->newsletter;
try {
$this->apiClient->updateNewsletterRegistration($email, $password, $personalData);
$this->addFlash('success', 'Deine Anmeldung zum Newsletter wurde aktualisiert');
$this->logger->info('Updated newsletter registration', [
'email' => $user->getEmail(),
'subscribed' => $shouldSubscribe,
]);
} catch (NewsletterProviderException|\InvalidArgumentException $e) {
$this->addFlash('error', 'Die Newsletter-Aktion konnte gerade nicht verarbeitet werden. Bitte versuche es erneut.');
$this->logger->warning('Newsletter action failed', [
'email' => $email,
'subscribed' => $shouldSubscribe,
'error' => $e->getMessage(),
]);
} catch (ApiClientException $e) {
$this->addFlash('error', $e->getMessage());
}
return $this->redirectToRoute('app_personal_data');
@@ -7,7 +7,7 @@ namespace App\Controller\Admin;
use App\Admin\Field\JsonDataField;
use App\Entity\BookingEditDraft;
use App\Entity\User;
use App\Service\BookingExporter;
use App\Service\BookingExportService;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
@@ -19,11 +19,10 @@ use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
/** @extends AbstractCrudController<BookingEditDraft> */
class BookingEditDraftCrudController extends AbstractCrudController
{
public function __construct(
private readonly BookingExporter $exportService,
private readonly BookingExportService $exportService,
private readonly AdminUrlGenerator $adminUrlGenerator,
) {
}
+10 -49
View File
@@ -4,28 +4,16 @@ declare(strict_types=1);
namespace App\Controller\Admin;
use App\Admin\Field\JsonDataField;
use App\Entity\LogEntry;
use App\Repository\LogEntryRepository;
use App\Service\XmlDumpReader;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use League\Flysystem\FilesystemException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/** @extends AbstractCrudController<LogEntry> */
class LogEntryCrudController extends AbstractCrudController
{
public function __construct(
private readonly LogEntryRepository $logEntryRepository,
) {
}
public static function getEntityFqcn(): string
{
return LogEntry::class;
@@ -34,7 +22,7 @@ class LogEntryCrudController extends AbstractCrudController
public function configureActions(Actions $actions): Actions
{
$viewDumps = Action::new('viewDumps', 'XML Dumps', 'fa fa-file-code')
->linkToCrudAction('xmlDumps')
->linkToRoute('admin_xml_dump_list', static fn (LogEntry $entity): array => ['id' => $entity->getId()])
->displayIf(static fn (LogEntry $entity): bool => 'bpn' === $entity->getChannel());
return $actions
@@ -54,45 +42,18 @@ class LogEntryCrudController extends AbstractCrudController
return $crud
->setEntityLabelInSingular('Logeintrag')
->setEntityLabelInPlural('Logeinträge')
->setDefaultSort(['createdAt' => 'DESC'])
->setSearchFields(['errorCode', 'message', 'channel', 'extra']);
->setDefaultSort(['createdAt' => 'DESC']);
}
public function configureFields(string $pageName): iterable
{
yield DateTimeField::new('createdAt', 'Zeitstempel');
yield TextField::new('errorCode', 'Fehlercode')
->formatValue(static fn (?string $value): string => $value ?? '-');
yield TextField::new('username', 'Benutzer');
yield TextField::new('message', 'Aktion');
yield TextField::new('requestId', 'Request ID');
yield TextField::new('uri', 'URI');
yield JsonDataField::new('context', 'Kontext')->onlyOnDetail();
yield JsonDataField::new('extra', 'Extra')->onlyOnDetail();
}
public function xmlDumps(Request $request, XmlDumpReader $xmlDumpService): Response
{
$entityId = $request->query->getInt('entityId');
if ($entityId <= 0) {
throw $this->createNotFoundException('Log entry not found.');
}
$entity = $this->logEntryRepository->find($entityId);
if (!$entity instanceof LogEntry) {
throw $this->createNotFoundException('Log entry not found.');
}
$dumps = [];
try {
$dumps = $xmlDumpService->findDumpsForRequestId($entity->getRequestId());
} catch (FilesystemException) {
}
return $this->render('admin/xml_dump/list.html.twig', [
'logEntry' => $entity,
'requestId' => $entity->getRequestId(),
'dumps' => $dumps,
]);
return [
DateTimeField::new('createdAt', 'Zeitstempel'),
TextField::new('errorCode', 'Fehlercode'),
TextField::new('username', 'Benutzer'),
TextField::new('message', 'Aktion'),
TextField::new('requestId', 'Request ID'),
TextField::new('uri', 'URI'),
];
}
}
@@ -10,7 +10,6 @@ use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
/** @extends AbstractCrudController<User> */
class UserCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
+2 -2
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Controller\Admin;
use App\Repository\LogEntryRepository;
use App\Service\XmlDumpReader;
use App\Service\XmlDumpService;
use League\Flysystem\FilesystemException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
@@ -19,7 +19,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
class XmlDumpController extends AbstractController
{
public function __construct(
private readonly XmlDumpReader $xmlDumpService,
private readonly XmlDumpService $xmlDumpService,
private readonly LogEntryRepository $logEntryRepository,
) {
}
+1 -2
View File
@@ -8,7 +8,6 @@ use League\Flysystem\FilesystemException;
use League\Flysystem\FilesystemOperator;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Exception\JsonException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -74,7 +73,7 @@ class PickupController extends AbstractController
{
try {
$payload = $request->toArray();
} catch (JsonException $e) {
} catch (\JsonException $e) {
$this->logger->error('Failed to update pickups planning data', [
'message' => $e->getMessage(),
'payload' => (string) $request->getContent(),
+4 -4
View File
@@ -6,7 +6,7 @@ use App\BusProNet\ApiClient;
use App\BusProNet\Exception\ApiClientException;
use App\BusProNet\Model\Travel;
use App\BusProNet\Utility\DateCodeUtility;
use App\Service\TravelDataProvider;
use App\Service\TravelDataService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -21,7 +21,7 @@ class TravelController extends AbstractController
{
public function __construct(
private readonly ApiClient $apiClient,
private readonly TravelDataProvider $travelDataService,
private readonly TravelDataService $travelDataService,
) {
}
@@ -58,7 +58,7 @@ class TravelController extends AbstractController
name: 'api_travel_single_code',
defaults: ['hotelCode' => null],
)]
public function byCode(Request $request, string $dateCode, ?string $hotelCode = null): JsonResponse
public function byCode(Request $request, $dateCode, ?string $hotelCode = null): JsonResponse
{
// sanitize date code by removing potential dividers
$dateCode = (new DateCodeUtility())->sanitize($dateCode);
@@ -114,7 +114,7 @@ class TravelController extends AbstractController
bool $preferRemote = false,
): ?Travel {
return match ($source) {
'local' => $this->travelDataService->getTravelDataFromLocal($dateId, $hotelId),
'local' => $this->travelDataService->getTravelDataFromXml($dateId, $hotelId),
'remote' => $this->travelDataService->getTravelDataFromApi($dateId, $hotelId),
default => $this->travelDataService->getTravelData($dateId, $hotelId, $preferRemote),
};
@@ -66,11 +66,6 @@ class UserinfoController extends AbstractController
}
}
/**
* @param list<string> $scopes
*
* @return array<string, mixed>
*/
private function getClaims(PersonalData $data, array $scopes): array
{
// get all available claims
@@ -11,9 +11,8 @@ use App\Exception\NoRoomsAvailableException;
use App\Exception\TravelNotFoundException;
use App\Htmx\HxTrait;
use App\Model\BookingQueryParams;
use App\Service\BookingConfigurator;
use App\Service\BookingSessionManager;
use App\Service\BookingSummaryAssembler;
use App\Service\BookingService;
use App\Service\BookingSummaryDataService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -32,10 +31,9 @@ class IndexController extends AbstractController
use HxTrait;
public function __construct(
private readonly BookingConfigurator $bookingService,
private readonly BookingSessionManager $bookingSessionService,
private readonly BookingService $bookingService,
private readonly AgencyLoader $agencyLoader,
private readonly BookingSummaryAssembler $summaryDataService,
private readonly BookingSummaryDataService $summaryDataService,
) {
}
@@ -86,13 +84,13 @@ class IndexController extends AbstractController
try {
// Clear any existing booking session to ensure fresh start
$this->bookingSessionService->clearBookingSession($request);
$this->bookingService->clearBookingSession($request);
// Determine agency ID from optional query parameter
$agencyId = $this->resolveAgencyId($params->agency);
// Store optional return URL in session (defaults to main EP site)
$this->bookingSessionService->storeReturnUrl($request, $params->returnUrl);
$this->bookingService->storeReturnUrl($request, $params->returnUrl);
// Create fresh booking session with the provided parameters
$bookingDto = $this->bookingService->startFreshBooking($request, $dateId, $hotelId, $agencyId);
@@ -156,10 +154,10 @@ class IndexController extends AbstractController
{
if (Request::METHOD_POST === $request->getMethod()) {
// Get return URL before clearing session (for guest users)
$returnUrl = $this->bookingSessionService->getReturnUrl($request);
$returnUrl = $this->bookingService->getReturnUrl($request);
// Clear the booking session
$this->bookingSessionService->clearBookingSession($request);
$this->bookingService->clearBookingSession($request);
// Clear the security target path to prevent redirect loop after login
// Without this, logging in after cancel would redirect back to a stale booking URL
@@ -190,7 +188,7 @@ class IndexController extends AbstractController
public function error(Request $request): Response
{
return $this->render('booking/create/error.html.twig', [
'returnUrl' => $this->bookingSessionService->getReturnUrl($request),
'returnUrl' => $this->bookingService->getReturnUrl($request),
]);
}
}
@@ -9,10 +9,8 @@ use App\Controller\Booking\Traits\BookingExceptionHandlerTrait;
use App\Form\BookingCreateStep1Type;
use App\Form\Model\BookingDto;
use App\Htmx\HxTrait;
use App\Service\BookingConfigurator;
use App\Service\BookingCreateContextFactory;
use App\Service\BookingSessionManager;
use App\Service\RoomPricingCalculator;
use App\Service\BookingService;
use App\Service\BookingSummaryDataService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -31,9 +29,8 @@ class Step1Controller extends AbstractController
use HxTrait;
public function __construct(
private readonly BookingConfigurator $bookingService,
private readonly BookingSessionManager $bookingSessionService,
private readonly BookingCreateContextFactory $createContextFactory,
private readonly BookingService $bookingService,
private readonly BookingSummaryDataService $summaryDataService,
) {
}
@@ -43,14 +40,14 @@ class Step1Controller extends AbstractController
#[Route('/bookings/create/rooms', name: 'app_booking_create_step_1')]
public function index(Request $request): Response
{
$result = $this->getOrCreateBookingCreateDto($this->bookingSessionService, $request);
$result = $this->getOrCreateBookingCreateDto($this->bookingService, $request);
if ($result instanceof Response) {
return $result;
}
$bookingCreateDto = $result;
// Get or create baseline snapshot for change detection
$oldRoomSelectionSnapshot = $this->bookingSessionService->getOrCreateBaselineSnapshot($request, $bookingCreateDto);
$oldRoomSelectionSnapshot = $this->bookingService->getOrCreateBaselineSnapshot($request, $bookingCreateDto);
// Validate step access - allow step 1 or redirect to current step
if ($redirect = $this->validateStepAccess($bookingCreateDto, 1)) {
@@ -72,22 +69,25 @@ class Step1Controller extends AbstractController
$this->bookingService->updateBookingStatusFromRoomSelection($bookingCreateDto);
$bookingCreateDto->currentStep = 2;
$this->bookingSessionService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
// Clear baseline snapshot when moving to step 2
$this->bookingSessionService->clearBaselineSnapshot($request);
$this->bookingService->clearBaselineSnapshot($request);
return $this->redirectToRoute('app_booking_create_step_2');
}
$context = $this->createContextFactory->create(
$bookingCreateDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
// Get complete summary data (pricing, rooms, CMS data)
$summaryData = $this->summaryDataService->getSummaryData($bookingCreateDto);
$availableRooms = $bookingCreateDto->travel->getAvailableRooms();
$groupedRooms = $this->bookingService->groupRoomsBySelectionType($availableRooms);
return $this->render('booking/create/step_1.html.twig', [
'bookingCreateContext' => $context,
'bookingCreateDto' => $bookingCreateDto,
'summaryData' => $summaryData,
'form' => $form->createView(),
'groupedRooms' => $groupedRooms,
]);
}
@@ -98,7 +98,7 @@ class Step1Controller extends AbstractController
#[Route('/bookings/create/refresh', name: 'app_booking_create_step_1_refresh', methods: ['POST'])]
public function refresh(Request $request): Response
{
$result = $this->getOrCreateBookingCreateDtoForHtmx($this->bookingSessionService, $request);
$result = $this->getOrCreateBookingCreateDtoForHtmx($this->bookingService, $request);
if ($result instanceof Response) {
return $result;
}
@@ -110,10 +110,10 @@ class Step1Controller extends AbstractController
]);
$form->handleRequest($request);
$context = $this->createContextFactory->create(
$bookingCreateDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
// Get complete summary data (pricing, rooms, CMS data)
$summaryData = $this->summaryDataService->getSummaryData($bookingCreateDto);
$availableRooms = $bookingCreateDto->travel->getAvailableRooms();
$groupedRooms = $this->bookingService->groupRoomsBySelectionType($availableRooms);
// The DTO is now updated with the latest selection.
// We can now render the blocks with the fresh data.
@@ -122,7 +122,9 @@ class Step1Controller extends AbstractController
['room_selection_form', 'booking_summary'],
[
'form' => $form->createView(),
'bookingCreateContext' => $context,
'bookingCreateDto' => $bookingCreateDto,
'summaryData' => $summaryData,
'groupedRooms' => $groupedRooms,
]
);
}
+144 -54
View File
@@ -4,20 +4,23 @@ declare(strict_types=1);
namespace App\Controller\Booking\Create;
use App\BusProNet\Model\Travel;
use App\BusProNet\Constants;
use App\Controller\Booking\Traits\BookingCreateTrait;
use App\Controller\Booking\Traits\BookingExceptionHandlerTrait;
use App\Entity\User;
use App\Controller\Booking\Traits\ParticipantCardFlowTrait;
use App\Form\BookingCreateStep2Type;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
use App\Service\BookingConfigurator;
use App\Service\BookingCreateContextFactory;
use App\Service\BookingSessionManager;
use App\Service\ParticipantDataPrefiller;
use App\Service\RoomAssigner;
use App\Service\TravelDataProvider;
use App\Form\Service\DummyDataFillService;
use App\Form\Service\ParticipantFieldOptionsProvider;
use App\Htmx\HxTrait;
use App\Service\BookingService;
use App\Service\BookingSummaryDataService;
use App\Service\ParticipantCardDataService;
use App\Service\ParticipantPrepopulationService;
use App\Service\RoomAssignmentService;
use App\Service\TravelDataService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
@@ -32,14 +35,18 @@ class Step2Controller extends AbstractController
{
use BookingCreateTrait;
use BookingExceptionHandlerTrait;
use HxTrait;
use ParticipantCardFlowTrait;
public function __construct(
private readonly BookingConfigurator $bookingService,
private readonly BookingSessionManager $bookingSessionService,
private readonly BookingCreateContextFactory $createContextFactory,
private readonly TravelDataProvider $travelDataService,
private readonly RoomAssigner $roomAssignmentService,
private readonly ParticipantDataPrefiller $prepopulationService,
private readonly BookingService $bookingService,
private readonly BookingSummaryDataService $summaryDataService,
private readonly TravelDataService $travelDataService,
private readonly RoomAssignmentService $roomAssignmentService,
private readonly ParticipantCardDataService $participantCardService,
private readonly ParticipantFieldOptionsProvider $fieldOptionsProvider,
private readonly ParticipantPrepopulationService $prepopulationService,
private readonly DummyDataFillService $dummyDataFillService,
) {
}
@@ -50,7 +57,7 @@ class Step2Controller extends AbstractController
public function index(Request $request): Response
{
// Load or create booking DTO
$result = $this->getOrCreateBookingCreateDto($this->bookingSessionService, $request);
$result = $this->getOrCreateBookingCreateDto($this->bookingService, $request);
if ($result instanceof Response) {
return $result;
}
@@ -64,18 +71,12 @@ class Step2Controller extends AbstractController
// Enrich with fresh availability data
$this->travelDataService->enrichWithFreshAvailabilities($bookingCreateDto->travel);
// Ensure correct number of participants first, then prepopulate the applicant if needed.
$this->ensureCorrectNumberOfParticipants($bookingCreateDto);
$user = $this->getUser();
if ($user instanceof User
&& isset($bookingCreateDto->participants[0])
&& $this->prepopulationService->shouldPrefillApplicant($bookingCreateDto->participants[0])) {
$bookingCreateDto->participants[0] = $this->prepopulationService->prefillApplicantFromUser(
$user,
$bookingCreateDto->participants[0]
);
}
// Ensure correct number of participants with prepopulation callback
$this->bookingService->ensureCorrectNumberOfParticipants(
$bookingCreateDto,
$this->getUser(),
fn ($user, $participant) => $this->prepopulationService->prepopulateApplicantFromUser($user, $participant)
);
// Validate room assignments against current selection (handles back-navigation from step 2 to step 1)
$this->roomAssignmentService->validateAndResetInvalidAssignments($bookingCreateDto);
@@ -84,11 +85,10 @@ class Step2Controller extends AbstractController
$this->roomAssignmentService->assignRoomsIfNeeded($bookingCreateDto);
// Preselect mandatory services
$this->bookingService->preselectDefaultServices($bookingCreateDto);
$this->bookingService->applyCreateBookingStatusRules($bookingCreateDto);
$this->bookingService->preselectMandatoryServices($bookingCreateDto);
// Save BookingDto to session
$this->bookingSessionService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
// Create validation form
$form = $this->createForm(BookingCreateStep2Type::class, $bookingCreateDto);
@@ -98,51 +98,141 @@ class Step2Controller extends AbstractController
if (true === $form->isSubmitted() && true === $form->isValid()) {
// All participants validated successfully, update current step
$bookingCreateDto->currentStep = 3;
$this->bookingSessionService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
// Proceed to Step 3
return $this->redirectToRoute('app_booking_create_step_3');
}
$context = $this->createContextFactory->createWithParticipantCards($bookingCreateDto, $form->isSubmitted());
// Always generate card data with validation state to show completeness
$cardsData = $this->participantCardService->getAllCardsDataWithValidation($bookingCreateDto);
// Get complete summary data (pricing, rooms, CMS data)
$summaryData = $this->summaryDataService->getSummaryData($bookingCreateDto);
$templateData = [
'form' => $form->createView(),
'bookingCreateContext' => $context,
'bookingDto' => $bookingCreateDto,
'cardsData' => $cardsData,
'summaryData' => $summaryData,
'isSubmitted' => $form->isSubmitted(),
];
return $this->render('booking/create/step_2.html.twig', $templateData);
}
/**
* Ensures the booking DTO has the expected number of participant objects based on room selections.
* Show or submit individual participant form.
*/
private function ensureCorrectNumberOfParticipants(BookingDto $bookingDto): void
#[Route(
path: '/bookings/create/participants/{index}',
name: 'app_booking_create_step_2_participant',
requirements: ['index' => '\d+']
)]
public function editParticipant(int $index, Request $request): Response
{
$participantsCount = $this->calculateParticipantsCount($bookingDto->roomSelections, $bookingDto->travel);
$existingParticipants = $bookingDto->participants;
$bookingDto->participants = [];
for ($i = 0; $i < $participantsCount; ++$i) {
$participant = $existingParticipants[$i] ?? new ParticipantDto();
$participant->index = $i;
$bookingDto->participants[$i] = $participant;
$result = $this->loadBookingDtoOrRedirect($request, BookingDto::MODE_CREATE);
if ($result instanceof Response) {
return $result;
}
$bookingDto = $result;
// Validate participant index
if (false === isset($bookingDto->participants[$index])) {
throw $this->createNotFoundException(sprintf('Participant at index %d does not exist', $index));
}
// Use cached availability data (populated during booking init)
$this->travelDataService->enrichWithFreshAvailabilities($bookingDto->travel);
// Create form with booking_context option
$form = $this->createParticipantForm($bookingDto, $index);
$form->handleRequest($request);
// Detect dummy data fill token — render pre-filled form immediately, skipping validation
$isDummyDataFill = $this
->dummyDataFillService
->isTokenMatch($bookingDto->participants[$index], $bookingDto->getMode())
;
if (true === $form->isSubmitted() && true === $isDummyDataFill) {
$this->dummyDataFillService->fill($bookingDto->participants[$index], $index);
// Keep behavior consistent with cards view: newly filled participant data
// (especially dateOfBirth) must immediately trigger mandatory service preselection.
$this->bookingService->preselectMandatoryServices($bookingDto);
$bookingDto->bookingStatus = Constants::BOOKING_STATUS_OPEN;
$this->bookingService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
// Recreate form with filled DTO so the view shows the dummy data
$form = $this->createParticipantForm($bookingDto, $index);
return $this->renderParticipantForm($form, $index, $bookingDto);
}
// Collect notifications from field handlers (run during PRE_SUBMIT)
$notifications = $this->collectAndClearNotifications($bookingDto);
if (true === $form->isSubmitted() && true === $form->isValid()) {
// Save BookingDto to session
$this->bookingService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
// Add notifications as flash messages (redirects destroy HTMX-triggered toasts)
$this->addNotificationsAsFlashMessages($notifications);
// HTMX redirect to cards view
return $this->redirectToRoute('app_booking_create_step_2');
}
return $this->renderParticipantForm($form, $index, $bookingDto);
}
/** @param array<int, \App\Form\Model\RoomSelectionDto> $roomSelections */
private function calculateParticipantsCount(array $roomSelections, Travel $travelData): int
/**
* HTMX refresh endpoint for individual participant form.
*/
#[Route(
path: '/bookings/create/participants/{index}/refresh',
name: 'app_booking_create_step_2_participant_refresh',
requirements: ['index' => '\d+'],
methods: ['POST']
)]
public function refreshParticipantForm(int $index, Request $request): Response
{
$participantsCount = 0;
$rooms = $travelData->getAvailableRooms();
$result = $this->loadBookingDtoOrRedirect($request, BookingDto::MODE_CREATE);
if ($result instanceof Response) {
return $result;
}
$bookingDto = $result;
foreach ($roomSelections as $roomSelection) {
$room = $rooms[$roomSelection->id];
$participantsCount += $room->minPax * $roomSelection->quantity;
// Validate participant index
if (false === isset($bookingDto->participants[$index])) {
throw $this->createNotFoundException(sprintf('Participant at index %d does not exist', $index));
}
return $participantsCount;
// Enrich with fresh availability data
$this->travelDataService->enrichWithFreshAvailabilities($bookingDto->travel);
// Use trait method for refresh handling
return $this->handleParticipantRefresh(
$request,
$bookingDto,
$index,
'app_booking_create_step_2_participant_refresh'
);
}
private function renderParticipantForm(
FormInterface $form,
int $index,
BookingDto $bookingDto,
): Response {
return $this->render('booking/create/step_2_participant.html.twig', [
'form' => $form->createView(),
'participantIndex' => $index,
'bookingDto' => $bookingDto,
'summaryData' => $this->summaryDataService->getSummaryData($bookingDto),
'refreshRouteName' => 'app_booking_create_step_2_participant_refresh',
]);
}
}
@@ -1,238 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Controller\Booking\Create;
use App\Form\BookingParticipantType;
use App\Form\Model\BookingDto;
use App\Htmx\HxTrait;
use App\Service\BookingConfigurator;
use App\Service\BookingCreateContextFactory;
use App\Service\BookingSessionManager;
use App\Service\ParticipantDataPrefiller;
use App\Service\ParticipantFormSupport;
use App\Service\RoomPricingCalculator;
use App\Service\TravelDataProvider;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
/**
* Handles participant editing and refresh actions within booking step 2.
*/
class Step2ParticipantController extends AbstractController
{
use HxTrait;
public function __construct(
private readonly BookingConfigurator $bookingService,
private readonly BookingSessionManager $bookingSessionService,
private readonly BookingCreateContextFactory $createContextFactory,
private readonly TravelDataProvider $travelDataService,
private readonly ParticipantDataPrefiller $prepopulationService,
private readonly ParticipantFormSupport $participantFormSupportService,
) {
}
/**
* Show or submit individual participant form.
*/
#[Route(
path: '/bookings/create/participants/{index}',
name: 'app_booking_create_step_2_participant',
requirements: ['index' => '\d+']
)]
public function editParticipant(int $index, Request $request): Response
{
$result = $this->loadBookingDtoOrRedirect($request);
if ($result instanceof Response) {
return $result;
}
$bookingDto = $result;
$this->participantFormSupportService->ensureParticipantExists($bookingDto, $index);
$this->travelDataService->enrichWithFreshAvailabilities($bookingDto->travel);
$form = $this->createParticipantForm($bookingDto, $index);
$form->handleRequest($request);
$isSubmitted = $form->isSubmitted();
$isDummyDataFill = $this
->prepopulationService
->isDummyDataFillRequested($bookingDto->participants[$index], $bookingDto->getMode())
;
if (true === $isSubmitted && true === $isDummyDataFill) {
$this->prepopulationService->fillDummyParticipant($bookingDto->participants[$index], $index);
$this->bookingService->preselectDefaultServices($bookingDto);
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
$form = $this->createParticipantForm($bookingDto, $index);
return $this->renderParticipantForm($form, $index, $bookingDto);
}
if (true === $isSubmitted) {
$this->bookingService->preselectDefaultServices($bookingDto);
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
}
$notifications = $this->participantFormSupportService->collectAndClearNotifications($bookingDto);
if (true === $isSubmitted && true === $form->isValid()) {
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
$this->addNotificationsAsFlashMessages($notifications);
return $this->redirectToRoute('app_booking_create_step_2');
}
return $this->renderParticipantForm($form, $index, $bookingDto);
}
/**
* HTMX refresh endpoint for individual participant form.
*/
#[Route(
path: '/bookings/create/participants/{index}/refresh',
name: 'app_booking_create_step_2_participant_refresh',
requirements: ['index' => '\d+'],
methods: ['POST']
)]
public function refreshParticipantForm(int $index, Request $request): Response
{
$result = $this->loadBookingDtoOrRedirect($request);
if ($result instanceof Response) {
return $result;
}
$bookingDto = $result;
$this->participantFormSupportService->ensureParticipantExists($bookingDto, $index);
$this->travelDataService->enrichWithFreshAvailabilities($bookingDto->travel);
return $this->handleParticipantRefresh(
$request,
$bookingDto,
$index,
'app_booking_create_step_2_participant_refresh'
);
}
/** @param FormInterface<mixed> $form */
private function renderParticipantForm(
FormInterface $form,
int $index,
BookingDto $bookingDto,
): Response {
$bookingCreateContext = $this->createContextFactory->create(
$bookingDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
return $this->render('booking/create/step_2_participant.html.twig', [
'form' => $form->createView(),
'participantIndex' => $index,
'bookingCreateContext' => $bookingCreateContext,
'bookingDto' => $bookingCreateContext->bookingDto,
'summaryData' => $bookingCreateContext->summaryData,
'refreshRouteName' => 'app_booking_create_step_2_participant_refresh',
]);
}
private function loadBookingDtoOrRedirect(Request $request): BookingDto|Response
{
$bookingDto = $this->bookingSessionService->getBookingDto($request, BookingDto::MODE_CREATE);
if (null === $bookingDto) {
$this->addFlash('info', 'Deine Sitzung ist abgelaufen. Bitte starte eine neue Buchung.');
return $this->redirectToRoute('app_login');
}
return $bookingDto;
}
/** @return FormInterface<mixed> */
private function createParticipantForm(BookingDto $bookingDto, int $index): FormInterface
{
$wrapper = $this->participantFormSupportService->createParticipantEditDto($bookingDto, $index);
return $this->createForm(
BookingParticipantType::class,
$wrapper,
$this->participantFormSupportService->getParticipantFormOptions($bookingDto)
);
}
private function handleParticipantRefresh(
Request $request,
BookingDto $bookingDto,
int $index,
string $refreshRouteName,
): Response {
$form = $this->createForm(
BookingParticipantType::class,
$this->participantFormSupportService->createParticipantEditDto($bookingDto, $index),
$this->participantFormSupportService->getParticipantFormOptions($bookingDto, true)
);
$form->handleRequest($request);
$this->bookingService->preselectDefaultServices($bookingDto);
if (BookingDto::MODE_CREATE === $bookingDto->getMode()) {
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
}
$form = $this->createForm(
BookingParticipantType::class,
$this->participantFormSupportService->createParticipantEditDto($bookingDto, $index),
$this->participantFormSupportService->getParticipantFormOptions($bookingDto, true)
);
$notifications = $this->participantFormSupportService->collectAndClearNotifications($bookingDto);
$this->bookingSessionService->saveBookingDto($request, $bookingDto, $bookingDto->getMode());
$bookingCreateContext = $this->createContextFactory->create(
$bookingDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
$response = $this->htmxOobResponse(
'booking/_participant_form.html.twig',
['participant_form', 'booking_summary'],
[
'form' => $form->createView(),
'participantIndex' => $index,
'bookingCreateContext' => $bookingCreateContext,
'bookingDto' => $bookingCreateContext->bookingDto,
'summaryData' => $bookingCreateContext->summaryData,
'refreshRouteName' => $refreshRouteName,
]
);
if (false === empty($notifications)) {
$response->headers->set('HX-Trigger', json_encode([
'showNotifications' => $notifications,
]));
}
return $response;
}
/**
* @param array<array{type: string, message: string}> $notifications
*/
private function addNotificationsAsFlashMessages(array $notifications): void
{
foreach ($notifications as $notification) {
$this->addFlash($notification['type'], $notification['message']);
}
}
}
Loaded 100 of 305 files, more files were not shown because too many files have changed in this diff. Show more