feat: re-implement contact form submissions api endpoint for website

This commit is contained in:
Björn Fromme committed 2026-03-16 12:00:55 +01:00
1 parent ab18e5f134
commit b567b6a840
11 files changed
+182 -10

No files matched your search

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Model;
class ContactFormResponse
{
public function __construct(
public readonly int $addressId,
public readonly int $personId,
public readonly bool $isNewRecord,
) {
}
}
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Model;
class ContactFormSubmission
{
public ?string $lastName = null;
public ?string $firstName = null;
public ?string $gender = null;
public ?string $street = null;
public ?string $zipCode = null;
public ?string $city = null;
public ?string $email = null;
public ?string $phone = null;
}
+19
View File
@@ -94,6 +94,25 @@ class PersonalData
];
}
public static function fromContactFormSubmission(ContactFormSubmission $dto): self
{
$gender = null !== $dto->gender ? strtoupper($dto->gender) : null;
if ('F' === $gender) {
$gender = 'W';
}
$instance = new self();
$instance->name = $dto->lastName;
$instance->firstName = $dto->firstName;
$instance->gender = $gender;
$instance->address->street = $dto->street;
$instance->address->postCode = $dto->zipCode;
$instance->address->city = $dto->city;
$instance->communication->email = $dto->email;
$instance->communication->phone = $dto->phone;
return $instance;
}
/**
* Extracts user claims for authentication and profile information.
*