fix: don't include default date of birth in contact form submissions

This commit is contained in:
Björn Fromme
2026-01-07 14:44:53 +01:00
parent e1123577f4
commit 80f22b7cd0
2 changed files with 10 additions and 9 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ class ApiClient
'key' => $this->createKey($this->config['bpn_username'], $this->config['bpn_password'], static::TYPE_CUSTOMER_DATA),
'satz' => ['@typ' => static::TYPE_CUSTOMER_DATA],
'art' => 'Adresse_Neu',
'adressdaten' => $personalData->toPayload(),
'adressdaten' => $personalData->toPayload(false),
'ohnemailversand' => 'True',
];
+9 -8
View File
@@ -71,17 +71,11 @@ class PersonalData
*
* @return array<string, mixed> The payload array for API transmission
*/
public function toPayload(): array
public function toPayload(bool $includeDateOfBirth = true): array
{
// Ensure date of birth is populated
if (null === $dob = $this->dateOfBirth) {
$dob = new \DateTimeImmutable(self::DEFAULT_AGE_YEARS.' years ago');
}
return [
$payload = [
'idadresse' => $this->addressId,
'idadresseperson' => $this->personId,
'geburtsdatum' => $dob->format('d.m.Y'),
'anrede' => $this->salutation,
'geschlecht' => $this->gender,
'nationalitaet' => $this->nationality,
@@ -95,6 +89,13 @@ class PersonalData
'sonstiges3' => $this->shoeSize,
'bemerkung' => $this->remarks,
];
if (true === $includeDateOfBirth) {
$dob = $this->dateOfBirth ?? new \DateTimeImmutable(self::DEFAULT_AGE_YEARS . ' years ago');
$payload['geburtsdatum'] = $dob->format('d.m.Y');
}
return $payload;
}
public static function fromContactFormSubmission(ContactFormSubmission $dto): self