Payment methode now selectable
This commit is contained in:
@@ -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,
|
||||
]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user