Payment methode now selectable
This commit is contained in:
@@ -26,10 +26,8 @@ class SignupController extends CommonController {
|
||||
|
||||
$eventModel = $this->events->getByIdentifier($eventId, false);
|
||||
$event = $eventModel?->toResource()->toArray($request);
|
||||
// Aktuell ist genau eine aktive Zahlungsmethode je Event vorgesehen; wird bereits beim Start
|
||||
// der Anmeldung ermittelt und ans Frontend durchgereicht, statt erst bei der Erstellung des
|
||||
// Teilnehmenden (siehe SignUpCommand).
|
||||
$paymentMethod = $eventModel?->paymentMethods()->where('active', true)->first();
|
||||
// Die (aktiven) Zahlungsmethoden stehen dem Frontend über $event['paymentMethods'] zur Verfügung;
|
||||
// die Auswahl trifft der/die Teilnehmer\*in im Anmeldeschritt "Zahlungsart".
|
||||
|
||||
$participantData = [
|
||||
'firstname' => '',
|
||||
@@ -67,7 +65,6 @@ class SignupController extends CommonController {
|
||||
'availableEvents' => $availableEvents,
|
||||
'localGroups' => $event['contributingLocalGroups'],
|
||||
'participantData' => $participantData,
|
||||
'paymentMethod' => $paymentMethod?->slug,
|
||||
]);
|
||||
return $inertiaProvider->render();
|
||||
}
|
||||
@@ -144,11 +141,16 @@ class SignupController extends CommonController {
|
||||
$registrationData['anmerkungen'],
|
||||
$amount,
|
||||
$registrationData['paymentMethod'] ?? null,
|
||||
(array)($registrationData['paymentOptions'] ?? []),
|
||||
);
|
||||
|
||||
$signupCommand = new SignUpCommand($signupRequest);
|
||||
$signupResponse = $signupCommand->execute();
|
||||
|
||||
if (!$signupResponse->success) {
|
||||
return response()->json(['status' => 'error', 'message' => $signupResponse->message], 422);
|
||||
}
|
||||
|
||||
// 4. Addons registrieren
|
||||
|
||||
|
||||
@@ -182,14 +184,18 @@ class SignupController extends CommonController {
|
||||
|
||||
$siblingReduction = $request->input('sibling') === 'true';
|
||||
|
||||
return response()->json(['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')),
|
||||
$siblingReduction
|
||||
)->toString()
|
||||
$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')),
|
||||
$siblingReduction
|
||||
);
|
||||
|
||||
// amountValue (numerisch) steuert im Frontend das Überspringen des Zahlungsart-Schritts bei 0 €.
|
||||
return response()->json([
|
||||
'amount' => $amount->toString(),
|
||||
'amountValue' => $amount->getAmount(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user