Event addons bookable
This commit is contained in:
@@ -104,6 +104,11 @@ class SignupController extends CommonController {
|
||||
$siblingReduction
|
||||
);
|
||||
|
||||
// Gewählte Zusätze (Event-Addons) auflösen und auf den Gesamtbetrag aufaddieren.
|
||||
$selectedAddonKeys = array_keys(array_filter((array)$request->input('addons', []), fn($v) => (bool)$v));
|
||||
$addonResolution = $eventResource->resolveAddons($selectedAddonKeys, $arrival, $departure);
|
||||
$amount->addAmount($addonResolution['total']);
|
||||
|
||||
$signupRequest = new SignUpRequest(
|
||||
$event,
|
||||
$registrationData['userId'] ?? null,
|
||||
@@ -143,6 +148,7 @@ class SignupController extends CommonController {
|
||||
$registrationData['paymentMethod'] ?? null,
|
||||
(array)($registrationData['paymentOptions'] ?? []),
|
||||
(array)($registrationData['participationOptions'] ?? []),
|
||||
$addonResolution['items'],
|
||||
);
|
||||
|
||||
$signupCommand = new SignUpCommand($signupRequest);
|
||||
@@ -185,14 +191,22 @@ class SignupController extends CommonController {
|
||||
|
||||
$siblingReduction = $request->input('sibling') === 'true';
|
||||
|
||||
$arrival = \DateTime::createFromFormat('Y-m-d', $request->input('arrival'));
|
||||
$departure = \DateTime::createFromFormat('Y-m-d', $request->input('departure'));
|
||||
|
||||
$amount = $event->calculateAmount(
|
||||
$request->input('participationType'),
|
||||
$request->input('beitrag'),
|
||||
\DateTime::createFromFormat('Y-m-d', $request->input('arrival')),
|
||||
\DateTime::createFromFormat('Y-m-d', $request->input('departure')),
|
||||
$arrival,
|
||||
$departure,
|
||||
$siblingReduction
|
||||
);
|
||||
|
||||
// Gewählte Zusätze immer einrechnen -- so enthält der finale Anzeigebetrag (und der Bestätigungstext)
|
||||
// stets die Addons und der Zahlungsschritt wird nur bei Gesamt 0 € übersprungen.
|
||||
$selectedAddonKeys = array_keys(array_filter((array)$request->input('addons', []), fn($v) => (bool)$v));
|
||||
$amount->addAmount($event->resolveAddons($selectedAddonKeys, $arrival, $departure)['total']);
|
||||
|
||||
// amountValue (numerisch) steuert im Frontend das Überspringen des Zahlungsart-Schritts bei 0 €.
|
||||
return response()->json([
|
||||
'amount' => $amount->toString(),
|
||||
|
||||
Reference in New Issue
Block a user