feat: re-implement contact form submissions api endpoint for website
This commit is contained in:
1 parent
e27b5da3c8
commit
2b8046b416
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;
|
||||
}
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user