diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..ed8db94 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,17 @@ +# CLAUDE.md + +Laravel 12 + Inertia/Vue, mandantenfähig (custom `tenant`-Scoping über `app('tenant')`, gesetzt in +`app/Middleware/IdentifyTenant.php`). PHP 8.5 — Tests/Artisan laufen im Container: +`docker exec mareike-mareike-app-1 php artisan test`. + +## Projektkonventionen (verbindlich) + +Die verbindlichen Konventionen (Actions/Request-Command-Response, Controller, Repositories, Models/Resources, Tenant, +Routing, Mails) stehen in `.ai/conventions.md` und werden hier eingebunden — **immer beachten**: + +@.ai/conventions.md + +## Bereichs-Dokumentation + +- [Zahlungsmodule](app/EventPaymentModules/CLAUDE.md) — interface-gesteuerte Zahlungsarten (Optionen, Config, + Anmelde-Zusammenfassung, GiroCode/Fähigkeits-Interfaces, neues Modul hinzufügen). diff --git a/app/Domains/Admin/Actions/CreateTenant/CreateTenantAction.php b/app/Domains/Admin/Actions/CreateTenant/CreateTenantAction.php index 05c4504..9d20ed8 100644 --- a/app/Domains/Admin/Actions/CreateTenant/CreateTenantAction.php +++ b/app/Domains/Admin/Actions/CreateTenant/CreateTenantAction.php @@ -2,6 +2,8 @@ namespace App\Domains\Admin\Actions\CreateTenant; +use App\Models\AvailablePaymentMethod; +use App\Models\PaymentMethod; use App\Models\Tenant; class CreateTenantAction @@ -29,6 +31,19 @@ class CreateTenantAction 'has_active_instance' => true, ]); + $paymentMethodDefaults = PaymentMethod::defaults(); + foreach (PaymentMethod::all() as $paymentMethod) { + $defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null]; + + AvailablePaymentMethod::create([ + 'tenant' => $tenant->slug, + 'slug' => $paymentMethod->slug, + 'name' => $defaults['name'], + 'description' => $defaults['description'], + 'active' => true, + ]); + } + $response->success = true; $response->message = 'Stamm wurde angelegt.'; $response->slug = $tenant->slug; diff --git a/app/Domains/Admin/Actions/RemovePaymentMethodUsage/RemovePaymentMethodUsageAction.php b/app/Domains/Admin/Actions/RemovePaymentMethodUsage/RemovePaymentMethodUsageAction.php new file mode 100644 index 0000000..27e5c63 --- /dev/null +++ b/app/Domains/Admin/Actions/RemovePaymentMethodUsage/RemovePaymentMethodUsageAction.php @@ -0,0 +1,32 @@ +events()->get() as $event) { + $event->paymentMethods()->detach($availablePaymentMethod->slug); + + $remainingActive = $event->paymentMethods()->where('active', true)->count(); + if ($remainingActive === 0 && $event->registration_allowed) { + $event->registration_allowed = false; + $event->save(); + + $recipients = $event->eventManagers; + if ($event->costUnit !== null) { + $recipients = $recipients->merge($event->costUnit->treasurers); + } + + foreach ($recipients->unique('id') as $recipient) { + Mail::to($recipient->email)->send(new PaymentMethodsExhaustedMail($event)); + } + } + } + } +} diff --git a/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodAction.php b/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodAction.php new file mode 100644 index 0000000..80b2d28 --- /dev/null +++ b/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodAction.php @@ -0,0 +1,47 @@ +request->availablePaymentMethod; + $wasActive = $paymentMethod->active; + + // Nur bekannte Options-Keys übernehmen -- das Options-Schema des Zahlungsmoduls ist die Autorität. + $configuration = PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $this->request->configuration); + + // Guard: Aktivierung nur erlaubt, wenn alle Pflicht-Optionen befüllt sind. + if ($this->request->active && !PaymentMethod::isConfigurationComplete($paymentMethod->slug, $configuration)) { + $response->success = false; + $response->message = 'Bitte zuerst alle Pflichtfelder ausfüllen, bevor die Zahlungsmethode aktiviert wird.'; + + return $response; + } + + $paymentMethod->update([ + 'name' => $this->request->name, + 'description' => $this->request->description, + 'active' => $this->request->active, + 'configuration' => $configuration, + ]); + + if ($wasActive && !$this->request->active) { + (new RemovePaymentMethodUsageAction())->execute($paymentMethod); + } + + $response->success = true; + $response->message = 'Zahlungsmethode wurde gespeichert.'; + + return $response; + } +} diff --git a/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodRequest.php b/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodRequest.php new file mode 100644 index 0000000..f7c73d3 --- /dev/null +++ b/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodRequest.php @@ -0,0 +1,20 @@ + $configuration + */ + public function __construct( + public AvailablePaymentMethod $availablePaymentMethod, + public string $name, + public ?string $description, + public bool $active, + public array $configuration = [], + ) { + } +} diff --git a/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodResponse.php b/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodResponse.php new file mode 100644 index 0000000..0fc0655 --- /dev/null +++ b/app/Domains/Admin/Actions/UpdateAvailablePaymentMethod/UpdateAvailablePaymentMethodResponse.php @@ -0,0 +1,9 @@ +json([ + 'paymentMethods' => AvailablePaymentMethod::all() + ->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)), + 'saveEndpoint' => '/api/v1/admin/tenant/payment-methods', + ]); + } +} diff --git a/app/Domains/Admin/Controllers/TenantPaymentMethodsUpdateController.php b/app/Domains/Admin/Controllers/TenantPaymentMethodsUpdateController.php new file mode 100644 index 0000000..42588a2 --- /dev/null +++ b/app/Domains/Admin/Controllers/TenantPaymentMethodsUpdateController.php @@ -0,0 +1,33 @@ +input('name'), + description: $request->input('description'), + active: (bool) $request->input('active'), + configuration: (array) $request->input('configuration', []), + )); + + $response = $action->execute(); + + return response()->json([ + 'status' => $response->success ? 'success' : 'error', + 'message' => $response->message, + ]); + } +} diff --git a/app/Domains/Admin/Routes/api.php b/app/Domains/Admin/Routes/api.php index 2d1337d..a7a7069 100644 --- a/app/Domains/Admin/Routes/api.php +++ b/app/Domains/Admin/Routes/api.php @@ -25,6 +25,8 @@ use App\Domains\Admin\Controllers\TenantImpressUpdateController; use App\Domains\Admin\Controllers\TenantListApiController; use App\Domains\Admin\Controllers\TenantPaymentGetController; use App\Domains\Admin\Controllers\TenantPaymentUpdateController; +use App\Domains\Admin\Controllers\TenantPaymentMethodsGetController; +use App\Domains\Admin\Controllers\TenantPaymentMethodsUpdateController; use App\Middleware\AdminRoleMiddleware; use App\Middleware\IdentifyTenant; use App\Middleware\LvOnlyMiddleware; @@ -36,6 +38,8 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])-> Route::post('/contact', TenantContactUpdateController::class); Route::get('/payment', TenantPaymentGetController::class); Route::post('/payment', TenantPaymentUpdateController::class); + Route::get('/payment-methods', TenantPaymentMethodsGetController::class); + Route::post('/payment-methods/{id}', TenantPaymentMethodsUpdateController::class); Route::get('/impress', TenantImpressGetController::class); Route::post('/impress', TenantImpressUpdateController::class); Route::get('/gdpr', TenantGdprGetController::class); diff --git a/app/Domains/Admin/Views/Partials/TenantPaymentMethods.vue b/app/Domains/Admin/Views/Partials/TenantPaymentMethods.vue new file mode 100644 index 0000000..ac8d306 --- /dev/null +++ b/app/Domains/Admin/Views/Partials/TenantPaymentMethods.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/app/Domains/Admin/Views/TenantData.vue b/app/Domains/Admin/Views/TenantData.vue index 5622db5..8d6c19b 100644 --- a/app/Domains/Admin/Views/TenantData.vue +++ b/app/Domains/Admin/Views/TenantData.vue @@ -6,6 +6,7 @@ import TenantContact from "./Partials/TenantContact.vue"; import TenantPayment from "./Partials/TenantPayment.vue"; import TenantImpress from "./Partials/TenantImpress.vue"; import TenantGdpr from "./Partials/TenantGdpr.vue"; +import TenantPaymentMethods from "./Partials/TenantPaymentMethods.vue"; const props = defineProps({ tenant: Object, @@ -22,6 +23,11 @@ const tabs = [ component: TenantPayment, endpoint: '/api/v1/admin/tenant/payment', }, + { + title: 'Zahlungswege', + component: TenantPaymentMethods, + endpoint: '/api/v1/admin/tenant/payment-methods', + }, { title: 'Impressum', component: TenantImpress, diff --git a/app/Domains/Event/Actions/CreateEvent/CreateEventCommand.php b/app/Domains/Event/Actions/CreateEvent/CreateEventCommand.php index 4432649..72302ab 100644 --- a/app/Domains/Event/Actions/CreateEvent/CreateEventCommand.php +++ b/app/Domains/Event/Actions/CreateEvent/CreateEventCommand.php @@ -3,10 +3,12 @@ namespace App\Domains\Event\Actions\CreateEvent; use App\Enumerations\EatingHabit; +use App\Models\AvailablePaymentMethod; use App\Models\Event; use App\Models\Tenant; use App\RelationModels\EventEatingHabits; use App\RelationModels\EventLocalGroups; +use App\RelationModels\EventPaymentMethods; use Illuminate\Support\Str; class CreateEventCommand { @@ -41,7 +43,7 @@ class CreateEventCommand { 'account_iban' => $this->request->accountIban, 'participation_fee_type' => $this->request->participationFeeType->slug, 'pay_per_day' => $this->request->payPerDay, - 'pay_direct' => $this->request->payDirect, + 'pay_direct' => false, 'total_max_amount' => 0, 'support_per_person' => 0, 'support_flat' => 0, @@ -58,6 +60,14 @@ class CreateEventCommand { 'eating_habit_id' => EatingHabit::where('slug', EatingHabit::EATING_HABIT_VEGETARIAN)->first()->id, ]); + foreach (AvailablePaymentMethod::where('active', true)->get() as $availablePaymentMethod) { + EventPaymentMethods::create([ + 'event_id' => $event->id, + 'slug' => $availablePaymentMethod->slug, + 'configuration' => $availablePaymentMethod->configuration ?? [], + ]); + } + if (app('tenant')->slug === 'lv') { foreach(Tenant::where(['is_active_local_group' => true])->get() as $tenant) { EventLocalGroups::create(['event_id' => $event->id, 'local_group_id' => $tenant->id]); diff --git a/app/Domains/Event/Actions/CreateEvent/CreateEventRequest.php b/app/Domains/Event/Actions/CreateEvent/CreateEventRequest.php index 87844d5..dbf5ed5 100644 --- a/app/Domains/Event/Actions/CreateEvent/CreateEventRequest.php +++ b/app/Domains/Event/Actions/CreateEvent/CreateEventRequest.php @@ -19,9 +19,8 @@ class CreateEventRequest { public string $accountOwner; public string $accountIban; public bool $payPerDay; - public bool $payDirect; - public function __construct(string $name, string $location, string $postalCode, string $email, DateTime $begin, DateTime $end, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $earlyBirdEndAmountIncrease, ParticipationFeeType $participationFeeType, string $accountOwner, string $accountIban, bool $payPerDay, bool $payDirect) { + public function __construct(string $name, string $location, string $postalCode, string $email, DateTime $begin, DateTime $end, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $earlyBirdEndAmountIncrease, ParticipationFeeType $participationFeeType, string $accountOwner, string $accountIban, bool $payPerDay) { $this->name = $name; $this->location = $location; $this->postalCode = $postalCode; @@ -35,6 +34,5 @@ class CreateEventRequest { $this->accountOwner = $accountOwner; $this->accountIban = $accountIban; $this->payPerDay = $payPerDay; - $this->payDirect = $payDirect; } } diff --git a/app/Domains/Event/Actions/SignUp/SignUpCommand.php b/app/Domains/Event/Actions/SignUp/SignUpCommand.php index c454281..48667a4 100644 --- a/app/Domains/Event/Actions/SignUp/SignUpCommand.php +++ b/app/Domains/Event/Actions/SignUp/SignUpCommand.php @@ -21,6 +21,7 @@ class SignUpCommand { }; $participantAge = new Age($this->request->birthday); + $response->participant = $this->request->event->participants()->create( [ 'tenant' => $this->request->event->tenant, @@ -60,6 +61,7 @@ class SignUpCommand { 'notes' => $this->request->notes, 'amount' => $this->request->amount, 'payment_purpose' => $this->request->event->name . ' - Beitrag ' . $this->request->firstname . ' ' . $this->request->lastname, + 'payment_method' => $this->request->paymentMethod, 'efz_status' => $participantAge->isfullAged() ? EfzStatus::EFZ_STATUS_NOT_CHECKED : EfzStatus::EFZ_STATUS_NOT_REQUIRED, ] ); diff --git a/app/Domains/Event/Actions/SignUp/SignUpRequest.php b/app/Domains/Event/Actions/SignUp/SignUpRequest.php index 778aa15..fc6d648 100644 --- a/app/Domains/Event/Actions/SignUp/SignUpRequest.php +++ b/app/Domains/Event/Actions/SignUp/SignUpRequest.php @@ -44,7 +44,8 @@ class SignUpRequest { public int $arrival_eating, public int $departure_eating, public ?string $notes, - public Amount $amount + public Amount $amount, + public ?string $paymentMethod, ) { } } diff --git a/app/Domains/Event/Actions/UpdateEvent/UpdateEventCommand.php b/app/Domains/Event/Actions/UpdateEvent/UpdateEventCommand.php index 1acebf3..f136114 100644 --- a/app/Domains/Event/Actions/UpdateEvent/UpdateEventCommand.php +++ b/app/Domains/Event/Actions/UpdateEvent/UpdateEventCommand.php @@ -2,6 +2,10 @@ namespace App\Domains\Event\Actions\UpdateEvent; +use App\Models\AvailablePaymentMethod; +use App\Models\PaymentMethod; +use App\RelationModels\EventPaymentMethods; + class UpdateEventCommand { public UpdateEventRequest $request; public function __construct(UpdateEventRequest $request) { @@ -11,6 +15,12 @@ class UpdateEventCommand { public function execute() : UpdateEventResponse { $response = new UpdateEventResponse(); + if (count($this->request->paymentMethods) === 0) { + $response->success = false; + $response->message = 'Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.'; + return $response; + } + $this->request->event->name = $this->request->eventName; $this->request->event->location = $this->request->eventLocation; $this->request->event->postal_code = $this->request->postalCode; @@ -35,9 +45,58 @@ class UpdateEventCommand { $this->request->event->localGroups()->attach($contributingLocalGroup); } + $this->syncPaymentMethods(); + $this->request->event->save(); $response->success = true; return $response; } + + /** + * Differenzieller Sync der Zahlungsmethoden mit Snapshot-Copy-Semantik: + * - entfernte Methoden werden gelöscht, + * - neue Methoden erhalten einen Snapshot der Tenant-Config (oder eines expliziten Overrides), + * - bestehende Methoden behalten ihre pro-Event-Config, sofern kein Override übergeben wird. + */ + private function syncPaymentMethods(): void + { + $event = $this->request->event; + $desiredSlugs = $this->request->paymentMethods; + $overrides = $this->request->paymentMethodConfigurations; + + $existing = EventPaymentMethods::where('event_id', $event->id)->get()->keyBy('slug'); + + // Nicht mehr gewünschte Methoden entfernen. + foreach ($existing as $slug => $row) { + if (!in_array($slug, $desiredSlugs, true)) { + $row->delete(); + } + } + + // Tenant-Instanzen (für Snapshot-Kopie neuer Methoden) laden. + $tenantMethods = AvailablePaymentMethod::whereIn('slug', $desiredSlugs)->get()->keyBy('slug'); + + foreach ($desiredSlugs as $slug) { + $override = $overrides[$slug] ?? null; + + if (isset($existing[$slug])) { + // Bestehende Zuweisung: Config nur bei explizitem Override anpassen, sonst unverändert lassen. + if ($override !== null) { + $row = $existing[$slug]; + $row->configuration = PaymentMethod::sanitizeConfiguration($slug, $override); + $row->save(); + } + continue; + } + + // Neue Zuweisung: expliziter Override oder Snapshot der Tenant-Config. + $snapshot = $override ?? ($tenantMethods[$slug]->configuration ?? []); + EventPaymentMethods::create([ + 'event_id' => $event->id, + 'slug' => $slug, + 'configuration' => PaymentMethod::sanitizeConfiguration($slug, $snapshot ?? []), + ]); + } + } } diff --git a/app/Domains/Event/Actions/UpdateEvent/UpdateEventRequest.php b/app/Domains/Event/Actions/UpdateEvent/UpdateEventRequest.php index 4c9edd4..ffb9f41 100644 --- a/app/Domains/Event/Actions/UpdateEvent/UpdateEventRequest.php +++ b/app/Domains/Event/Actions/UpdateEvent/UpdateEventRequest.php @@ -21,8 +21,18 @@ class UpdateEventRequest { public Amount $supportPerPerson; public array $contributingLocalGroups; public array $eatingHabits; + public array $paymentMethods; - public function __construct(Event $event, string $eventName, string $eventLocation, string $postalCode, string $email, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $alcoholicsAge, bool $sendWeeklyReports, bool $registrationAllowed, Amount $flatSupport, Amount $supportPerPerson, array $contributingLocalGroups, array $eatingHabits) { + /** + * Optionale pro-Event-Config-Overrides je Zahlungsmethode: [slug => [option => value]]. + * Fehlt ein Slug, bleibt die bestehende Config erhalten bzw. wird beim ersten Zuweisen + * aus der Tenant-Config als Snapshot kopiert. + * + * @var array> + */ + public array $paymentMethodConfigurations; + + public function __construct(Event $event, string $eventName, string $eventLocation, string $postalCode, string $email, DateTime $earlyBirdEnd, DateTime $registrationFinalEnd, int $alcoholicsAge, bool $sendWeeklyReports, bool $registrationAllowed, Amount $flatSupport, Amount $supportPerPerson, array $contributingLocalGroups, array $eatingHabits, array $paymentMethods, array $paymentMethodConfigurations = []) { $this->event = $event; $this->eventName = $eventName; $this->eventLocation = $eventLocation; @@ -37,5 +47,7 @@ class UpdateEventRequest { $this->supportPerPerson = $supportPerPerson; $this->contributingLocalGroups = $contributingLocalGroups; $this->eatingHabits = $eatingHabits; + $this->paymentMethods = $paymentMethods; + $this->paymentMethodConfigurations = $paymentMethodConfigurations; } } diff --git a/app/Domains/Event/Actions/UpdateEvent/UpdateEventResponse.php b/app/Domains/Event/Actions/UpdateEvent/UpdateEventResponse.php index c30be98..aa77952 100644 --- a/app/Domains/Event/Actions/UpdateEvent/UpdateEventResponse.php +++ b/app/Domains/Event/Actions/UpdateEvent/UpdateEventResponse.php @@ -4,9 +4,11 @@ namespace App\Domains\Event\Actions\UpdateEvent; class UpdateEventResponse { public bool $success; + public string $message; public function __construct() { $this->success = false; + $this->message = ''; } } diff --git a/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantCommand.php b/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantCommand.php index 221c0fb..c333fc0 100644 --- a/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantCommand.php +++ b/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantCommand.php @@ -42,6 +42,7 @@ class UpdateParticipantCommand { $p->departure_date = DateTime::createFromFormat('Y-m-d', $this->request->departure); $p->participation_type = $this->request->participationType; $p->eating_habit = $this->request->eatingHabit; + $p->payment_method = $this->request->paymentMethod; $p->allergies = $this->request->allergies; $p->intolerances = $this->request->intolerances; $p->medications = $this->request->medications; diff --git a/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantRequest.php b/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantRequest.php index d2ce288..443695a 100644 --- a/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantRequest.php +++ b/app/Domains/Event/Actions/UpdateParticipant/UpdateParticipantRequest.php @@ -25,6 +25,7 @@ class UpdateParticipantRequest { public string $departure, public string $participationType, public string $eatingHabit, + public ?string $paymentMethod, public ?string $allergies, public ?string $intolerances, public ?string $medications, diff --git a/app/Domains/Event/Controllers/CreateController.php b/app/Domains/Event/Controllers/CreateController.php index 117aa2e..1a9fbab 100644 --- a/app/Domains/Event/Controllers/CreateController.php +++ b/app/Domains/Event/Controllers/CreateController.php @@ -39,7 +39,6 @@ class CreateController extends CommonController { $registrationFinalEnd = DateTime::createFromFormat('Y-m-d', $request->input('eventRegistrationFinalEnd')); $participationFeeType = ParticipationFeeType::where('slug', $request->input('eventParticipationFeeType'))->first(); $payPerDay = $request->input('eventPayPerDay'); - $payDirect = $request->input('eventPayDirectly'); $billingDeadline = clone $eventEnd; $billingDeadline->modify('+6 weeks'); @@ -57,8 +56,7 @@ class CreateController extends CommonController { $participationFeeType, $request->input('eventAccount'), $request->input('eventIban'), - $payPerDay, - $payDirect + $payPerDay ); $wasSuccessful = false; diff --git a/app/Domains/Event/Controllers/DetailsController.php b/app/Domains/Event/Controllers/DetailsController.php index b0d7ebc..c96f840 100644 --- a/app/Domains/Event/Controllers/DetailsController.php +++ b/app/Domains/Event/Controllers/DetailsController.php @@ -42,6 +42,8 @@ class DetailsController extends CommonController { $contributinLocalGroups = $request->input('contributingLocalGroups'); $eatingHabits = $request->input('eatingHabits'); + $paymentMethods = $request->input('paymentMethods'); + $paymentMethodConfigurations = (array) $request->input('paymentMethodConfigurations', []); $eventUpdateRequest = new UpdateEventRequest( $event, @@ -57,13 +59,15 @@ class DetailsController extends CommonController { $flatSupport, $supportPerPerson, $contributinLocalGroups, - $eatingHabits + $eatingHabits, + $paymentMethods, + $paymentMethodConfigurations ); $eventUpdateCommand = new UpdateEventCommand($eventUpdateRequest); $response = $eventUpdateCommand->execute(); - return response()->json(['status' => $response->success ? 'success' : 'error']); + return response()->json(['status' => $response->success ? 'success' : 'error', 'message' => $response->message]); } public function updateEventManagers(int $eventId, Request $request) : JsonResponse { diff --git a/app/Domains/Event/Controllers/ParticipantUpdateController.php b/app/Domains/Event/Controllers/ParticipantUpdateController.php index 869bc51..f4d1dbc 100644 --- a/app/Domains/Event/Controllers/ParticipantUpdateController.php +++ b/app/Domains/Event/Controllers/ParticipantUpdateController.php @@ -33,6 +33,7 @@ class ParticipantUpdateController extends CommonController { departure: $request->input('departure'), participationType: $request->input('participationType'), eatingHabit: $request->input('eatingHabit'), + paymentMethod: $request->input('paymentMethod'), allergies: $request->input('allergies'), intolerances: $request->input('intolerances'), medications: $request->input('medications'), diff --git a/app/Domains/Event/Controllers/SignupController.php b/app/Domains/Event/Controllers/SignupController.php index 01bcd6d..01f82d1 100644 --- a/app/Domains/Event/Controllers/SignupController.php +++ b/app/Domains/Event/Controllers/SignupController.php @@ -24,7 +24,12 @@ class SignupController extends CommonController { $availableEvents[] = $event->toResource()->toArray($request); }; - $event = $this->events->getByIdentifier($eventId, false)?->toResource()->toArray($request); + $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(); $participantData = [ 'firstname' => '', @@ -62,6 +67,7 @@ class SignupController extends CommonController { 'availableEvents' => $availableEvents, 'localGroups' => $event['contributingLocalGroups'], 'participantData' => $participantData, + 'paymentMethod' => $paymentMethod?->slug, ]); return $inertiaProvider->render(); } @@ -136,7 +142,8 @@ class SignupController extends CommonController { $registrationData['anreise_essen'], $registrationData['abreise_essen'], $registrationData['anmerkungen'], - $amount + $amount, + $registrationData['paymentMethod'] ?? null, ); $signupCommand = new SignUpCommand($signupRequest); diff --git a/app/Domains/Event/Views/Create.vue b/app/Domains/Event/Views/Create.vue index 2c3c359..310cd5d 100644 --- a/app/Domains/Event/Views/Create.vue +++ b/app/Domains/Event/Views/Create.vue @@ -31,7 +31,6 @@ eventRegistrationFinalEnd: '', eventAccount: props.eventAccount ? props.eventAccount : '', eventIban: props.eventIban ? props.eventIban : '', - eventPayDirectly: true, eventPayPerDay: props.eventPayPerDay ? props.eventPayPerDay : false, eventParticipationFeeType: props.participationFeeType ? props.participationFeeType : 'fixed', }); @@ -154,7 +153,6 @@ eventRegistrationFinalEnd: formData.eventRegistrationFinalEnd, eventAccount: formData.eventAccount, eventIban: formData.eventIban, - eventPayDirectly: formData.eventPayDirectly, eventPayPerDay: formData.eventPayPerDay, eventParticipationFeeType: formData.eventParticipationFeeType, } @@ -262,13 +260,6 @@ - - - - Teilnehmende zahlen direkt aufs Veranstaltungskonto - - - diff --git a/app/Domains/Event/Views/Partials/CommonSettings.vue b/app/Domains/Event/Views/Partials/CommonSettings.vue index 738a2fa..c5ac008 100644 --- a/app/Domains/Event/Views/Partials/CommonSettings.vue +++ b/app/Domains/Event/Views/Partials/CommonSettings.vue @@ -1,11 +1,12 @@