Payment methode now selectable

This commit is contained in:
2026-08-05 16:53:35 +02:00
parent 7919d04dc3
commit daff70b4fe
22 changed files with 705 additions and 81 deletions
@@ -4,6 +4,7 @@ namespace App\Domains\Event\Actions\SignUp;
use App\Enumerations\EatingHabit;
use App\Enumerations\EfzStatus;
use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\ValueObjects\Age;
use Illuminate\Support\Str;
@@ -14,6 +15,18 @@ class SignUpCommand {
public function execute() : SignUpResponse {
$response = new SignUpResponse();
// Teilnehmer-Eingaben der gewählten Zahlungsart gegen das Modul-Schema absichern.
$module = $this->request->paymentMethod !== null
? EventPaymentModuleRegistry::forSlug($this->request->paymentMethod)
: null;
$paymentOptions = $module?->sanitizeParticipantOptions($this->request->paymentOptions) ?? [];
if ($module !== null && !$module->participantOptionsComplete($paymentOptions)) {
$response->success = false;
$response->message = 'Bitte alle erforderlichen Zahlungsangaben ausfüllen.';
return $response;
}
$eatingHabit = match ($this->request->eating_habit) {
'vegan' => EatingHabit::EATING_HABIT_VEGAN,
'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN,
@@ -62,6 +75,7 @@ class SignUpCommand {
'amount' => $this->request->amount,
'payment_purpose' => $this->request->event->name . ' - Beitrag ' . $this->request->firstname . ' ' . $this->request->lastname,
'payment_method' => $this->request->paymentMethod,
'payment_options' => $paymentOptions,
'efz_status' => $participantAge->isfullAged() ? EfzStatus::EFZ_STATUS_NOT_CHECKED : EfzStatus::EFZ_STATUS_NOT_REQUIRED,
]
);
@@ -2,7 +2,6 @@
namespace App\Domains\Event\Actions\SignUp;
use App\Enumerations\ParticipationType;
use App\Models\Event;
use App\Models\Tenant;
use App\ValueObjects\Amount;
@@ -46,6 +45,7 @@ class SignUpRequest {
public ?string $notes,
public Amount $amount,
public ?string $paymentMethod,
public array $paymentOptions = [],
) {
}
}
@@ -7,6 +7,7 @@ use App\Models\EventParticipant;
class SignUpResponse {
public bool $success;
public ?EventParticipant $participant;
public ?string $message = null;
public function __construct() {
$this->success = false;