feat: make email optional for under-16 participants except applicant

This commit is contained in:
fromme committed 2026-10-19 09:18:22 +02:00
1 parent b958d1a371
commit 1d9c852113
18 files changed
+435 -336

No files matched your search

@@ -285,7 +285,7 @@ class BookingPayloadBuilder
$participantData = [
'@id' => $index + 1,
'status' => self::DEFAULT_PARTICIPANT_STATUS,
] + $this->buildPersonalDataPayload($participant, $applicantSource->email, true);
] + $this->buildPersonalDataPayload($participant, true);
// Add body dimensions
if (null !== $participant->height) {
@@ -387,16 +387,12 @@ class BookingPayloadBuilder
* Maps one person's personal data onto the payload shape shared by anmelder and teilnehmer.
*
* @param ParticipantDto $person The applicant or participant to map
* @param string|null $fallbackEmail Used when the person has none of their own. BusPro
* requires a Mail-Adresse for every participant once
* a room is present and rejects the Anfrage with 650
* otherwise, but accepts one shared with the Anmelder
* @param bool $alwaysIncludeAddress Participants always carry the anschrift structure
* even when empty; the anmelder only when set
*
* @return array<string, mixed>
*/
private function buildPersonalDataPayload(ParticipantDto $person, ?string $fallbackEmail = null, bool $alwaysIncludeAddress = false): array
private function buildPersonalDataPayload(ParticipantDto $person, bool $alwaysIncludeAddress = false): array
{
$data = [
'name' => $person->lastName,
@@ -421,9 +417,9 @@ class BookingPayloadBuilder
];
}
$email = null !== $person->email && '' !== trim($person->email)
? $person->email
: $fallbackEmail;
// A participant may come without an email (under-16s, see ParticipantDto::$email), and
// BusPro accepts that, so a blank is sent as a blank rather than borrowing the applicant's.
$email = null !== $person->email && '' !== trim($person->email) ? $person->email : null;
if (null !== $email || null !== $person->mobile) {
$data['kommunikation'] = [];