Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b15573cda6 | ||
|
|
67c4e69f7b | ||
|
|
7f8417e915 | ||
|
|
f8dba18854 | ||
|
|
daff70b4fe | ||
|
|
7919d04dc3 | ||
|
|
cea00f9679 | ||
|
|
a0d26648ee | ||
|
|
e55cdd1988 | ||
|
|
d1ef092bc3 | ||
|
|
78f4d813f9 | ||
|
|
8d6a4041c1 | ||
|
|
29db141b84 | ||
|
|
ab3d526217 | ||
|
|
6c9281516e | ||
|
|
afc91545a9 | ||
|
|
12d98b4d7e | ||
|
|
6c7fe56579 | ||
|
|
e09987f5a8 | ||
|
|
5c514e9ff5 |
@@ -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).
|
||||
@@ -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,20 @@ class CreateTenantAction
|
||||
'has_active_instance' => true,
|
||||
]);
|
||||
|
||||
$paymentMethodDefaults = PaymentMethod::defaults();
|
||||
foreach (PaymentMethod::all() as $paymentMethod) {
|
||||
$defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null, 'configuration' => []];
|
||||
|
||||
AvailablePaymentMethod::create([
|
||||
'tenant' => $tenant->slug,
|
||||
'slug' => $paymentMethod->slug,
|
||||
'name' => $defaults['name'],
|
||||
'description' => $defaults['description'],
|
||||
'active' => true,
|
||||
'configuration' => PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $defaults['configuration'] ?? []),
|
||||
]);
|
||||
}
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'Stamm wurde angelegt.';
|
||||
$response->slug = $tenant->slug;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\RemovePaymentMethodUsage;
|
||||
|
||||
use App\Mail\EventReportMails\PaymentMethodsExhaustedMail;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class RemovePaymentMethodUsageAction
|
||||
{
|
||||
public function execute(AvailablePaymentMethod $availablePaymentMethod): void
|
||||
{
|
||||
foreach ($availablePaymentMethod->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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
|
||||
|
||||
use App\Domains\Admin\Actions\RemovePaymentMethodUsage\RemovePaymentMethodUsageAction;
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
class UpdateAvailablePaymentMethodAction
|
||||
{
|
||||
public function __construct(private UpdateAvailablePaymentMethodRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(): UpdateAvailablePaymentMethodResponse
|
||||
{
|
||||
$response = new UpdateAvailablePaymentMethodResponse();
|
||||
$paymentMethod = $this->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;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
|
||||
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
|
||||
class UpdateAvailablePaymentMethodRequest
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $configuration
|
||||
*/
|
||||
public function __construct(
|
||||
public AvailablePaymentMethod $availablePaymentMethod,
|
||||
public string $name,
|
||||
public ?string $description,
|
||||
public bool $active,
|
||||
public array $configuration = [],
|
||||
) {
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
|
||||
|
||||
class UpdateAvailablePaymentMethodResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
public string $message = '';
|
||||
}
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateTenantPayment;
|
||||
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Scopes\SiteScope;
|
||||
|
||||
class UpdateTenantPaymentAction
|
||||
{
|
||||
public function __construct(private UpdateTenantPaymentRequest $request)
|
||||
@@ -18,9 +22,41 @@ class UpdateTenantPaymentAction
|
||||
'account_name' => $this->request->accountName,
|
||||
]);
|
||||
|
||||
$this->syncTransferPaymentConfiguration();
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'Bezahldaten wurden gespeichert.';
|
||||
$response->message = 'IBAN-Informationen wurden gespeichert.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Übernimmt die eingegebenen IBAN-Daten direkt in die Tenant-Config der Überweisungs-Zahlungsart
|
||||
* (Kontoinhaber/IBAN/BIC), damit sie nicht doppelt gepflegt werden müssen. Bestehende weitere
|
||||
* Config-Werte (z.B. Symbol) bleiben erhalten. Der Ziel-Tenant kann ein verwalteter sein, daher
|
||||
* ohne SiteScope explizit auf den Tenant-Slug gefiltert.
|
||||
*/
|
||||
private function syncTransferPaymentConfiguration(): void
|
||||
{
|
||||
$slug = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION;
|
||||
|
||||
$method = AvailablePaymentMethod::withoutGlobalScope(SiteScope::class)
|
||||
->where('tenant', $this->request->tenant->slug)
|
||||
->where('slug', $slug)
|
||||
->first();
|
||||
|
||||
if ($method === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$method->configuration = PaymentMethod::sanitizeConfiguration($slug, array_merge(
|
||||
$method->configuration ?? [],
|
||||
[
|
||||
'account_owner' => $this->request->accountName,
|
||||
'iban' => $this->request->accountIban,
|
||||
'bic' => $this->request->accountBic,
|
||||
],
|
||||
));
|
||||
$method->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Resources\AvailablePaymentMethodResource;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TenantPaymentMethodsGetController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'paymentMethods' => AvailablePaymentMethod::all()
|
||||
->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)),
|
||||
'saveEndpoint' => '/api/v1/admin/tenant/payment-methods',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Domains\Admin\Actions\UpdateAvailablePaymentMethod\UpdateAvailablePaymentMethodAction;
|
||||
use App\Domains\Admin\Actions\UpdateAvailablePaymentMethod\UpdateAvailablePaymentMethodRequest;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TenantPaymentMethodsUpdateController extends CommonController
|
||||
{
|
||||
public function __invoke(int $id, Request $request): JsonResponse
|
||||
{
|
||||
$availablePaymentMethod = AvailablePaymentMethod::findOrFail($id);
|
||||
|
||||
$action = new UpdateAvailablePaymentMethodAction(new UpdateAvailablePaymentMethodRequest(
|
||||
availablePaymentMethod: $availablePaymentMethod,
|
||||
name: $request->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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
<script setup>
|
||||
import {computed, ref} from 'vue';
|
||||
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
||||
import TextEditor from "../../../../Views/Components/TextEditor.vue";
|
||||
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
|
||||
import {PAYMENT_METHOD_ICONS} from "../../../../../resources/js/constants/paymentMethodIcons.js";
|
||||
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
||||
import {toast} from "vue3-toastify";
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
|
||||
const { request } = useAjax()
|
||||
|
||||
const paymentMethods = ref(props.data.paymentMethods ?? [])
|
||||
const editing = ref(null)
|
||||
const form = ref({ name: '', description: '', active: true, configuration: {} })
|
||||
|
||||
// Sind alle Pflichtfelder des aktuell bearbeiteten Moduls befüllt? Der Server ist die
|
||||
// eigentliche Autorität (Guard), das hier dient nur der Bedienführung.
|
||||
const requiredComplete = computed(() => {
|
||||
if (!editing.value) return true
|
||||
return (editing.value.optionsSchema ?? [])
|
||||
.filter(option => option.required)
|
||||
.every(option => {
|
||||
const value = form.value.configuration[option.name]
|
||||
return value !== undefined && value !== null && value !== ''
|
||||
})
|
||||
})
|
||||
|
||||
function edit(paymentMethod) {
|
||||
editing.value = paymentMethod
|
||||
const configuration = {}
|
||||
for (const option of paymentMethod.optionsSchema ?? []) {
|
||||
configuration[option.name] = paymentMethod.configuration?.[option.name] ?? ''
|
||||
}
|
||||
form.value = {
|
||||
name: paymentMethod.name,
|
||||
description: paymentMethod.description ?? '',
|
||||
active: paymentMethod.active,
|
||||
configuration,
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
editing.value = null
|
||||
}
|
||||
|
||||
async function save() {
|
||||
const response = await request('/api/v1/admin/tenant/payment-methods/' + editing.value.id, {
|
||||
method: 'POST',
|
||||
body: form.value,
|
||||
})
|
||||
|
||||
if (response && response.status === 'success') {
|
||||
toast.success(response.message)
|
||||
Object.assign(editing.value, form.value)
|
||||
close()
|
||||
} else {
|
||||
toast.error(response?.message ?? 'Fehler beim Speichern')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<table class="payment-method-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th class="empty"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="paymentMethod in paymentMethods" :key="paymentMethod.id">
|
||||
<td>{{ paymentMethod.name }}</td>
|
||||
<td>
|
||||
<span :class="paymentMethod.active ? 'badge-active' : 'badge-inactive'">
|
||||
{{ paymentMethod.active ? 'Aktiv' : 'Inaktiv' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn-edit" @click="edit(paymentMethod)">Bearbeiten</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<FullScreenModal :show="editing !== null" @close="close">
|
||||
<template v-if="editing">
|
||||
<h2>Zahlungsmodul bearbeiten</h2>
|
||||
<table class="data-table">
|
||||
<tr><th>Name</th><td><input type="text" v-model="form.name" class="form-input" /></td></tr>
|
||||
<tr><th>Beschreibung</th><td><textarea v-model="form.description" class="form-input"></textarea></td></tr>
|
||||
<tr v-for="option in editing.optionsSchema ?? []" :key="option.name">
|
||||
<th>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></th>
|
||||
<td>
|
||||
<RichSelectBox v-if="option.type === 'icon'" v-model="form.configuration[option.name]"
|
||||
:options="PAYMENT_METHOD_ICONS" placeholder="Symbol wählen…"/>
|
||||
<TextEditor v-else-if="option.type === 'richtext'" v-model="form.configuration[option.name]"/>
|
||||
<input v-else type="text" v-model="form.configuration[option.name]" class="form-input"/>
|
||||
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Aktiv</th>
|
||||
<td>
|
||||
<input type="checkbox" v-model="form.active" :disabled="!requiredComplete && !form.active" />
|
||||
<span v-if="!requiredComplete" class="hint">Bitte zuerst alle Pflichtfelder (*) ausfüllen, um zu aktivieren.</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="btn-group">
|
||||
<button class="btn-save" @click="save">Speichern</button>
|
||||
<button class="btn-cancel" @click="close">Abbrechen</button>
|
||||
</div>
|
||||
</template>
|
||||
</FullScreenModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.payment-method-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.payment-method-table thead th {
|
||||
text-align: left;
|
||||
padding: 10px 16px;
|
||||
background-color: #f9fafb;
|
||||
color: #374151;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid #d1d5db;
|
||||
}
|
||||
|
||||
.payment-method-table tbody td {
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.badge-active {
|
||||
display: inline-block;
|
||||
padding: 3px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: bold;
|
||||
color: #166534;
|
||||
background-color: #dcfce7;
|
||||
border: 1px solid #22c55e;
|
||||
}
|
||||
|
||||
.badge-inactive {
|
||||
display: inline-block;
|
||||
padding: 3px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: bold;
|
||||
color: #991b1b;
|
||||
background-color: #fee2e2;
|
||||
border: 1px solid #ef4444;
|
||||
}
|
||||
|
||||
.btn-edit {
|
||||
padding: 6px 16px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
font-size: 0.9rem;
|
||||
background-color: #1d4899;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-edit:hover {
|
||||
background-color: #163a7a;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.data-table th {
|
||||
text-align: left;
|
||||
padding: 8px 12px;
|
||||
width: 200px;
|
||||
color: #374151;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.data-table td {
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
font-size: 0.95rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.required-marker {
|
||||
color: #ef4444;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.hint {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
font-size: 0.8rem;
|
||||
color: #b45309;
|
||||
}
|
||||
|
||||
.option-hint {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
font-size: 0.8rem;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.btn-save, .btn-cancel {
|
||||
padding: 8px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
background-color: #16a34a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-save:hover {
|
||||
background-color: #15803d;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
background-color: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
background-color: #d1d5db;
|
||||
}
|
||||
</style>
|
||||
@@ -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,
|
||||
@@ -18,10 +19,15 @@ const tabs = [
|
||||
endpoint: '/api/v1/admin/tenant/contact',
|
||||
},
|
||||
{
|
||||
title: 'Bezahldaten',
|
||||
title: 'IBAN-Informationen',
|
||||
component: TenantPayment,
|
||||
endpoint: '/api/v1/admin/tenant/payment',
|
||||
},
|
||||
{
|
||||
title: 'Zahlungsmodule',
|
||||
component: TenantPaymentMethods,
|
||||
endpoint: '/api/v1/admin/tenant/payment-methods',
|
||||
},
|
||||
{
|
||||
title: 'Impressum',
|
||||
component: TenantImpress,
|
||||
|
||||
@@ -26,7 +26,7 @@ const tabs = [
|
||||
endpoint: '/api/v1/admin/tenants/' + slug + '/contact',
|
||||
},
|
||||
{
|
||||
title: 'Bezahldaten',
|
||||
title: 'IBAN-Informationen',
|
||||
component: TenantPayment,
|
||||
endpoint: '/api/v1/admin/tenants/' + slug + '/payment',
|
||||
},
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Actions\SetPaymentMethods;
|
||||
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\RelationModels\EventPaymentMethods;
|
||||
|
||||
class SetPaymentMethodsCommand
|
||||
{
|
||||
public SetPaymentMethodsRequest $request;
|
||||
|
||||
public function __construct(SetPaymentMethodsRequest $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function execute(): SetPaymentMethodsResponse
|
||||
{
|
||||
$response = new SetPaymentMethodsResponse();
|
||||
|
||||
if (count($this->request->paymentMethods) === 0) {
|
||||
$response->success = false;
|
||||
$response->message = 'Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.';
|
||||
return $response;
|
||||
}
|
||||
|
||||
$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 ?? []),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Actions\SetPaymentMethods;
|
||||
|
||||
use App\Models\Event;
|
||||
|
||||
class SetPaymentMethodsRequest
|
||||
{
|
||||
public Event $event;
|
||||
|
||||
/**
|
||||
* Gewünschte Zahlungsmethoden-Slugs für das Event.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
public array $paymentMethods;
|
||||
|
||||
/**
|
||||
* 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<string, array<string, mixed>>
|
||||
*/
|
||||
public array $paymentMethodConfigurations;
|
||||
|
||||
public function __construct(Event $event, array $paymentMethods, array $paymentMethodConfigurations = [])
|
||||
{
|
||||
$this->event = $event;
|
||||
$this->paymentMethods = $paymentMethods;
|
||||
$this->paymentMethodConfigurations = $paymentMethodConfigurations;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Actions\SetPaymentMethods;
|
||||
|
||||
class SetPaymentMethodsResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
public string $message = '';
|
||||
}
|
||||
@@ -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,
|
||||
@@ -21,6 +34,7 @@ class SignUpCommand {
|
||||
};
|
||||
|
||||
$participantAge = new Age($this->request->birthday);
|
||||
|
||||
$response->participant = $this->request->event->participants()->create(
|
||||
[
|
||||
'tenant' => $this->request->event->tenant,
|
||||
@@ -60,6 +74,8 @@ 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,
|
||||
'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;
|
||||
@@ -44,7 +43,9 @@ class SignUpRequest {
|
||||
public int $arrival_eating,
|
||||
public int $departure_eating,
|
||||
public ?string $notes,
|
||||
public Amount $amount
|
||||
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;
|
||||
|
||||
@@ -22,7 +22,8 @@ class UpdateEventRequest {
|
||||
public array $contributingLocalGroups;
|
||||
public array $eatingHabits;
|
||||
|
||||
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) {
|
||||
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)
|
||||
{
|
||||
$this->event = $event;
|
||||
$this->eventName = $eventName;
|
||||
$this->eventLocation = $eventLocation;
|
||||
|
||||
@@ -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 = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,22 +4,21 @@ namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Domains\Event\Actions\SetParticipationFees\SetParticipationFeesCommand;
|
||||
use App\Domains\Event\Actions\SetParticipationFees\SetParticipationFeesRequest;
|
||||
use App\Domains\Event\Actions\SetPaymentMethods\SetPaymentMethodsCommand;
|
||||
use App\Domains\Event\Actions\SetPaymentMethods\SetPaymentMethodsRequest;
|
||||
use App\Domains\Event\Actions\UpdateEvent\UpdateEventCommand;
|
||||
use App\Domains\Event\Actions\UpdateEvent\UpdateEventRequest;
|
||||
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersCommand;
|
||||
use App\Domains\Event\Actions\UpdateManagers\UpdateManagersRequest;
|
||||
use App\Enumerations\ParticipationFeeType;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Providers\InertiaProvider;
|
||||
use App\Providers\PdfGenerateAndDownloadProvider;
|
||||
use App\Resources\EventResource;
|
||||
use App\Scopes\CommonController;
|
||||
use App\ValueObjects\Amount;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use function Symfony\Component\String\b;
|
||||
|
||||
class DetailsController extends CommonController {
|
||||
public function __invoke(string $eventId) {
|
||||
@@ -63,7 +62,21 @@ class DetailsController extends CommonController {
|
||||
$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 updatePaymentMethods(int $eventId, Request $request): JsonResponse
|
||||
{
|
||||
$event = $this->events->getById($eventId);
|
||||
|
||||
$paymentMethods = $request->input('paymentMethods', []);
|
||||
$paymentMethodConfigurations = (array)$request->input('paymentMethodConfigurations', []);
|
||||
|
||||
$setPaymentMethodsRequest = new SetPaymentMethodsRequest($event, $paymentMethods, $paymentMethodConfigurations);
|
||||
$setPaymentMethodsCommand = new SetPaymentMethodsCommand($setPaymentMethodsRequest);
|
||||
$response = $setPaymentMethodsCommand->execute();
|
||||
|
||||
return response()->json(['status' => $response->success ? 'success' : 'error', 'message' => $response->message]);
|
||||
}
|
||||
|
||||
public function updateEventManagers(int $eventId, Request $request) : JsonResponse {
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -24,7 +24,10 @@ 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);
|
||||
// Die (aktiven) Zahlungsmethoden stehen dem Frontend über $event['paymentMethods'] zur Verfügung;
|
||||
// die Auswahl trifft der/die Teilnehmer\*in im Anmeldeschritt "Zahlungsart".
|
||||
|
||||
$participantData = [
|
||||
'firstname' => '',
|
||||
@@ -68,6 +71,11 @@ class SignupController extends CommonController {
|
||||
|
||||
public function signUp(int $eventId, Request $request) {
|
||||
$event = $this->events->getById($eventId, false);
|
||||
|
||||
if (!$event->registration_allowed || new \DateTime() > $event->start_date) {
|
||||
return response()->json(['status' => 'closed'], 403);
|
||||
}
|
||||
|
||||
$eventResource = $event->toResource();
|
||||
$registrationData = $request->input('registration_data');
|
||||
$siblingReduction = $registrationData['sibling'] === 'true';
|
||||
@@ -131,12 +139,18 @@ class SignupController extends CommonController {
|
||||
$registrationData['anreise_essen'],
|
||||
$registrationData['abreise_essen'],
|
||||
$registrationData['anmerkungen'],
|
||||
$amount
|
||||
$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
|
||||
|
||||
|
||||
@@ -170,14 +184,18 @@ class SignupController extends CommonController {
|
||||
|
||||
$siblingReduction = $request->input('sibling') === 'true';
|
||||
|
||||
return response()->json(['amount' =>
|
||||
$event->calculateAmount(
|
||||
$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()
|
||||
);
|
||||
|
||||
// amountValue (numerisch) steuert im Frontend das Überspringen des Zahlungsart-Schritts bei 0 €.
|
||||
return response()->json([
|
||||
'amount' => $amount->toString(),
|
||||
'amountValue' => $amount->getAmount(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ Route::prefix('api/v1')
|
||||
Route::post('/event-managers', [DetailsController::class, 'updateEventManagers']);
|
||||
Route::post('/participation-fees', [DetailsController::class, 'updateParticipationFees']);
|
||||
Route::post('/common-settings', [DetailsController::class, 'updateCommonSettings']);
|
||||
Route::post('/payment-methods', [DetailsController::class, 'updatePaymentMethods']);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
<ErrorText :message="errors.eventIban" /></td>
|
||||
</tr>
|
||||
|
||||
<tr style="vertical-align: top;">
|
||||
<td colspan="2" style="font-weight: bold;">
|
||||
<input type="checkbox" v-model="formData.eventPayDirectly">
|
||||
Teilnehmende zahlen direkt aufs Veranstaltungskonto
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="vertical-align: top;">
|
||||
<td colspan="2" style="font-weight: bold;">
|
||||
<input type="checkbox" v-model="formData.eventPayPerDay">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup>
|
||||
import {onMounted, reactive, ref} from "vue";
|
||||
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||
import {toast} from "vue3-toastify";
|
||||
import {onMounted, reactive, ref} from "vue";
|
||||
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||
import {toast} from "vue3-toastify";
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
const dynmicProps = reactive({
|
||||
localGroups: [],
|
||||
eatingHabits:[]
|
||||
eatingHabits:[],
|
||||
});
|
||||
|
||||
const contributingLocalGroups = ref([])
|
||||
@@ -75,7 +75,7 @@
|
||||
toast.success('Einstellungen wurden erfolgreich gespeichert.')
|
||||
emit('close')
|
||||
} else {
|
||||
toast.error('Beim Speichern ist ein Fehler aufgetreten.')
|
||||
toast.error(response.message ?? 'Beim Speichern ist ein Fehler aufgetreten.')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ const form = reactive({
|
||||
departure: '',
|
||||
participationType: '',
|
||||
eatingHabit: '',
|
||||
paymentMethod: '',
|
||||
allergies: '',
|
||||
intolerances: '',
|
||||
medications: '',
|
||||
@@ -82,6 +83,7 @@ watch(
|
||||
form.departure = participant?.departureDate ?? '';
|
||||
form.participationType = participant?.participation_type ?? '';
|
||||
form.eatingHabit = participant?.eating_habit ?? '';
|
||||
form.paymentMethod = participant?.payment_method ?? '';
|
||||
form.allergies = participant?.allergies ?? '';
|
||||
form.intolerances = participant?.intolerances ?? '';
|
||||
form.medications = participant?.medications ?? '';
|
||||
@@ -206,7 +208,7 @@ function saveParticipant() {
|
||||
<tr>
|
||||
<th>Telefon</th>
|
||||
<td>
|
||||
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_1"</DialableTelephoneNumber>
|
||||
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_1" />
|
||||
<input v-else v-model="form.phone_1" type="text" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -230,7 +232,7 @@ function saveParticipant() {
|
||||
<tr>
|
||||
<th>Ansprechperson Telefon</th>
|
||||
<td>
|
||||
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_2"</DialableTelephoneNumber>
|
||||
<DialableTelephoneNumber v-if="!staticProps.editMode" :number="props.participant.phone_2" />
|
||||
<input v-else v-model="form.phone_2" type="text" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -284,6 +286,20 @@ function saveParticipant() {
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Zahlungsmethode</th>
|
||||
<td>
|
||||
<span v-if="!staticProps.editMode">{{ props.participant.paymentMethod }}</span>
|
||||
<select v-else v-model="form.paymentMethod">
|
||||
<option
|
||||
v-for="paymentMethod in staticProps.event.paymentMethods"
|
||||
:value="paymentMethod.slug"
|
||||
>
|
||||
{{ paymentMethod.name }}
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>eFZ-Status</th>
|
||||
<td>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from "vue";
|
||||
import {computed, reactive, ref} from "vue";
|
||||
import Modal from "../../../../Views/Components/Modal.vue";
|
||||
import ParticipantData from "./ParticipantData.vue";
|
||||
import MailCompose from "./MailCompose.vue";
|
||||
import {toast} from "vue3-toastify";
|
||||
import {useAjax} from "../../../../../resources/js/components/ajaxHandler.js";
|
||||
import {format, getDay, getMonth, getYear} from "date-fns";
|
||||
import {format} from "date-fns";
|
||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||
import FullScreenModal from "../../../../Views/Components/FullScreenModal.vue";
|
||||
import DialableTelephoneNumber from "../../../../Views/Components/DialableTelephoneNumber.vue";
|
||||
@@ -344,6 +344,14 @@ function mailToGroup(groupKey) {
|
||||
<span class="link" style="font-size:10pt;" @click="paymentComplete(participant)">Zahlung buchen</span>
|
||||
<span class="link" style="font-size:10pt;" @click="openPartialPaymentDialog(participant)">Teilzahlung buchen</span>
|
||||
</span>
|
||||
<br/><br/>
|
||||
<span :id="'participant-' + participant.identifier + '-paymentmethod'"
|
||||
style="font-size:10pt;">
|
||||
Zahlungsweise: <label
|
||||
:id="'participant-' + participant.identifier + '-paymentmethod-name'">{{
|
||||
participant.paymentMethod ?? '—'
|
||||
}}</label>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="pl-email">
|
||||
|
||||
@@ -1,16 +1,59 @@
|
||||
<script setup>
|
||||
import {reactive, watch} from "vue";
|
||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
||||
import {toast} from "vue3-toastify";
|
||||
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||
import {onMounted, reactive, ref} from "vue";
|
||||
import AmountInput from "../../../../Views/Components/AmountInput.vue";
|
||||
import ErrorText from "../../../../Views/Components/ErrorText.vue";
|
||||
import TextEditor from "../../../../Views/Components/TextEditor.vue";
|
||||
import Modal from "../../../../Views/Components/Modal.vue";
|
||||
import RichSelectBox from "../../../../Views/Components/RichSelectBox.vue";
|
||||
import {PAYMENT_METHOD_ICONS} from "../../../../../resources/js/constants/paymentMethodIcons.js";
|
||||
import {toast} from "vue3-toastify";
|
||||
import {request} from "../../../../../resources/js/components/HttpClient.js";
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
const props = defineProps({
|
||||
event: Object,
|
||||
})
|
||||
|
||||
// Verfügbare (aktive) Zahlungsarten des Tenants inkl. optionsSchema + Default-Config.
|
||||
const availablePaymentMethods = ref([])
|
||||
// Auswahl der Zahlungsart-Slugs für dieses Event (Default: leer bei neuen Events).
|
||||
const paymentMethods = ref([])
|
||||
// pro-Event-Config je Zahlungsmethode: { slug: { option: value } }
|
||||
const paymentMethodConfigurations = reactive({})
|
||||
|
||||
// Optionen-Modal
|
||||
const showOptionsModal = ref(false)
|
||||
const optionsMethod = ref(null)
|
||||
|
||||
function openOptions(method) {
|
||||
optionsMethod.value = method
|
||||
showOptionsModal.value = true
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
const response = await fetch('/api/v1/core/retrieve-event-setting-data');
|
||||
const data = await response.json();
|
||||
availablePaymentMethods.value = data.paymentMethods ?? []
|
||||
|
||||
paymentMethods.value = props.event.paymentMethods?.map(t => t.slug) ?? []
|
||||
|
||||
// Pro-Event-Config vorbelegen: bereits gespeicherte Pivot-Config des Events hat Vorrang,
|
||||
// sonst der Tenant-Standard (Snapshot-Quelle für neu zugewiesene Methoden).
|
||||
const eventConfigBySlug = {}
|
||||
for (const pm of props.event.paymentMethods ?? []) {
|
||||
eventConfigBySlug[pm.slug] = pm.configuration ?? {}
|
||||
}
|
||||
for (const method of availablePaymentMethods.value) {
|
||||
const source = eventConfigBySlug[method.slug] ?? method.configuration ?? {}
|
||||
const config = {}
|
||||
for (const option of method.optionsSchema ?? []) {
|
||||
config[option.name] = source[option.name] ?? ''
|
||||
}
|
||||
paymentMethodConfigurations[method.slug] = config
|
||||
}
|
||||
})
|
||||
|
||||
const errors = reactive({})
|
||||
const formData = reactive({
|
||||
"pft_1_active": true,
|
||||
@@ -75,6 +118,24 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (paymentMethods.value.length === 0) {
|
||||
toast.error('Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.')
|
||||
return;
|
||||
}
|
||||
|
||||
const paymentResponse = await request('/api/v1/event/details/' + props.event.id + '/payment-methods', {
|
||||
method: "POST",
|
||||
body: {
|
||||
paymentMethods: paymentMethods.value,
|
||||
paymentMethodConfigurations: paymentMethodConfigurations,
|
||||
}
|
||||
})
|
||||
|
||||
if (paymentResponse.status !== 'success') {
|
||||
toast.error(paymentResponse.message ?? 'Die Zahlungsmöglichkeiten konnten nicht gespeichert werden.')
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await request('/api/v1/event/details/' + props.event.id + '/participation-fees', {
|
||||
method: "POST",
|
||||
body: {
|
||||
@@ -286,10 +347,81 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4" style="padding-top: 30px;">
|
||||
<h4>Zahlungsmöglichkeiten</h4>
|
||||
<div v-for="paymentMethod in availablePaymentMethods" :key="paymentMethod.slug"
|
||||
class="payment-method-row">
|
||||
<input type="checkbox" :id="'paymentmethod' + paymentMethod.id" :value="paymentMethod.slug"
|
||||
v-model="paymentMethods"/>
|
||||
<label style="padding-left: 5px;" :for="'paymentmethod' + paymentMethod.id">{{
|
||||
paymentMethod.name
|
||||
}}</label>
|
||||
<label
|
||||
v-if="paymentMethods.includes(paymentMethod.slug) && (paymentMethod.optionsSchema?.length ?? 0) > 0"
|
||||
class="link"
|
||||
style="padding-left: 15px; font-size: 10pt;"
|
||||
@click="openOptions(paymentMethod)"
|
||||
>Optionen</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4" style="padding-top: 20px;">
|
||||
<input type="button" value="Speichern" @click="saveParticipationFees" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<Modal
|
||||
v-if="showOptionsModal"
|
||||
:show="showOptionsModal"
|
||||
:title="'Optionen: ' + (optionsMethod?.name ?? '')"
|
||||
width="700px"
|
||||
@close="showOptionsModal = false"
|
||||
>
|
||||
<div v-for="option in optionsMethod?.optionsSchema ?? []" :key="option.name" class="payment-method-config-row">
|
||||
<label>{{ option.label }}<span v-if="option.required" class="required-marker">*</span></label>
|
||||
<RichSelectBox v-if="option.type === 'icon'"
|
||||
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
|
||||
:options="PAYMENT_METHOD_ICONS"
|
||||
placeholder="Symbol wählen…"/>
|
||||
<TextEditor v-else-if="option.type === 'richtext'"
|
||||
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"/>
|
||||
<input v-else type="text"
|
||||
v-model="paymentMethodConfigurations[optionsMethod.slug][option.name]"
|
||||
class="width-full"/>
|
||||
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
|
||||
</div>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.payment-method-row {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.payment-method-config-row {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.payment-method-config-row label {
|
||||
display: block;
|
||||
font-size: 0.85rem;
|
||||
color: #374151;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.required-marker {
|
||||
color: #ef4444;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.option-hint {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
font-size: 0.8rem;
|
||||
color: #6b7280;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { useSignupForm } from './composables/useSignupForm.js'
|
||||
import {useSignupForm} from './composables/useSignupForm.js'
|
||||
import StepAge from './steps/StepAge.vue'
|
||||
import StepContactPerson from './steps/StepContactPerson.vue'
|
||||
import StepPersonalData from './steps/StepPersonalData.vue'
|
||||
@@ -8,6 +8,7 @@ import StepArrival from './steps/StepArrival.vue'
|
||||
import StepAddons from './steps/StepAddons.vue'
|
||||
import StepPhotoPermissions from './steps/StepPhotoPermissions.vue'
|
||||
import StepAllergies from './steps/StepAllergies.vue'
|
||||
import StepPaymentMethod from './steps/StepPaymentMethod.vue'
|
||||
import StepSummary from './steps/StepSummary.vue'
|
||||
import SubmitSuccess from './after-submit/SubmitSuccess.vue'
|
||||
import SubmitAlreadyExists from './after-submit/SubmitAlreadyExists.vue'
|
||||
@@ -22,7 +23,7 @@ const emit = defineEmits(['registrationDone'])
|
||||
|
||||
const {
|
||||
currentStep, goToStep, formData, selectedAddons,
|
||||
submit, submitting, submitResult, summaryLoading, summaryAmount
|
||||
submit, submitting, submitResult, summaryLoading, summaryAmount, summaryAmountValue
|
||||
} = useSignupForm(props.event, props.participantData)
|
||||
|
||||
const steps = [
|
||||
@@ -34,7 +35,8 @@ const steps = [
|
||||
{ step: 6, label: 'Zusatzoptionen' },
|
||||
{ step: 7, label: 'Fotoerlaubnis' },
|
||||
{ step: 8, label: 'Allergien' },
|
||||
{ step: 9, label: 'Zusammenfassung' },
|
||||
{step: 9, label: 'Zahlungsart'},
|
||||
{step: 10, label: 'Zusammenfassung'},
|
||||
]
|
||||
</script>
|
||||
|
||||
@@ -93,11 +95,14 @@ const steps = [
|
||||
<StepAddons v-if="currentStep === 6" :formData="formData" :event="event" :selectedAddons="selectedAddons" @next="goToStep" @back="goToStep" />
|
||||
<StepPhotoPermissions v-if="currentStep === 7" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
||||
<StepAllergies v-if="currentStep === 8" :formData="formData" :event="event" @next="goToStep" @back="goToStep" />
|
||||
<StepPaymentMethod v-if="currentStep === 9" :formData="formData" :event="event" @next="goToStep"
|
||||
@back="goToStep"/>
|
||||
<StepSummary
|
||||
v-if="currentStep === 9"
|
||||
v-if="currentStep === 10"
|
||||
:formData="formData"
|
||||
:event="event"
|
||||
:summaryAmount="summaryAmount"
|
||||
:summaryAmountValue="summaryAmountValue"
|
||||
:summaryLoading="summaryLoading"
|
||||
:submitting="submitting"
|
||||
@back="goToStep"
|
||||
|
||||
@@ -26,31 +26,10 @@ const props = defineProps({
|
||||
Du hast noch kein erweitertes Führungszeugnis hinterlegt. Bitte reiche es umgehend ein.
|
||||
</div>
|
||||
|
||||
<template v-if="props.participant.needs_payment">
|
||||
<table class="form-table" style="margin-bottom: 16px;">
|
||||
<tr>
|
||||
<td>Kontoinhaber:</td><td>{{ props.event.accountOwner }}</td>
|
||||
<td rowspan="4" style="vertical-align: top; padding-left: 20px;" v-if="props.participant.identifier !== ''">
|
||||
<img :src="'/print-girocode/' + props.participant.identifier" alt="GiroCode" style="max-width: 180px;" />
|
||||
<span style="width: 180px; text-align: center; display: block; font-size: 0.8rem; color: #6b7280; margin-top: 4px;">Giro-Code</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>IBAN:</td><td>{{ props.event.accountIban }}</td></tr>
|
||||
<tr><td>Verwendungszweck:</td><td>{{ props.participant.payment_purpose }}</td></tr>
|
||||
<tr><td>Betrag:</td><td><strong>{{ props.participant.amount_left_string }}</strong></td></tr>
|
||||
<tr><td> </td><td>
|
||||
<a class="link" :href="`/api/v1/event/participant/${props.participant.identifier}/ical-payment`">Erinnerung in Kalender setzen</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
Bitte beachte, dass deine Anmeldung erst nach Zahlungseiongang vollständig ist.<br />
|
||||
Wenn dieser nicht bis zum {{ props.event.registrationFinalEnd.formatted }} erfolgt, kann deine Anmeldung storniert werden.<br /><br />
|
||||
Solltest du den Beitrag bis zu diesem Datum nicht oder nur teilweise überweisen können, kontaktiere bitte die Aktionsleitung, damit wir eine gemeinsame Lösiung finden können.
|
||||
</p>
|
||||
|
||||
|
||||
</template>
|
||||
<!-- Zahlungs-Block kommt vollständig aus dem Zahlungsmodul (registrationSummary -> html). -->
|
||||
<div v-if="props.participant.paymentSummary?.hasPaymentInformation"
|
||||
v-html="props.participant.paymentSummary.html"
|
||||
style="margin-bottom: 16px;"></div>
|
||||
<p v-else>
|
||||
Du musst keinen Beitrag überweisen. Deine Anmeldung ist bestätigt.
|
||||
</p>
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<script setup>
|
||||
import TextEditor from "../../../../../../Views/Components/TextEditor.vue";
|
||||
|
||||
// Generische, schema-getriebene Eingabefelder eines Zahlungsmoduls. Wiederverwendbar für künftige
|
||||
// Verfahren (SEPA, PayPal): das jeweilige Modul liefert das Schema, hier wird nur gerendert.
|
||||
const props = defineProps({
|
||||
// [{ name, label, type, required }] -- z.B. aus participantOptionsSchema einer Zahlungsmethode.
|
||||
schema: {type: Array, default: () => []},
|
||||
// v-model: Objekt { optionName: value }
|
||||
modelValue: {type: Object, default: () => ({})},
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
function setValue(name, value) {
|
||||
emit('update:modelValue', {...props.modelValue, [name]: value})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<table class="form-table">
|
||||
<tr v-for="option in schema" :key="option.name">
|
||||
<td>
|
||||
{{ option.label }}<span v-if="option.required" class="required-marker">*</span>:
|
||||
</td>
|
||||
<td>
|
||||
<TextEditor
|
||||
v-if="option.type === 'richtext'"
|
||||
:modelValue="modelValue[option.name] ?? ''"
|
||||
@update:modelValue="value => setValue(option.name, value)"
|
||||
/>
|
||||
<input
|
||||
v-else-if="option.type === 'checkbox'"
|
||||
type="checkbox"
|
||||
:checked="modelValue[option.name] ?? false"
|
||||
@change="event => setValue(option.name, event.target.checked)"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
type="text"
|
||||
:value="modelValue[option.name] ?? ''"
|
||||
@input="event => setValue(option.name, event.target.value)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.required-marker {
|
||||
color: #ef4444;
|
||||
margin-left: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import {reactive, ref} from 'vue'
|
||||
import axios from 'axios'
|
||||
|
||||
export function useSignupForm(event, participantData) {
|
||||
@@ -9,8 +9,13 @@ export function useSignupForm(event, participantData) {
|
||||
|
||||
const selectedAddons = reactive({})
|
||||
|
||||
// Für die Aktion freigeschaltete Zahlungsmethoden; ist genau eine aktiv, wird sie vorausgewählt.
|
||||
const activeMethods = (event.paymentMethods ?? []).filter(m => m.active)
|
||||
|
||||
const formData = reactive({
|
||||
eatingHabit: 'EATING_HABIT_VEGAN',
|
||||
paymentMethod: activeMethods.length === 1 ? activeMethods[0].slug : null,
|
||||
paymentOptions: {},
|
||||
userId: participantData.id,
|
||||
eventId: event.id,
|
||||
vorname: participantData.firstname ?? '',
|
||||
@@ -51,11 +56,10 @@ export function useSignupForm(event, participantData) {
|
||||
})
|
||||
|
||||
const summaryAmount = ref('')
|
||||
const summaryAmountValue = ref(0)
|
||||
|
||||
const goToStep = async (step) => {
|
||||
if (step === 9) {
|
||||
const fetchAmount = async () => {
|
||||
summaryLoading.value = true
|
||||
summaryAmount.value = ''
|
||||
try {
|
||||
const res = await axios.post('/api/v1/event/' + event.id + '/calculate-amount', {
|
||||
arrival: formData.arrival,
|
||||
@@ -69,15 +73,35 @@ export function useSignupForm(event, participantData) {
|
||||
sibling: formData.sibling,
|
||||
})
|
||||
summaryAmount.value = res.data.amount
|
||||
summaryAmountValue.value = Number(res.data.amountValue ?? 0)
|
||||
} finally {
|
||||
summaryLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Steps: ... 8 Allergien, 9 Zahlungsart, 10 Zusammenfassung.
|
||||
const STEP_PAYMENT = 9
|
||||
const STEP_SUMMARY = 10
|
||||
|
||||
const goToStep = async (step) => {
|
||||
if (step === STEP_PAYMENT) {
|
||||
// Betrag ermitteln: Bei 0 € wird die Zahlungsart-Auswahl übersprungen.
|
||||
await fetchAmount()
|
||||
if (summaryAmountValue.value <= 0) {
|
||||
formData.paymentMethod = null
|
||||
formData.paymentOptions = {}
|
||||
currentStep.value = STEP_SUMMARY
|
||||
return
|
||||
}
|
||||
} else if (step === STEP_SUMMARY) {
|
||||
await fetchAmount()
|
||||
}
|
||||
currentStep.value = step
|
||||
}
|
||||
|
||||
const submit = async () => {
|
||||
if (!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted || !formData.payment) {
|
||||
// Zahlungs-Bestätigung wird im Summary-Schritt kontextabhängig erzwungen (nur bei Überweisung).
|
||||
if (!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted) {
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
@@ -95,5 +119,16 @@ export function useSignupForm(event, participantData) {
|
||||
}
|
||||
}
|
||||
|
||||
return { currentStep, goToStep, formData, selectedAddons, submit, submitting, submitResult, summaryLoading, summaryAmount }
|
||||
return {
|
||||
currentStep,
|
||||
goToStep,
|
||||
formData,
|
||||
selectedAddons,
|
||||
submit,
|
||||
submitting,
|
||||
submitResult,
|
||||
summaryLoading,
|
||||
summaryAmount,
|
||||
summaryAmountValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
<script setup>
|
||||
import {computed} from "vue";
|
||||
import PaymentMethodInputs from "../components/PaymentMethodInputs.vue";
|
||||
import Icon from "../../../../../../Views/Components/Icon.vue";
|
||||
|
||||
const props = defineProps({formData: Object, event: Object})
|
||||
const emit = defineEmits(['next', 'back'])
|
||||
|
||||
// Für die Aktion freigeschaltete Zahlungsmethoden.
|
||||
const methods = computed(() => (props.event.paymentMethods ?? []).filter(m => m.active))
|
||||
|
||||
const selectedMethod = computed(() =>
|
||||
methods.value.find(m => m.slug === props.formData.paymentMethod) ?? null
|
||||
)
|
||||
|
||||
const participantSchema = computed(() => selectedMethod.value?.participantOptionsSchema ?? [])
|
||||
|
||||
// Font-Awesome-Icon je Zahlungsart: konfiguriertes Symbol hat Vorrang, sonst Slug-Default
|
||||
// (Fallback: generische Karte).
|
||||
function iconFor(method) {
|
||||
const configured = method.configuration?.icon
|
||||
if (configured) return configured
|
||||
if (method.slug === 'PAYMENT_ACCOUNT_TRANSACTION') return 'building-columns'
|
||||
if (method.slug === 'PAYMENT_NOT_DEFINED') return 'money-bill-wave'
|
||||
return 'credit-card'
|
||||
}
|
||||
|
||||
function selectMethod(slug) {
|
||||
props.formData.paymentMethod = slug
|
||||
// Eingaben zurücksetzen -- pro Methode eigene Felder.
|
||||
props.formData.paymentOptions = {}
|
||||
}
|
||||
|
||||
// "Weiter" ist erst möglich, wenn eine Methode gewählt und alle Pflicht-Eingaben befüllt sind.
|
||||
const canProceed = computed(() => {
|
||||
if (!props.formData.paymentMethod) return false
|
||||
return participantSchema.value
|
||||
.filter(o => o.required)
|
||||
.every(o => {
|
||||
const value = props.formData.paymentOptions[o.name]
|
||||
return value !== undefined && value !== null && String(value).trim() !== ''
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h3 style="margin: 0 0 6px 0; color: #111827;">Zahlungsweise</h3>
|
||||
<p style="margin: 0 0 24px 0; color: #6b7280; font-size: 0.95rem;">Bitte wähle, wie du deinen Teilnahmebeitrag
|
||||
begleichen möchtest.</p>
|
||||
|
||||
<div class="pay-card-row">
|
||||
<div
|
||||
v-for="method in methods"
|
||||
:key="method.slug"
|
||||
class="pay-card"
|
||||
:class="{ 'pay-card--active': formData.paymentMethod === method.slug }"
|
||||
role="radio"
|
||||
:aria-checked="formData.paymentMethod === method.slug"
|
||||
tabindex="0"
|
||||
@click="selectMethod(method.slug)"
|
||||
@keydown.enter.prevent="selectMethod(method.slug)"
|
||||
@keydown.space.prevent="selectMethod(method.slug)"
|
||||
>
|
||||
<div class="pay-card__badge">
|
||||
<Icon :name="iconFor(method)"/>
|
||||
</div>
|
||||
<div class="pay-card__body">
|
||||
<h4 class="pay-card__title">{{ method.name }}</h4>
|
||||
<p v-if="method.description" class="pay-card__desc">{{ method.description }}</p>
|
||||
</div>
|
||||
<div class="pay-card__check" aria-hidden="true">✓</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="participantSchema.length > 0" class="pay-inputs">
|
||||
<PaymentMethodInputs :schema="participantSchema" v-model="formData.paymentOptions"/>
|
||||
</div>
|
||||
|
||||
<div class="btn-row">
|
||||
<button type="button" class="btn-secondary" @click="emit('back', 8)">← Zurück</button>
|
||||
<button type="button" class="btn-primary" :disabled="!canProceed" @click="emit('next', 10)">Weiter →
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.pay-card-row {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.pay-card {
|
||||
position: relative;
|
||||
flex: 1 1 280px;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: #f8fafc;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 12px;
|
||||
padding: 28px 20px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pay-card:hover {
|
||||
border-color: #2563eb;
|
||||
box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.pay-card--active {
|
||||
border-color: #2563eb;
|
||||
background: #eff6ff;
|
||||
box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
|
||||
}
|
||||
|
||||
.pay-card__badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin-bottom: 14px;
|
||||
font-size: 1.6rem;
|
||||
color: #2563eb;
|
||||
background: #e0f2fe;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pay-card--active .pay-card__badge {
|
||||
background: #dbeafe;
|
||||
}
|
||||
|
||||
.pay-card__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.pay-card__title {
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.pay-card__desc {
|
||||
margin: 0;
|
||||
font-size: 0.9rem;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.pay-card__check {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: #2563eb;
|
||||
color: #fff;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
opacity: 0;
|
||||
transform: scale(0.6);
|
||||
transition: opacity 0.12s, transform 0.12s;
|
||||
}
|
||||
|
||||
.pay-card--active .pay-card__check {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.pay-inputs {
|
||||
margin-top: 20px;
|
||||
padding: 16px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* ─── Smartphone ─── */
|
||||
@media (max-width: 639px) {
|
||||
.pay-card-row {
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pay-card {
|
||||
flex: 1 1 100%;
|
||||
flex-direction: row;
|
||||
text-align: left;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 16px 14px;
|
||||
}
|
||||
|
||||
.pay-card__badge {
|
||||
flex: 0 0 52px;
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
margin-bottom: 0;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.pay-card__body {
|
||||
flex: 1;
|
||||
align-items: flex-start;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.pay-card__title {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,15 +1,48 @@
|
||||
<script setup>
|
||||
import {computed} from "vue";
|
||||
import {format, parseISO} from "date-fns";
|
||||
|
||||
const PAYMENT_ACCOUNT_TRANSACTION = 'PAYMENT_ACCOUNT_TRANSACTION'
|
||||
|
||||
const props = defineProps({
|
||||
formData: Object,
|
||||
event: Object,
|
||||
summaryAmount: String,
|
||||
summaryAmountValue: {type: Number, default: 0},
|
||||
summaryLoading: Boolean,
|
||||
submitting: Boolean,
|
||||
})
|
||||
const emit = defineEmits(['back', 'submit'])
|
||||
|
||||
const selectedMethod = computed(() =>
|
||||
(props.event.paymentMethods ?? []).find(m => m.slug === props.formData.paymentMethod) ?? null
|
||||
)
|
||||
|
||||
// Die Überweisungs-Bestätigung wird nur bei Banküberweisung verlangt (AC #6).
|
||||
const requiresPaymentConfirmation = computed(() =>
|
||||
props.formData.paymentMethod === PAYMENT_ACCOUNT_TRANSACTION
|
||||
)
|
||||
|
||||
// Bestätigungstext ist ein admin-konfigurierbarer Freitext ({amount}-Platzhalter), sonst Default.
|
||||
const paymentConfirmationText = computed(() => {
|
||||
const configured = selectedMethod.value?.configuration?.summary_confirmation_text
|
||||
const template = (configured && String(configured).trim() !== '')
|
||||
? configured
|
||||
: 'Ich bestätige, den Betrag von {amount} zu überweisen.'
|
||||
return template.replaceAll('{amount}', props.summaryAmount ?? '')
|
||||
})
|
||||
|
||||
// Zurück führt zur Zahlungsart (9), sofern dieser Schritt gezeigt wurde; bei 0 € direkt zu Allergien (8).
|
||||
const backTarget = computed(() => props.summaryAmountValue > 0 ? 9 : 8)
|
||||
|
||||
const canSubmit = computed(() =>
|
||||
props.formData.summary_information_correct
|
||||
&& props.formData.summary_accept_terms
|
||||
&& props.formData.legal_accepted
|
||||
&& (!requiresPaymentConfirmation.value || props.formData.payment)
|
||||
&& !props.submitting
|
||||
)
|
||||
|
||||
function formatDate(dateString) {
|
||||
if (!dateString) return ''
|
||||
return format(parseISO(dateString), 'dd.MM.yyyy')
|
||||
@@ -129,18 +162,18 @@ function eatingHabit() {
|
||||
<input type="checkbox" v-model="formData.legal_accepted" />
|
||||
Ich stimme der Datenschutzerklärung zu.
|
||||
</label>
|
||||
<label style="display: flex; gap: 10px; cursor: pointer;">
|
||||
<label v-if="requiresPaymentConfirmation" style="display: flex; gap: 10px; cursor: pointer;">
|
||||
<input type="checkbox" v-model="formData.payment" />
|
||||
Ich bestätige, den Betrag von <strong>{{ summaryAmount }}</strong> zu überweisen.
|
||||
{{ paymentConfirmationText }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="btn-row">
|
||||
<button type="button" class="btn-secondary" @click="emit('back', 8)">← Zurück</button>
|
||||
<button type="button" class="btn-secondary" @click="emit('back', backTarget)">← Zurück</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn-primary"
|
||||
:disabled="!formData.summary_information_correct || !formData.summary_accept_terms || !formData.legal_accepted || !formData.payment || submitting"
|
||||
:disabled="!canSubmit"
|
||||
style="background: #059669;"
|
||||
>
|
||||
{{ submitting ? 'Wird gesendet…' : 'Jetzt anmelden ✓' }}
|
||||
|
||||
@@ -99,10 +99,14 @@ function close() {
|
||||
|
||||
<div class="signup-body">
|
||||
<SignupForm
|
||||
v-if="props.event.registrationAllowed"
|
||||
:event="props.event"
|
||||
:participantData="props.participantData ?? {}"
|
||||
:localGroups="props.localGroups ?? []"
|
||||
/>
|
||||
<p v-else class="signup-closed-notice">
|
||||
Die Anmeldung für diese Veranstaltung ist geschlossen.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</shadowed-box>
|
||||
@@ -220,6 +224,14 @@ function close() {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.signup-closed-notice {
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
color: #991b1b;
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* ─── Tablet (640–1023px) ─── */
|
||||
@media (max-width: 1023px) {
|
||||
.signup-box {
|
||||
|
||||
@@ -65,7 +65,7 @@ class EditController extends CommonController{
|
||||
$currentEvents = $this->costUnits->getCostUnitsForNewInvoice(CostUnitType::COST_UNIT_TYPE_EVENT);
|
||||
|
||||
return response()->json([
|
||||
'invoice' => new InvoiceResource($invoice)->toArray(),
|
||||
'invoice' => new InvoiceResource($newInvoice)->toArray(),
|
||||
'status' => 'success',
|
||||
'costUnits' => array_merge($runningJobs, $currentEvents),
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enumerations;
|
||||
|
||||
use App\Scopes\CommonModel;
|
||||
|
||||
/**
|
||||
* Lebenszyklus-Status einer Zahlung -- DB-gestützt, analog zu {@see InvoiceStatus}.
|
||||
* Reine Steuersignale (z.B. Redirect) gehören NICHT hierher, sondern bleiben transiente
|
||||
* Felder auf {@see \App\EventPaymentModules\DTO\DoPaymentResponse}.
|
||||
*/
|
||||
class PaymentStatus extends CommonModel
|
||||
{
|
||||
public const PAYMENT_STATUS_PENDING = 'pending';
|
||||
public const PAYMENT_STATUS_SCHEDULED = 'scheduled';
|
||||
public const PAYMENT_STATUS_PAID = 'paid';
|
||||
public const PAYMENT_STATUS_FAILED = 'failed';
|
||||
|
||||
protected $table = 'payment_status';
|
||||
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules;
|
||||
|
||||
use App\Enumerations\PaymentStatus;
|
||||
use App\EventPaymentModules\DTO\CreateInvoiceRequest;
|
||||
use App\EventPaymentModules\DTO\CreateInvoiceResponse;
|
||||
use App\EventPaymentModules\DTO\DoPaymentRequest;
|
||||
use App\EventPaymentModules\DTO\DoPaymentResponse;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
||||
|
||||
/**
|
||||
* Gemeinsame Basis aller Zahlungsmodule. Hält den geteilten Code und die aus {@see getOptions()}
|
||||
* abgeleiteten Options-Helfer; konkrete Module definieren nur ihre Identität, ihr Options-Schema
|
||||
* und -- später -- die je Zahlungsart variierenden Teile (z.B. den Rechnungs-Schlusssatz).
|
||||
*/
|
||||
abstract class AbstractEventPaymentModule implements EventPaymentModule
|
||||
{
|
||||
public function defaultDescription(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard-Konfiguration beim Anlegen der Tenant-Instanz. Standard: leer.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function defaultConfiguration(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Payer-seitige Eingaben, die eine Zahlungsart vom Teilnehmer benötigt (z.B. später SEPA-IBAN,
|
||||
* PayPal-Mail). Standard: keine. Gleiche Form wie getOptions(): [{name,label,type,required}].
|
||||
*
|
||||
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||
*/
|
||||
public function getParticipantOptions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// Aus dem jeweiligen Schema abgeleitete Helfer (Admin-Config = getOptions(),
|
||||
// Teilnehmer-Eingaben = getParticipantOptions()).
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
||||
/** @return array<int, string> */
|
||||
public function requiredOptionKeys(): array
|
||||
{
|
||||
return $this->requiredKeys($this->getOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $config
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function sanitizeConfiguration(array $config): array
|
||||
{
|
||||
return $this->sanitizeAgainst($this->getOptions(), $config);
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $config */
|
||||
public function isConfigurationComplete(array $config): bool
|
||||
{
|
||||
return $this->allRequiredFilled($this->getOptions(), $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $input
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function sanitizeParticipantOptions(array $input): array
|
||||
{
|
||||
return $this->sanitizeAgainst($this->getParticipantOptions(), $input);
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $input */
|
||||
public function participantOptionsComplete(array $input): bool
|
||||
{
|
||||
return $this->allRequiredFilled($this->getParticipantOptions(), $input);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, array{name: string, required?: bool}> $schema
|
||||
* @return array<int, string>
|
||||
*/
|
||||
private function requiredKeys(array $schema): array
|
||||
{
|
||||
return array_values(array_map(
|
||||
static fn (array $option) => $option['name'],
|
||||
array_filter($schema, static fn(array $option) => $option['required'] ?? false)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduziert Eingaben auf die im Schema definierten Keys (unbekannte werden verworfen).
|
||||
*
|
||||
* @param array<int, array{name: string}> $schema
|
||||
* @param array<string, mixed> $input
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function sanitizeAgainst(array $schema, array $input): array
|
||||
{
|
||||
$result = [];
|
||||
foreach ($schema as $option) {
|
||||
if (array_key_exists($option['name'], $input)) {
|
||||
$result[$option['name']] = $input[$option['name']];
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sind alle Pflichtfelder des Schemas befüllt (non-empty)?
|
||||
*
|
||||
* @param array<int, array{name: string, required?: bool}> $schema
|
||||
* @param array<string, mixed> $input
|
||||
*/
|
||||
private function allRequiredFilled(array $schema, array $input): bool
|
||||
{
|
||||
foreach ($this->requiredKeys($schema) as $key) {
|
||||
$value = $input[$key] ?? null;
|
||||
if ($value === null || $value === '' || $value === []) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// Operative Methoden -- in dieser Iteration bewusst als Stubs.
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
||||
public function registrationSummary(RegistrationSummaryRequest $request): RegistrationSummaryResponse
|
||||
{
|
||||
// TODO: In einer Folge-Iteration ausformulieren (zahlungsspezifischer Teil der Zusammenfassung).
|
||||
return new RegistrationSummaryResponse();
|
||||
}
|
||||
|
||||
public function doPayment(DoPaymentRequest $request): DoPaymentResponse
|
||||
{
|
||||
// TODO: In einer Folge-Iteration ausformulieren. Default: nichts aktiv anzustoßen (Status offen).
|
||||
$response = new DoPaymentResponse();
|
||||
$response->success = true;
|
||||
$response->status = PaymentStatus::PAYMENT_STATUS_PENDING;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template-Method: Der gemeinsame Rechnungs-Rumpf wird hier gebaut, der variierende Schlusssatz
|
||||
* kommt aus {@see invoiceClosingStatement()} des jeweiligen Moduls.
|
||||
*/
|
||||
public function createInvoice(CreateInvoiceRequest $request): CreateInvoiceResponse
|
||||
{
|
||||
$response = new CreateInvoiceResponse();
|
||||
// TODO: In einer Folge-Iteration den gemeinsamen Rumpf (Betrag, Leistung, Teilnehmerdaten) befüllen
|
||||
// und an die Invoice-Domain anbinden.
|
||||
$response->success = true;
|
||||
$response->closingStatement = $this->invoiceClosingStatement($request);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Der je Zahlungsart variierende Schlusssatz der Rechnung
|
||||
* ("Bitte überweise bis ..." / "wird abgebucht ..." / "wurde per PayPal beglichen").
|
||||
*/
|
||||
abstract protected function invoiceClosingStatement(CreateInvoiceRequest $request): string;
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
# Zahlungsmodule (`app/EventPaymentModules`)
|
||||
|
||||
Interface-gesteuerte Strategie-Schicht: Das Verhalten je Zahlungsart (Optionen, Anmelde-Zusammenfassung, Zahlung,
|
||||
Rechnung) liegt gekapselt in einem Modul pro Zahlungsart. Aufgelöst wird über den Slug.
|
||||
|
||||
## Aufbau
|
||||
|
||||
- `EventPaymentModule` — **Core-Interface**. Hält nur das, was **jede** Zahlungsart hat:
|
||||
`slug()`, `defaultName()/defaultDescription()`, `getOptions()`, `registrationSummary()`, `doPayment()`,
|
||||
`createInvoice()`.
|
||||
- `AbstractEventPaymentModule` — Basisklasse (Template-Method). Liefert die aus `getOptions()` abgeleiteten Helfer
|
||||
(`requiredOptionKeys()`, `sanitizeConfiguration()`, `isConfigurationComplete()`) und sinnvolle Default-/Stub-Bodies.
|
||||
- `Modules/` — konkrete Module (flach, eine Klasse je Zahlungsart):
|
||||
`AccountTransferPaymentModule` (Überweisung), `UndefinedPaymentModule` (Barzahlung/Sonstiges).
|
||||
- `DTO/` — geteilte Request/Response-DTOs je Operation (`DoPayment*`, `CreateInvoice*`, `RegistrationSummary*`).
|
||||
- `EventPaymentModuleRegistry` — statische Map `slug → Modul-Instanz` (`forSlug()`, `all()`, `slugs()`). **Neue Module
|
||||
hier eintragen.** Kein Container-Binding.
|
||||
- `ProvidesGiroCode` — **Fähigkeits-Interface** (siehe unten).
|
||||
|
||||
## Kernregeln
|
||||
|
||||
- **Zwei getrennte Options-Schemata (beide im Code, gleiche Form `['name','label','type','required']`):**
|
||||
- `getOptions()` = **Admin-Config** (was der/die Veranstalter\*in pflegt, z.B. Empfänger-Konto). Werte in der DB
|
||||
(`configuration`, s.u.).
|
||||
- `getParticipantOptions()` = **Teilnehmer-Eingaben** beim Anmelden (payer-seitig, z.B. künftig
|
||||
SEPA-IBAN/PayPal-Mail; beide Bestandsmodule: `[]`). Werte in `event_participants.payment_options` (JSON).
|
||||
Abgesichert über
|
||||
`sanitizeParticipantOptions()` / `participantOptionsComplete()` (Guard im `SignUpCommand`).
|
||||
- `type` ist i.d.R. `'string'`; `'richtext'` wird über `Views/Components/TextEditor.vue` (TinyMCE, HTML) gerendert
|
||||
und via `v-html`/`{!! !!}` ausgegeben; `'icon'` rendert die `Views/Components/RichSelectBox.vue` (kuratierte
|
||||
FA-Symbol-Auswahl, Liste in `resources/js/constants/paymentMethodIcons.js`). Teilnehmer-Eingaben rendert die
|
||||
generische `SignUpForm/components/PaymentMethodInputs.vue` schema-getrieben.
|
||||
- Optionaler Schlüssel `'hint'` je Option: erklärender Hilfetext, den die Admin-Render-Stellen unter dem Feld anzeigen
|
||||
(z.B. bei `payment_information`, dass der Text am Anmeldeende + in der Mail erscheint).
|
||||
- `defaultConfiguration()` je Modul liefert die Start-Config beim Anlegen der Tenant-Instanz (`CreateTenantAction`),
|
||||
aktuell das Default-Symbol (`icon`): Überweisung `building-columns`, Sonstiges `coins`.
|
||||
- **Aktivierungs-Guard:** Eine Tenant-Zahlungsmethode darf nur `active` werden, wenn alle `required`-Optionen befüllt
|
||||
sind (`isConfigurationComplete()`), erzwungen in `UpdateAvailablePaymentMethodAction`.
|
||||
- **Config-Speicherung (JSON):** pro Tenant auf `available_payment_methods.configuration`, pro Event auf dem Pivot
|
||||
`event_payment_methods.configuration`. Beim Zuweisen an ein Event wird die Tenant-Config als **Snapshot kopiert**
|
||||
(Copy-on-Assign, spätere Tenant-Änderungen wirken NICHT nach). Sync erfolgt differenziell in
|
||||
`SetPaymentMethodsCommand` (Endpoint `/api/v1/event/details/{event}/payment-methods`, ausgelöst aus dem
|
||||
„Teilnahmegebühren"-Bereich).
|
||||
- **`PaymentMethod` ist nur eine Fassade:** `PaymentMethod::optionsFor/participantOptionsFor/requiredOptionKeys/`
|
||||
`sanitizeConfiguration/isConfigurationComplete/defaults()` delegieren an die Registry. Bestehende Aufrufstellen
|
||||
bleiben stabil.
|
||||
- **Zahlungsauswahl im Anmeldeprozess:** Nach „Allergien" wählt der/die Teilnehmer\*in aus den **aktiven**
|
||||
Event-Methoden (`StepPaymentMethod.vue`); bei Beitrag 0 € wird der Schritt übersprungen. Die Wahl landet in
|
||||
`event_participants.payment_method`, die Eingaben in `payment_options`. Der Überweisungs-Bestätigungstext in der
|
||||
Zusammenfassung ist eine Admin-Config-Option `summary_confirmation_text` (`{amount}`-Platzhalter) und erscheint nur
|
||||
bei
|
||||
`PAYMENT_ACCOUNT_TRANSACTION`.
|
||||
- **`PaymentStatus`** ist ein DB-gestütztes Enumerations-Model (`app/Enumerations/PaymentStatus.php`, Tabelle
|
||||
`payment_status`, geseedet in `ProductionDataSeeder`), analog zu `InvoiceStatus`. Reine Steuersignale (z.B. Redirect)
|
||||
gehören NICHT ins Status-Vokabular, sondern als transiente Felder aufs Response-DTO.
|
||||
- `doPayment()` und `createInvoice()` sind aktuell **Stubs** (nur Struktur/DTOs vorhanden). `createInvoice()` ist als
|
||||
Template-Method angelegt: gemeinsamer Rumpf in der Basis, `invoiceClosingStatement()` je Modul.
|
||||
|
||||
## Zahlart-spezifisches Verhalten → Fähigkeits-Interfaces (Interface Segregation)
|
||||
|
||||
Verhalten, das **nur eine** Zahlungsart hat, gehört **nicht** auf `EventPaymentModule` und **nicht** auf das generische
|
||||
`EventParticipant`-Model, sondern in ein schmales Fähigkeits-Interface, das nur das betreffende Modul implementiert.
|
||||
Aufrufer prüfen per `instanceof`.
|
||||
|
||||
Beispiel GiroCode (nur Überweisung):
|
||||
|
||||
- `ProvidesGiroCode::giroCode(EventParticipant, array $configuration): ?string` — implementiert **nur** von
|
||||
`AccountTransferPaymentModule`.
|
||||
- Aufrufer (`GiroCodeGetController`, `EventSignUpSuccessfullMail`, `ParticipantPaymentMissingPaymentMail`) lösen inline
|
||||
auf:
|
||||
```php
|
||||
$module = $participant->paymentModule();
|
||||
$binary = $module instanceof ProvidesGiroCode
|
||||
? $module->giroCode($participant, $participant->paymentConfiguration())
|
||||
: null;
|
||||
```
|
||||
- Künftige Verfahren würden analog eigene Fähigkeiten mitbringen (z.B. `ProvidesRedirect` für PayPal,
|
||||
`ProvidesMandate` für SEPA-Lastschrift) — **erst modellieren, wenn tatsächlich gebraucht.**
|
||||
|
||||
## Anmelde-Zusammenfassung / Mail-Anzeige
|
||||
|
||||
- `registrationSummary(RegistrationSummaryRequest): RegistrationSummaryResponse` liefert den zahlungsspezifischen
|
||||
Anzeige-Block **fertig als HTML** (`hasPaymentInformation` + `html`). Jedes Modul rendert seinen Block über
|
||||
eigene Blade-Templates unter `resources/views/payment-modules/{modul}/{web,mail}.blade.php` (Überweisung:
|
||||
`account-transfer/`, Barzahlung: `undefined/` — Rahmen um den konfigurierten richtext). Die Render-Stellen geben
|
||||
nur noch `v-html` / `{!! !!}` aus — **keine** zahlart-spezifische Logik im Frontend/Blade.
|
||||
- **Render-Kontext:** `RegistrationSummaryRequest` trägt einen `RegistrationRenderContext` (`Web`/`Mail`). Das Modul
|
||||
wählt darüber (a) ein **medien-gerechtes Template** — `resources/views/payment-modules/{modul}/{web,mail}.blade.php`
|
||||
(Web: SPA-Klassen `form-table`/`link`; Mail: E-Mail-taugliche Inline-Styles) und (b) die GiroCode-Bildquelle —
|
||||
Web: `/print-girocode/{token}` (sessionlos, lazy), Mail: `cid:girocode.png` (inline via `$message->embedData(...)`,
|
||||
bereitgestellt im dünnen Wrapper `emails/subparts/payment.blade.php`).
|
||||
Hinweis: Das Web-Template darf globale (un-scoped) SPA-Klassen nutzen, da Vue-`scoped`-Styles nicht auf `v-html`
|
||||
greifen.
|
||||
- Zugang über das Teilnehmer-Model: `EventParticipant::paymentModule()`, `paymentConfiguration()` (eager-load-fähig über
|
||||
`->with('event.paymentMethods')`, kein statischer Cache), `paymentSummary(RegistrationRenderContext)`.
|
||||
- Konsumiert von `EventParticipantResource` (`paymentSummary` = `{hasPaymentInformation, html}`, Web-Kontext),
|
||||
`SubmitSuccess.vue`, den Mails (`EventSignUpSuccessfullMail`/`ParticipantPaymentMissingPaymentMail` rufen
|
||||
`paymentSummary(Mail)`), sowie `signup_complete`/`missing_amount` (nur umrahmende Prosa, gegated auf
|
||||
`hasPaymentInformation`).
|
||||
|
||||
## Neues Zahlungsmodul hinzufügen
|
||||
|
||||
1. Klasse unter `Modules/` anlegen, `extends AbstractEventPaymentModule`; `slug()`, `defaultName()`, `getOptions()`
|
||||
implementieren; `defaultConfiguration()` (z.B. Default-`icon`) sowie
|
||||
`registrationSummary()`/`doPayment()`/`createInvoice()` überschreiben, wo nötig.
|
||||
2. Zahlart-spezifische Extras als **eigenes Fähigkeits-Interface** (nicht ins Core-Interface).
|
||||
3. In `EventPaymentModuleRegistry::MODULES` eintragen. `PaymentMethod::create(['slug' => …])` wird dann automatisch über
|
||||
`ProductionDataSeeder` (iteriert `EventPaymentModuleRegistry::slugs()`) geseedet.
|
||||
4. Slug-Konstante bei Bedarf auf `PaymentMethod` ergänzen.
|
||||
|
||||
## Datenübernahme
|
||||
|
||||
`storage/app/2026_08_05_backfill_payment_method_configuration.sql` überführt einmalig Bestands-IBAN-Daten (Tenant/Event)
|
||||
**und** die Default-Symbole in die Modul-Config (idempotenter JSON-Merge, nichts wird überschrieben). Bei
|
||||
Live-Inbetriebnahme einmal gegen die Produktionsdatenbank ausführen — ersetzt das ältere PHP-Skript
|
||||
`sync_payment_bank_data.php`.
|
||||
|
||||
## Tests
|
||||
|
||||
`tests/Unit/PaymentMethodOptionsTest`, `tests/Unit/EventPaymentModuleRegistryTest`,
|
||||
`tests/Unit/RegistrationSummaryTest`, `tests/Feature/PaymentMethodConfigurationTest`,
|
||||
`tests/Feature/EventParticipantPaymentSummaryTest`. Ausführung im Container (PHP 8.5):
|
||||
`docker exec mareike-mareike-app-1 php artisan test`.
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\DTO;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\EventParticipant;
|
||||
use App\ValueObjects\Amount;
|
||||
|
||||
/**
|
||||
* Eingabe für {@see \App\EventPaymentModules\EventPaymentModule::createInvoice()}.
|
||||
* Von allen Modulen geteilt.
|
||||
*/
|
||||
final class CreateInvoiceRequest
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $configuration Aufgelöste (pro-Event-)Konfiguration des Moduls.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly Event $event,
|
||||
public readonly EventParticipant $participant,
|
||||
public readonly Amount $amount,
|
||||
public readonly array $configuration = [],
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\DTO;
|
||||
|
||||
/**
|
||||
* Ausgabe von {@see \App\EventPaymentModules\EventPaymentModule::createInvoice()}.
|
||||
*
|
||||
* Der gemeinsame Rechnungs-Rumpf (Betrag, Leistung, ...) wird von der Basisklasse befüllt,
|
||||
* $closingStatement ist der je Modul variierende Schlusssatz
|
||||
* ("Bitte überweise bis ..." / "wird abgebucht ..." / "wurde per PayPal beglichen").
|
||||
*/
|
||||
final class CreateInvoiceResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
|
||||
/** @var array<int, array<string, mixed>> Gemeinsame Rechnungspositionen (Rumpf). */
|
||||
public array $lines = [];
|
||||
|
||||
public ?string $closingStatement = null;
|
||||
public ?string $message = null;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\DTO;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\EventParticipant;
|
||||
use App\ValueObjects\Amount;
|
||||
|
||||
/**
|
||||
* Eingabe für {@see \App\EventPaymentModules\EventPaymentModule::doPayment()}.
|
||||
* Von allen Modulen geteilt.
|
||||
*/
|
||||
final class DoPaymentRequest
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $configuration Aufgelöste (pro-Event-)Konfiguration des Moduls.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly Event $event,
|
||||
public readonly EventParticipant $participant,
|
||||
public readonly Amount $amount,
|
||||
public readonly array $configuration = [],
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\DTO;
|
||||
|
||||
use App\Enumerations\PaymentStatus;
|
||||
|
||||
/**
|
||||
* Ausgabe von {@see \App\EventPaymentModules\EventPaymentModule::doPayment()}.
|
||||
* Von allen Modulen geteilt -- jedes Modul befüllt nur die für es relevanten Felder.
|
||||
*
|
||||
* $status ist ein Lebenszyklus-Status (PaymentStatus-Slug, DB-gestützt). Reine Steuersignale
|
||||
* wie ein Redirect bleiben transiente Felder (redirectUrl), nicht Teil des Status-Vokabulars.
|
||||
*/
|
||||
final class DoPaymentResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
public string $status = PaymentStatus::PAYMENT_STATUS_PENDING;
|
||||
public ?string $redirectUrl = null;
|
||||
public ?\DateTimeImmutable $scheduledFor = null;
|
||||
public ?string $reference = null;
|
||||
public ?string $message = null;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\DTO;
|
||||
|
||||
/**
|
||||
* Render-Kontext der Anmelde-Zusammenfassung. Steuert die kontextabhängige Einbettung des GiroCodes:
|
||||
* im Web über den Endpoint, in der Mail über eine inline-CID.
|
||||
*/
|
||||
enum RegistrationRenderContext
|
||||
{
|
||||
case Web;
|
||||
case Mail;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\DTO;
|
||||
|
||||
use App\Models\EventParticipant;
|
||||
|
||||
/**
|
||||
* Eingabe für {@see \App\EventPaymentModules\EventPaymentModule::registrationSummary()}.
|
||||
*
|
||||
* Anker ist der (bereits erstellte) Teilnehmer -- daraus leiten die Module Event, Betrag/Restbetrag
|
||||
* und Verwendungszweck ab. $configuration ist die aufgelöste pro-Event-Config des Zahlungsmoduls,
|
||||
* $context steuert die kontextabhängige Ausgabe (z.B. GiroCode-Einbettung Web vs. Mail).
|
||||
*/
|
||||
final class RegistrationSummaryRequest
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $configuration
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly EventParticipant $participant,
|
||||
public readonly array $configuration = [],
|
||||
public readonly RegistrationRenderContext $context = RegistrationRenderContext::Web,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\DTO;
|
||||
|
||||
/**
|
||||
* Ausgabe von {@see \App\EventPaymentModules\EventPaymentModule::registrationSummary()}.
|
||||
*
|
||||
* Das Modul erzeugt seinen Zahlungs-Block vollständig als HTML; die Render-Stellen (Anmeldeabschluss,
|
||||
* Mails) geben ihn nur noch per `v-html` / `{!! !!}` aus.
|
||||
*/
|
||||
final class RegistrationSummaryResponse
|
||||
{
|
||||
/** Gibt es überhaupt einen Zahlungs-Block darzustellen? */
|
||||
public bool $hasPaymentInformation = false;
|
||||
|
||||
/** Fertig gerenderter HTML-Block der Zahlungsinformationen. */
|
||||
public string $html = '';
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules;
|
||||
|
||||
use App\EventPaymentModules\DTO\CreateInvoiceRequest;
|
||||
use App\EventPaymentModules\DTO\CreateInvoiceResponse;
|
||||
use App\EventPaymentModules\DTO\DoPaymentRequest;
|
||||
use App\EventPaymentModules\DTO\DoPaymentResponse;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
||||
|
||||
/**
|
||||
* Vertrag eines Zahlungsmoduls. Jede Zahlungsart (Überweisung, künftig SEPA-Lastschrift, PayPal, ...)
|
||||
* kapselt ihr Verhalten in einer eigenen Implementierung. Aufgelöst wird ein Modul über seinen Slug
|
||||
* via {@see EventPaymentModuleRegistry}.
|
||||
*
|
||||
* Die operativen Methoden (doPayment/createInvoice/registrationSummary) arbeiten mit geteilten
|
||||
* Request/Response-DTOs -- das Modul stellt die polymorphe "Command"-Logik; schwere Arbeit
|
||||
* (PayPal-API, SEPA-XML) wird später an reguläre Domain-Actions delegiert.
|
||||
*/
|
||||
interface EventPaymentModule
|
||||
{
|
||||
/** Eindeutiger Slug der Zahlungsart (entspricht payment_methods.slug). */
|
||||
public static function slug(): string;
|
||||
|
||||
/** Standard-Anzeigename beim Anlegen der Tenant-Instanz. */
|
||||
public function defaultName(): string;
|
||||
|
||||
/** Standard-Beschreibung beim Anlegen der Tenant-Instanz. */
|
||||
public function defaultDescription(): ?string;
|
||||
|
||||
/**
|
||||
* Standard-Konfiguration beim Anlegen der Tenant-Instanz (z.B. Default-Symbol). Standard: leer.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function defaultConfiguration(): array;
|
||||
|
||||
/**
|
||||
* Admin-Options-Schema dieses Moduls (welche Konfigurationsfelder der/die Veranstalter\*in pflegt).
|
||||
*
|
||||
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||
*/
|
||||
public function getOptions(): array;
|
||||
|
||||
/**
|
||||
* Teilnehmer-Eingaben, die diese Zahlungsart beim Anmelden abfragt (payer-seitig; Standard: keine).
|
||||
*
|
||||
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||
*/
|
||||
public function getParticipantOptions(): array;
|
||||
|
||||
/**
|
||||
* Liefert den zahlungsspezifischen Teil der Anmelde-Zusammenfassung.
|
||||
* (In dieser Iteration nur als Stub vorhanden.)
|
||||
*/
|
||||
public function registrationSummary(RegistrationSummaryRequest $request): RegistrationSummaryResponse;
|
||||
|
||||
/**
|
||||
* Stößt die Zahlung an (bzw. beschreibt, was zu tun ist -- z.B. Redirect, Lastschrift, manuelle Überweisung).
|
||||
* (In dieser Iteration nur als Stub vorhanden.)
|
||||
*/
|
||||
public function doPayment(DoPaymentRequest $request): DoPaymentResponse;
|
||||
|
||||
/**
|
||||
* Erzeugt die Rechnung/Zahlungsaufforderung. Der gemeinsame Rumpf kommt aus der Basisklasse,
|
||||
* nur der Schlusssatz variiert je Modul.
|
||||
* (In dieser Iteration nur als Stub vorhanden.)
|
||||
*/
|
||||
public function createInvoice(CreateInvoiceRequest $request): CreateInvoiceResponse;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules;
|
||||
|
||||
use App\EventPaymentModules\Modules\AccountTransferPaymentModule;
|
||||
use App\EventPaymentModules\Modules\UndefinedPaymentModule;
|
||||
|
||||
/**
|
||||
* Zentrale Auflösung Slug -> Zahlungsmodul. Neue Zahlungsarten werden hier eingetragen.
|
||||
* Bewusst statisch + manuelle Instanziierung (kein Container-Binding), passend zum Projektstil.
|
||||
*/
|
||||
class EventPaymentModuleRegistry
|
||||
{
|
||||
/**
|
||||
* Alle registrierten Modul-Klassen. Reihenfolge bestimmt u.a. die Seed-Reihenfolge.
|
||||
*
|
||||
* @var array<int, class-string<EventPaymentModule>>
|
||||
*/
|
||||
private const MODULES = [
|
||||
AccountTransferPaymentModule::class,
|
||||
UndefinedPaymentModule::class,
|
||||
];
|
||||
|
||||
/** @var array<string, EventPaymentModule>|null Lazy gecachte Instanzen (slug => Modul). */
|
||||
private static ?array $instances = null;
|
||||
|
||||
/**
|
||||
* @return array<string, EventPaymentModule>
|
||||
*/
|
||||
public static function all(): array
|
||||
{
|
||||
if (self::$instances === null) {
|
||||
self::$instances = [];
|
||||
foreach (self::MODULES as $moduleClass) {
|
||||
self::$instances[$moduleClass::slug()] = new $moduleClass();
|
||||
}
|
||||
}
|
||||
|
||||
return self::$instances;
|
||||
}
|
||||
|
||||
public static function forSlug(string $slug): ?EventPaymentModule
|
||||
{
|
||||
return self::all()[$slug] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function slugs(): array
|
||||
{
|
||||
return array_keys(self::all());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\Modules;
|
||||
|
||||
use App\EventPaymentModules\AbstractEventPaymentModule;
|
||||
use App\EventPaymentModules\DTO\CreateInvoiceRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationRenderContext;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
||||
use App\EventPaymentModules\ProvidesGiroCode;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Providers\GiroCodeProvider;
|
||||
|
||||
/**
|
||||
* Überweisung auf das Veranstaltungskonto -- die Zahlung erfolgt manuell durch die teilnehmende Person.
|
||||
*/
|
||||
class AccountTransferPaymentModule extends AbstractEventPaymentModule implements ProvidesGiroCode
|
||||
{
|
||||
public static function slug(): string
|
||||
{
|
||||
return PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION;
|
||||
}
|
||||
|
||||
public function defaultName(): string
|
||||
{
|
||||
return 'Überweisung auf Veranstaltungskonto';
|
||||
}
|
||||
|
||||
public function defaultConfiguration(): array
|
||||
{
|
||||
return ['icon' => 'building-columns'];
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'account_owner', 'label' => 'Kontoinhaber', 'type' => 'string', 'required' => true],
|
||||
['name' => 'iban', 'label' => 'IBAN', 'type' => 'string', 'required' => true],
|
||||
['name' => 'bic', 'label' => 'BIC', 'type' => 'string', 'required' => false],
|
||||
['name' => 'summary_confirmation_text', 'label' => 'Bestätigung durch Teilnehmende (Zusammenfassung, {amount} als Platzhalter)', 'type' => 'string', 'required' => false],
|
||||
['name' => 'icon', 'label' => 'Symbol', 'type' => 'icon', 'required' => false],
|
||||
];
|
||||
}
|
||||
|
||||
public function registrationSummary(RegistrationSummaryRequest $request): RegistrationSummaryResponse
|
||||
{
|
||||
$participant = $request->participant;
|
||||
$config = $request->configuration;
|
||||
|
||||
$amountLeft = clone $participant->amount;
|
||||
if ($participant->amount_paid !== null) {
|
||||
$amountLeft->subtractAmount($participant->amount_paid);
|
||||
}
|
||||
|
||||
$hasPaymentInformation = $amountLeft->getAmount() > 0;
|
||||
|
||||
// GiroCode nur bei offenem Betrag; Bildquelle je Render-Kontext (Web-Endpoint vs. Mail-CID).
|
||||
$giroCodeSrc = null;
|
||||
if ($hasPaymentInformation) {
|
||||
$giroCodeSrc = $request->context === RegistrationRenderContext::Mail
|
||||
? 'cid:girocode.png'
|
||||
: '/print-girocode/' . $participant->identifier;
|
||||
}
|
||||
|
||||
// Medien-gerechtes Template je Render-Kontext (Web: SPA-Klassen, Mail: E-Mail-tauglich).
|
||||
$view = $request->context === RegistrationRenderContext::Mail
|
||||
? 'payment-modules.account-transfer.mail'
|
||||
: 'payment-modules.account-transfer.web';
|
||||
|
||||
$response = new RegistrationSummaryResponse();
|
||||
$response->hasPaymentInformation = $hasPaymentInformation;
|
||||
$response->html = view($view, [
|
||||
'accountOwner' => (string)($config['account_owner'] ?? ''),
|
||||
'iban' => (string)($config['iban'] ?? ''),
|
||||
'paymentPurpose' => (string)$participant->payment_purpose,
|
||||
'amount' => $amountLeft->toString(),
|
||||
'giroCodeSrc' => $giroCodeSrc,
|
||||
'reminderUrl' => url('/api/v1/event/participant/' . $participant->identifier . '/ical-payment'),
|
||||
'paymentDeadline' => $participant->event?->registration_final_end?->format('d.m.Y'),
|
||||
])->render();
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function giroCode(EventParticipant $participant, array $configuration): ?string
|
||||
{
|
||||
$amountLeft = clone $participant->amount;
|
||||
if ($participant->amount_paid !== null) {
|
||||
$amountLeft->subtractAmount($participant->amount_paid);
|
||||
}
|
||||
|
||||
if ($amountLeft->getAmount() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$provider = new GiroCodeProvider(
|
||||
(string)($configuration['account_owner'] ?? ''),
|
||||
(string)($configuration['iban'] ?? ''),
|
||||
$amountLeft->getAmount(),
|
||||
(string)$participant->payment_purpose,
|
||||
);
|
||||
|
||||
return (string)$provider->create();
|
||||
}
|
||||
|
||||
protected function invoiceClosingStatement(CreateInvoiceRequest $request): string
|
||||
{
|
||||
// TODO: In einer Folge-Iteration ausformulieren (z.B. "Bitte überweise bis zum ... auf IBAN ...").
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules\Modules;
|
||||
|
||||
use App\EventPaymentModules\AbstractEventPaymentModule;
|
||||
use App\EventPaymentModules\DTO\CreateInvoiceRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationRenderContext;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
/**
|
||||
* Sonstiges (Barzahlung, Zahlung vor Ort) -- die anzuzeigende Zahlungsinformation ist nutzerdefiniert
|
||||
* (mehrzeiliger Freitext) und wird als Option gepflegt.
|
||||
*/
|
||||
class UndefinedPaymentModule extends AbstractEventPaymentModule
|
||||
{
|
||||
public static function slug(): string
|
||||
{
|
||||
return PaymentMethod::PAYMENT_NOT_DEFINED;
|
||||
}
|
||||
|
||||
public function defaultName(): string
|
||||
{
|
||||
return 'Sonstiges (Barzahlung, Zahlung vor Ort)';
|
||||
}
|
||||
|
||||
public function defaultConfiguration(): array
|
||||
{
|
||||
return ['icon' => 'coins'];
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'payment_information', 'label' => 'Zahlungsinformationen', 'type' => 'richtext', 'required' => true, 'hint' => 'Dieser Text wird der teilnehmenden Person am Ende der Anmeldung und in der Bestätigungs-E-Mail angezeigt.'],
|
||||
['name' => 'icon', 'label' => 'Symbol', 'type' => 'icon', 'required' => false],
|
||||
];
|
||||
}
|
||||
|
||||
public function registrationSummary(RegistrationSummaryRequest $request): RegistrationSummaryResponse
|
||||
{
|
||||
$paymentInformation = (string)($request->configuration['payment_information'] ?? '');
|
||||
|
||||
$response = new RegistrationSummaryResponse();
|
||||
$response->hasPaymentInformation = trim($paymentInformation) !== '';
|
||||
|
||||
if ($response->hasPaymentInformation) {
|
||||
// Medien-gerechtes Template je Render-Kontext (Web: SPA, Mail: E-Mail-tauglich).
|
||||
$view = $request->context === RegistrationRenderContext::Mail
|
||||
? 'payment-modules.undefined.mail'
|
||||
: 'payment-modules.undefined.web';
|
||||
|
||||
$response->html = view($view, ['paymentInformation' => $paymentInformation])->render();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
protected function invoiceClosingStatement(CreateInvoiceRequest $request): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\EventPaymentModules;
|
||||
|
||||
use App\Models\EventParticipant;
|
||||
|
||||
/**
|
||||
* Fähigkeits-Interface (Interface Segregation): Nur Zahlungsarten mit einem GiroCode (SEPA-QR)
|
||||
* implementieren dies -- aktuell ausschließlich die Überweisung. Das Core-Interface
|
||||
* {@see EventPaymentModule} bleibt davon unberührt.
|
||||
*/
|
||||
interface ProvidesGiroCode
|
||||
{
|
||||
/**
|
||||
* Erzeugt den GiroCode (SEPA-QR) als PNG-Binary -- oder null, wenn (z.B. mangels offenem Betrag)
|
||||
* kein GiroCode angeboten wird.
|
||||
*
|
||||
* @param array<string, mixed> $configuration
|
||||
*/
|
||||
public function giroCode(EventParticipant $participant, array $configuration): ?string;
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\EventPaymentModules\ProvidesGiroCode;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Providers\GiroCodeProvider;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GiroCodeGetController {
|
||||
@@ -14,18 +14,16 @@ class GiroCodeGetController {
|
||||
return response()->json(['message' => 'Participant not found'], 404);
|
||||
}
|
||||
|
||||
$amount = $participant->amount;
|
||||
$amount->subtractAmount($participant->amount_paid);
|
||||
// Die GiroCode-Erzeugung gehört zum Zahlungsmodul; ohne diese Fähigkeit (z.B. Barzahlung) -> 404.
|
||||
$module = $participant->paymentModule();
|
||||
$girocode = $module instanceof ProvidesGiroCode
|
||||
? $module->giroCode($participant, $participant->paymentConfiguration())
|
||||
: null;
|
||||
|
||||
$girocodeProvider = new GiroCodeProvider(
|
||||
$participant->event()->first()->account_owner,
|
||||
$participant->event()->first()->account_iban,
|
||||
$participant->amount->getAmount(),
|
||||
$participant->payment_purpose
|
||||
);
|
||||
if ($girocode === null) {
|
||||
return response()->json(['message' => 'No giro code for this payment method'], 404);
|
||||
}
|
||||
|
||||
return response($girocodeProvider->create(), 200,
|
||||
['Content-Type' => 'image/png']
|
||||
);
|
||||
return response($girocode, 200, ['Content-Type' => 'image/png']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,12 @@ use App\Enumerations\InvoiceStatus;
|
||||
use App\Enumerations\InvoiceType;
|
||||
use App\Enumerations\ParticipationFeeType;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Enumerations\PaymentStatus;
|
||||
use App\Enumerations\SwimmingPermission;
|
||||
use App\Enumerations\UserRole;
|
||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
||||
use App\Models\CronTask;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\Tenant;
|
||||
|
||||
class ProductionDataSeeder {
|
||||
@@ -28,6 +31,21 @@ class ProductionDataSeeder {
|
||||
$this->installParticipationFeeTypes();
|
||||
$this->installParticipationTypes();
|
||||
$this->installEfzStatus();
|
||||
$this->installPaymentMethods();
|
||||
$this->installPaymentStatus();
|
||||
}
|
||||
|
||||
private function installPaymentStatus() {
|
||||
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_PENDING]);
|
||||
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_SCHEDULED]);
|
||||
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_PAID]);
|
||||
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_FAILED]);
|
||||
}
|
||||
|
||||
private function installPaymentMethods() {
|
||||
foreach (EventPaymentModuleRegistry::slugs() as $slug) {
|
||||
PaymentMethod::create(['slug' => $slug]);
|
||||
}
|
||||
}
|
||||
|
||||
private function installEfzStatus() {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\EventReportMails;
|
||||
|
||||
use App\Models\Event;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
|
||||
class PaymentMethodsExhaustedMail extends Mailable
|
||||
{
|
||||
public function __construct(
|
||||
private Event $event,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
$subject = sprintf(
|
||||
'Anmeldung deaktiviert – keine Zahlungsmethode verfügbar für %1$s',
|
||||
$this->event->name
|
||||
);
|
||||
|
||||
return new Envelope(
|
||||
subject: $subject,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'emails.events.payment_methods_exhausted',
|
||||
with: [
|
||||
'eventTitle' => $this->event->name,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ use App\Domains\Event\Actions\GenerateIcal\GenerateIcalResponse;
|
||||
use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineCommand;
|
||||
use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineRequest;
|
||||
use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineResponse;
|
||||
use App\EventPaymentModules\DTO\RegistrationRenderContext;
|
||||
use App\EventPaymentModules\ProvidesGiroCode;
|
||||
use App\Models\EventParticipant;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -62,13 +64,13 @@ class EventSignUpSuccessfullMail extends Mailable
|
||||
$event = $this->participant->event()->first()->toResource()->toArray(new Request());
|
||||
$participant = $this->participant->toResource()->toArray(new Request());
|
||||
|
||||
$girocodeProvider = new \App\Providers\GiroCodeProvider(
|
||||
$event['accountOwner'],
|
||||
$event['accountIban'],
|
||||
(float) $participant['amount_left_value'],
|
||||
$participant['payment_purpose']
|
||||
);
|
||||
$girocodeBinary = (string)$girocodeProvider->create();
|
||||
$module = $this->participant->paymentModule();
|
||||
$girocodeBinary = $module instanceof ProvidesGiroCode
|
||||
? $module->giroCode($this->participant, $this->participant->paymentConfiguration())
|
||||
: null;
|
||||
|
||||
// Zahlungs-Block im Mail-Kontext erzeugen (GiroCode als cid: statt Web-Endpoint).
|
||||
$paymentSummary = $this->participant->paymentSummary(RegistrationRenderContext::Mail);
|
||||
|
||||
$participationIcal = $this->getParticipationIcal();
|
||||
$deadlineIcal = $this->getDeadlineIcal();
|
||||
@@ -85,10 +87,7 @@ class EventSignUpSuccessfullMail extends Mailable
|
||||
'departure' => $participant['departure'],
|
||||
'amount' => $participant['amount_left_string'],
|
||||
'paymentFinalDate' => $event['registrationFinalEnd']['formatted'],
|
||||
'paymentRequired' => $participant['needs_payment'],
|
||||
'accountOwner' => $event['accountOwner'],
|
||||
'accountIban' => $event['accountIban'],
|
||||
'paymentPurpose' => $participant['payment_purpose'],
|
||||
'paymentSummary' => ['hasPaymentInformation' => $paymentSummary->hasPaymentInformation, 'html' => $paymentSummary->html],
|
||||
'girocodeBinary' => $girocodeBinary,
|
||||
'efzStatus' => $participant['efz_status'],
|
||||
'participationIcalFilename' => $participationIcal->filename,
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Mail\ParticipantPaymentMails;
|
||||
|
||||
use App\EventPaymentModules\DTO\RegistrationRenderContext;
|
||||
use App\EventPaymentModules\ProvidesGiroCode;
|
||||
use App\Models\EventParticipant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Mail\Mailable;
|
||||
@@ -45,13 +47,13 @@ class ParticipantPaymentMissingPaymentMail extends Mailable
|
||||
$event = $this->participant->event()->first()->toResource()->toArray(new Request());
|
||||
$participant = $this->participant->toResource()->toArray(new Request());
|
||||
|
||||
$girocodeProvider = new \App\Providers\GiroCodeProvider(
|
||||
$event['accountOwner'],
|
||||
$event['accountIban'],
|
||||
(float) $participant['amount_left_value'],
|
||||
$participant['payment_purpose']
|
||||
);
|
||||
$girocodeBinary = (string)$girocodeProvider->create();
|
||||
$module = $this->participant->paymentModule();
|
||||
$girocodeBinary = $module instanceof ProvidesGiroCode
|
||||
? $module->giroCode($this->participant, $this->participant->paymentConfiguration())
|
||||
: null;
|
||||
|
||||
// Zahlungs-Block im Mail-Kontext erzeugen (GiroCode als cid: statt Web-Endpoint).
|
||||
$paymentSummary = $this->participant->paymentSummary(RegistrationRenderContext::Mail);
|
||||
|
||||
return new Content(
|
||||
view: 'emails.participantPayments.missing_amount',
|
||||
@@ -64,10 +66,7 @@ class ParticipantPaymentMissingPaymentMail extends Mailable
|
||||
'departure' => $participant['departure'],
|
||||
'amount' => $participant['amount_left_string'],
|
||||
'paymentFinalDate' => $event['registrationFinalEnd']['formatted'],
|
||||
'paymentRequired' => $participant['needs_payment'],
|
||||
'accountOwner' => $event['accountOwner'],
|
||||
'accountIban' => $event['accountIban'],
|
||||
'paymentPurpose' => $participant['payment_purpose'],
|
||||
'paymentSummary' => ['hasPaymentInformation' => $paymentSummary->hasPaymentInformation, 'html' => $paymentSummary->html],
|
||||
'girocodeBinary' => $girocodeBinary,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Scopes\InstancedModel;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $tenant
|
||||
* @property string $slug
|
||||
* @property string $name
|
||||
* @property ?string $description
|
||||
* @property bool $active
|
||||
* @property ?array $configuration
|
||||
*/
|
||||
class AvailablePaymentMethod extends InstancedModel
|
||||
{
|
||||
protected $table = 'available_payment_methods';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant',
|
||||
'slug',
|
||||
'name',
|
||||
'description',
|
||||
'active',
|
||||
'configuration',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'boolean',
|
||||
'configuration' => 'array',
|
||||
];
|
||||
|
||||
public function paymentMethod(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PaymentMethod::class, 'slug', 'slug');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sind alle Pflicht-Optionen dieses Moduls (siehe Options-Schema des Zahlungsmoduls) befüllt?
|
||||
*/
|
||||
public function isComplete(): bool
|
||||
{
|
||||
return PaymentMethod::isConfigurationComplete($this->slug, $this->configuration ?? []);
|
||||
}
|
||||
|
||||
public function events(): BelongsToMany
|
||||
{
|
||||
// Pivot verknüpft über den Slug -- Event::paymentMethods() greift daher automatisch nur
|
||||
// auf Events des aktuell gebundenen Tenants zu (SiteScope auf Event + AvailablePaymentMethod).
|
||||
return $this->belongsToMany(Event::class, 'event_payment_methods', 'slug', 'event_id', 'slug', 'id')->withTimestamps();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ use App\Casts\AmountCast;
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\ParticipationFeeType;
|
||||
use App\RelationModels\EventParticipationFee;
|
||||
use App\RelationModels\EventPaymentMethods;
|
||||
use App\Resources\EventResource;
|
||||
use App\Scopes\CommonModel;
|
||||
use App\Scopes\InstancedModel;
|
||||
@@ -153,6 +154,16 @@ class Event extends InstancedModel
|
||||
return $this->belongsToMany(EatingHabit::class, 'event_allowed_eating_habits', 'event_id', 'eating_habit_id');
|
||||
}
|
||||
|
||||
public function paymentMethods() : BelongsToMany {
|
||||
// Pivot verknüpft über den Slug (payment_methods.slug), nicht über die numerische id
|
||||
// von available_payment_methods -- die tenant-spezifische Instanz wird dadurch implizit
|
||||
// über den globalen SiteScope von AvailablePaymentMethod (gefiltert auf app('tenant')) aufgelöst.
|
||||
return $this->belongsToMany(AvailablePaymentMethod::class, 'event_payment_methods', 'event_id', 'slug', 'id', 'slug')
|
||||
->using(EventPaymentMethods::class)
|
||||
->withPivot('configuration')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function resetContributingLocalGroups() {
|
||||
$this->localGroups()->detach();
|
||||
$this->save();
|
||||
@@ -163,6 +174,11 @@ class Event extends InstancedModel
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function resetPaymentMethods() {
|
||||
$this->paymentMethods()->detach();
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function resetMangers() {
|
||||
$this->eventManagers()->detach();
|
||||
$this->save();
|
||||
|
||||
@@ -8,8 +8,12 @@ use App\Enumerations\EfzStatus;
|
||||
use App\Enumerations\FirstAidPermission;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Enumerations\SwimmingPermission;
|
||||
use App\EventPaymentModules\DTO\RegistrationRenderContext;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
||||
use App\EventPaymentModules\EventPaymentModule;
|
||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
||||
use App\Scopes\InstancedModel;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
|
||||
class EventParticipant extends InstancedModel
|
||||
@@ -64,6 +68,8 @@ class EventParticipant extends InstancedModel
|
||||
'amount',
|
||||
'amount_paid',
|
||||
'payment_purpose',
|
||||
'payment_method',
|
||||
'payment_options',
|
||||
'efz_status',
|
||||
'unregistered_at',
|
||||
];
|
||||
@@ -83,6 +89,7 @@ class EventParticipant extends InstancedModel
|
||||
|
||||
'amount' => AmountCast::class,
|
||||
'amount_paid' => AmountCast::class,
|
||||
'payment_options' => 'array',
|
||||
];
|
||||
|
||||
/*
|
||||
@@ -126,6 +133,11 @@ class EventParticipant extends InstancedModel
|
||||
return $this->belongsTo(EatingHabit::class, 'eating_habits', 'slug');
|
||||
}
|
||||
|
||||
public function paymentMethod()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\PaymentMethod::class, 'payment_method', 'slug');
|
||||
}
|
||||
|
||||
public function firstAidPermission()
|
||||
{
|
||||
return $this->belongsTo(FirstAidPermission::class, 'first_aid_permission', 'slug');
|
||||
@@ -160,4 +172,47 @@ class EventParticipant extends InstancedModel
|
||||
return $this->nickname ?? $this->firstname;
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Zahlungsmodul
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** Das Zahlungsmodul der gewählten Zahlungsart des Teilnehmers. */
|
||||
public function paymentModule(): ?EventPaymentModule
|
||||
{
|
||||
return $this->payment_method !== null
|
||||
? EventPaymentModuleRegistry::forSlug($this->payment_method)
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aufgelöste pro-Event-Konfiguration der gewählten Zahlungsart (event_payment_methods.configuration).
|
||||
*
|
||||
* Nutzt die Relation-Property, damit sie via `->with('event.paymentMethods')` eager geladen und in
|
||||
* Teilnehmerlisten (gleiches Event teilt dieselbe Event-Instanz) ohne N+1 aufgelöst werden kann.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function paymentConfiguration(): array
|
||||
{
|
||||
if ($this->payment_method === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$method = $this->event?->paymentMethods->firstWhere('slug', $this->payment_method);
|
||||
|
||||
return $method?->pivot->configuration ?? [];
|
||||
}
|
||||
|
||||
/** Zahlungs-Zusammenfassung (Anmeldeabschluss/Mail), vom Zahlungsmodul als fertiges HTML erzeugt. */
|
||||
public function paymentSummary(RegistrationRenderContext $context = RegistrationRenderContext::Web): RegistrationSummaryResponse
|
||||
{
|
||||
$module = $this->paymentModule();
|
||||
if ($module === null) {
|
||||
return new RegistrationSummaryResponse();
|
||||
}
|
||||
|
||||
return $module->registrationSummary(new RegistrationSummaryRequest($this, $this->paymentConfiguration(), $context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
||||
use App\Scopes\CommonModel;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
|
||||
/**
|
||||
* @property string $id
|
||||
* @property string $slug
|
||||
*
|
||||
* Hinweis: Das Verhalten je Zahlungsart (Options-Schema, Defaults, Zahlung, Rechnung) liegt in den
|
||||
* Zahlungsmodulen unter {@see \App\EventPaymentModules}. Dieses Model bleibt eine dünne Fassade, damit
|
||||
* bestehende Aufrufstellen (PaymentMethod::optionsFor/... ) unverändert weiterlaufen.
|
||||
*/
|
||||
class PaymentMethod extends CommonModel
|
||||
{
|
||||
use HasUuids;
|
||||
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'string';
|
||||
|
||||
public const string PAYMENT_ACCOUNT_TRANSACTION = 'PAYMENT_ACCOUNT_TRANSACTION';
|
||||
public const string PAYMENT_NOT_DEFINED = 'PAYMENT_NOT_DEFINED';
|
||||
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
];
|
||||
|
||||
/**
|
||||
* Standard-Werte (name/description/configuration) je Slug -- aus den Zahlungsmodulen aufgebaut.
|
||||
*
|
||||
* @return array<string, array{name: string, description: ?string, configuration: array<string, mixed>}>
|
||||
*/
|
||||
public static function defaults(): array
|
||||
{
|
||||
$defaults = [];
|
||||
foreach (EventPaymentModuleRegistry::all() as $slug => $module) {
|
||||
$defaults[$slug] = [
|
||||
'name' => $module->defaultName(),
|
||||
'description' => $module->defaultDescription(),
|
||||
'configuration' => $module->defaultConfiguration(),
|
||||
];
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin-Options-Schema für einen Slug.
|
||||
*
|
||||
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||
*/
|
||||
public static function optionsFor(string $slug): array
|
||||
{
|
||||
return EventPaymentModuleRegistry::forSlug($slug)?->getOptions() ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Teilnehmer-Eingabe-Schema für einen Slug (payer-seitig).
|
||||
*
|
||||
* @return array<int, array{name: string, label: string, type: string, required: bool}>
|
||||
*/
|
||||
public static function participantOptionsFor(string $slug): array
|
||||
{
|
||||
return EventPaymentModuleRegistry::forSlug($slug)?->getParticipantOptions() ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Namen aller Pflicht-Optionen eines Slugs.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function requiredOptionKeys(string $slug): array
|
||||
{
|
||||
return EventPaymentModuleRegistry::forSlug($slug)?->requiredOptionKeys() ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduziert eine Konfiguration auf die im Schema definierten Options-Keys des Slugs.
|
||||
*
|
||||
* @param array<string, mixed> $config
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function sanitizeConfiguration(string $slug, array $config): array
|
||||
{
|
||||
return EventPaymentModuleRegistry::forSlug($slug)?->sanitizeConfiguration($config) ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob alle Pflicht-Optionen eines Slugs in der Konfiguration befüllt (non-empty) sind.
|
||||
* Unbekannte Slugs (kein Modul) gelten als vollständig -- kein Modul, keine Pflichtfelder.
|
||||
*
|
||||
* @param array<string, mixed> $config
|
||||
*/
|
||||
public static function isConfigurationComplete(string $slug, array $config): bool
|
||||
{
|
||||
return EventPaymentModuleRegistry::forSlug($slug)?->isConfigurationComplete($config) ?? true;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,12 @@ namespace App\Providers;
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\InvoiceType;
|
||||
use App\Enumerations\UserRole;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Repositories\EventRepository;
|
||||
use App\Repositories\PageTextRepository;
|
||||
use App\Resources\AvailablePaymentMethodResource;
|
||||
use App\Resources\UserResource;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -182,11 +184,13 @@ class GlobalDataProvider {
|
||||
return $activeUsers;
|
||||
}
|
||||
|
||||
public function getEventSettingData() : JsonResponse {
|
||||
public function getEventSettingData(Request $request) : JsonResponse {
|
||||
return response()->json(
|
||||
[
|
||||
'localGroups' => Tenant::where(['is_active_local_group' => true])->get(),
|
||||
'eatingHabits' => EatingHabit::all(),
|
||||
'paymentMethods' => AvailablePaymentMethod::where('active', true)->get()
|
||||
->map(fn (AvailablePaymentMethod $method) => new AvailablePaymentMethodResource($method)->toArray($request)),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\RelationModels;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
/**
|
||||
* @property int $event_id
|
||||
* @property string $slug
|
||||
* @property ?array $configuration
|
||||
*/
|
||||
class EventPaymentMethods extends Pivot
|
||||
{
|
||||
protected $table = 'event_payment_methods';
|
||||
|
||||
public $incrementing = true;
|
||||
|
||||
protected $fillable = ['event_id', 'slug', 'configuration'];
|
||||
|
||||
protected $casts = [
|
||||
'configuration' => 'array',
|
||||
];
|
||||
}
|
||||
@@ -66,34 +66,20 @@ class CostUnitRepository {
|
||||
}
|
||||
|
||||
public function getCostUnitsByCriteria(array $criteria, bool $forDisplay = true, $disableAccessCheck = false) : array {
|
||||
$tenant = app('tenant');
|
||||
|
||||
$canSeeAll = false;
|
||||
$user = Auth()->user();
|
||||
|
||||
if ($disableAccessCheck) {
|
||||
$canSeeAll = true;
|
||||
} else {
|
||||
if ($tenant->slug !== 'lv') {
|
||||
if (
|
||||
new AuthCheckProvider()->isAdministrator() ||
|
||||
$user->user_role_local_group === UserRole::USER_ROLE_ADMIN
|
||||
) {
|
||||
$canSeeAll = true;
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
in_array($user->user_role_main, [UserRole::USER_ROLE_GROUP_LEADER, UserRole::USER_ROLE_ADMIN])
|
||||
) {
|
||||
$canSeeAll = true;
|
||||
}
|
||||
}
|
||||
$canSeeAll = in_array(new AuthCheckProvider()->getUserRole(), [
|
||||
UserRole::USER_ROLE_ADMIN, UserRole::USER_ROLE_GROUP_LEADER
|
||||
]);
|
||||
}
|
||||
|
||||
$visibleCostUnits = [];
|
||||
/** @var CostUnit $costUnit */
|
||||
foreach (Costunit::where($criteria)->get() as $costUnit) {
|
||||
if ($canSeeAll || $disableAccessCheck || $costUnit->treasurers()->where('user_id', $user->id)->exists() ) {
|
||||
if ($canSeeAll || $costUnit->treasurers()->where('user_id', $user->id)->exists() ) {
|
||||
if ($forDisplay) {
|
||||
$visibleCostUnits[] = new CostUnitResource($costUnit)->toArray(request());
|
||||
} else {
|
||||
|
||||
@@ -77,38 +77,20 @@ class EventRepository {
|
||||
}
|
||||
|
||||
public function getEventsByCriteria(array $criteria, $accessCheck = true) : array {
|
||||
$tenant = app('tenant');
|
||||
|
||||
$canSeeAll = false;
|
||||
$user = Auth()->user();
|
||||
|
||||
if (!$accessCheck) {
|
||||
$canSeeAll = true;
|
||||
} else {
|
||||
if (
|
||||
new AuthCheckProvider()->isAdministrator() ||
|
||||
$user->user_role_local_group === UserRole::USER_ROLE_ADMIN
|
||||
) {
|
||||
if (
|
||||
$user->user_role_main === UserRole::USER_ROLE_ADMIN ||
|
||||
in_array($user->user_role_local_group, [UserRole::USER_ROLE_GROUP_LEADER, UserRole::USER_ROLE_ADMIN])
|
||||
) {
|
||||
$canSeeAll = true;
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
in_array($user->user_role_main, [UserRole::USER_ROLE_GROUP_LEADER, UserRole::USER_ROLE_ADMIN])
|
||||
) {
|
||||
$canSeeAll = true;
|
||||
}
|
||||
}
|
||||
$canSeeAll = in_array(new AuthCheckProvider()->getUserRole(), [
|
||||
UserRole::USER_ROLE_ADMIN, UserRole::USER_ROLE_GROUP_LEADER
|
||||
]);
|
||||
}
|
||||
|
||||
$visibleEvents = [];
|
||||
/** @var Event $event */
|
||||
foreach (Event::where($criteria)->orderBy('start_date')->get() as $event) {
|
||||
|
||||
if ($canSeeAll || !$accessCheck || $event->eventManagers()->where('user_id', $user->id)->exists()) {
|
||||
if ($canSeeAll || $event->eventManagers()->where('user_id', $user->id)->exists()) {
|
||||
$visibleEvents[] = $event;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Enumerations\InvoiceStatus;
|
||||
use App\Enumerations\UserRole;
|
||||
use App\Models\CostUnit;
|
||||
use App\Models\Invoice;
|
||||
use App\Providers\AuthCheckProvider;
|
||||
use App\Resources\InvoiceResource;
|
||||
use App\ValueObjects\Amount;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -83,19 +84,9 @@ class InvoiceRepository {
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
if ($user->user_role_main === UserRole::USER_ROLE_ADMIN) {
|
||||
return $invoice;
|
||||
}
|
||||
return in_array(new AuthCheckProvider()->getUserRole(), [
|
||||
UserRole::USER_ROLE_ADMIN, UserRole::USER_ROLE_GROUP_LEADER
|
||||
]) ? $invoice : null;
|
||||
|
||||
if (app('tenant')->slug === 'lv' && $user->user_role_main === UserRole::USER_ROLE_GROUP_LEADER) {
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
if (app('tenant')->slug !== 'lv' && $user->local_group === app('tenant')->slug && $user->user_role_local_group === UserRole::USER_ROLE_GROUP_LEADER) {
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Resources;
|
||||
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\PaymentMethod;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AvailablePaymentMethodResource extends JsonResource {
|
||||
private AvailablePaymentMethod $availablePaymentMethod;
|
||||
|
||||
public function __construct(AvailablePaymentMethod $availablePaymentMethod) {
|
||||
parent::__construct($availablePaymentMethod);
|
||||
$this->availablePaymentMethod = $availablePaymentMethod;
|
||||
}
|
||||
|
||||
public function toArray($request) : array {
|
||||
// Wird die Instanz über Event::paymentMethods() geladen, liegt die pro-Event-Konfiguration
|
||||
// im Pivot; ansonsten (Tenant-Kontext) gilt die Konfiguration der Instanz selbst.
|
||||
$pivot = $this->availablePaymentMethod->pivot ?? null;
|
||||
$configuration = $pivot !== null
|
||||
? ($pivot->configuration ?? [])
|
||||
: ($this->availablePaymentMethod->configuration ?? []);
|
||||
|
||||
return [
|
||||
'id' => $this->availablePaymentMethod->id,
|
||||
'slug' => $this->availablePaymentMethod->slug,
|
||||
'name' => $this->availablePaymentMethod->name,
|
||||
'description' => $this->availablePaymentMethod->description,
|
||||
'active' => $this->availablePaymentMethod->active,
|
||||
'configuration' => (object) $configuration,
|
||||
'optionsSchema' => PaymentMethod::optionsFor($this->availablePaymentMethod->slug),
|
||||
'participantOptionsSchema' => PaymentMethod::participantOptionsFor($this->availablePaymentMethod->slug),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@ namespace App\Resources;
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\EfzStatus;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\ValueObjects\Age;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -25,6 +27,8 @@ class EventParticipantResource extends JsonResource
|
||||
$amountLeft->subtractAmount($this->resource->amount_paid);
|
||||
}
|
||||
|
||||
$paymentSummary = $this->resource->paymentSummary();
|
||||
|
||||
$presenceDays = $this->resource->arrival_date->diff($this->resource->departure_date)->days;
|
||||
if ($presenceDays === 0) {
|
||||
$presenceDays = 1;
|
||||
@@ -52,7 +56,13 @@ class EventParticipantResource extends JsonResource
|
||||
'tetanusVaccinationEdit' => $this->resource->tetanus_vaccination?->format('Y-m-d') ?? null,
|
||||
'presenceDays' => ['real' => $presenceDays, 'support' => $presenceDaysSupport],
|
||||
'participationType' => ParticipationType::where(['slug' => $this->resource->participation_type])->first()->name,
|
||||
'needs_payment' => $this->resource->amount->getAmount() > 0 && $event->pay_direct && $this->resource->amount_paid?->getAmount() < $this->resource->amount->getAmount(),
|
||||
'needs_payment' => $this->resource->amount->getAmount() > 0
|
||||
&& $this->resource->payment_method === PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION
|
||||
&& $this->resource->amount_paid?->getAmount() < $this->resource->amount->getAmount(),
|
||||
'paymentSummary' => [
|
||||
'hasPaymentInformation' => $paymentSummary->hasPaymentInformation,
|
||||
'html' => $paymentSummary->html,
|
||||
],
|
||||
'nicename' => $this->resource->getNicename(),
|
||||
'arrival' => $this->resource->arrival_date->format('d.m.Y'),
|
||||
'departure' => $this->resource->departure_date->format('d.m.Y'),
|
||||
@@ -68,6 +78,9 @@ class EventParticipantResource extends JsonResource
|
||||
'localGroupState' => null !== $this->resource->localGroup()->first()?->postcode ? config('postCode.map.' . $this->resource->postcode) : '--',
|
||||
'birthday' => $this->resource->birthday->format('d.m.Y'),
|
||||
'eatingHabit' => EatingHabit::where('slug', $this->resource->eating_habit)->first()->name,
|
||||
'paymentMethod' => $this->resource->payment_method !== null
|
||||
? AvailablePaymentMethod::withoutGlobalScopes()->where('tenant', $this->resource->tenant)->where('slug', $this->resource->payment_method)->first()?->name ?? $this->resource->payment_method
|
||||
: null,
|
||||
'cocColor' => match ($this->resource->efz_status) {
|
||||
EfzStatus::EFZ_STATUS_CHECKED_VALID => 'bg-green',
|
||||
EfzStatus::EFZ_STATUS_NOT_REQUIRED => 'bg-green',
|
||||
|
||||
@@ -34,7 +34,7 @@ class EventResource extends JsonResource{
|
||||
'accountIban' => $this->event->account_iban,
|
||||
'alcoholicsAge' => $this->event->alcoholics_age,
|
||||
'sendWeeklyReports' => $this->event->send_weekly_report,
|
||||
'registrationAllowed' => $this->event->registration_allowed,
|
||||
'registrationAllowed' => $this->event->registration_allowed && new \DateTime() <= $this->event->start_date,
|
||||
'archived' => $this->event->archived,
|
||||
'earlyBirdEnd' => ['internal' => $this->event->early_bird_end->format('Y-m-d'), 'formatted' => $this->event->early_bird_end->format('d.m.Y')],
|
||||
'registrationFinalEnd' => ['internal' => $this->event->registration_final_end->format('Y-m-d'), 'formatted' => $this->event->registration_final_end->format('d.m.Y')],
|
||||
@@ -134,6 +134,9 @@ class EventResource extends JsonResource{
|
||||
$returnArray['eatingHabits'] = $this->event->eatingHabits()->get()->map(
|
||||
fn($eatingHabit) => new EatingHabitResource($eatingHabit))->toArray();
|
||||
|
||||
$returnArray['paymentMethods'] = $this->event->paymentMethods()->get()->map(
|
||||
fn($paymentMethod) => new AvailablePaymentMethodResource($paymentMethod)->toArray($request))->toArray();
|
||||
|
||||
|
||||
$returnArray['participationTypes'] = [];
|
||||
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
<script setup>
|
||||
import {computed, onBeforeUnmount, onMounted, ref} from 'vue'
|
||||
import Icon from './Icon.vue'
|
||||
|
||||
// Generisches Custom-Dropdown, das je Option ein Icon + Label anzeigt (ein natives <select> kann
|
||||
// keine SVG-Icons rendern). Wiederverwendbar für Icon-/Rich-Selects.
|
||||
const props = defineProps({
|
||||
// Ausgewählter Wert (value einer Option).
|
||||
modelValue: {type: String, default: ''},
|
||||
// [{ value, label, icon? }]
|
||||
options: {type: Array, default: () => []},
|
||||
placeholder: {type: String, default: 'Auswählen…'},
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const open = ref(false)
|
||||
const root = ref(null)
|
||||
|
||||
const selected = computed(() => props.options.find(o => o.value === props.modelValue) ?? null)
|
||||
|
||||
function toggle() {
|
||||
open.value = !open.value
|
||||
}
|
||||
|
||||
function select(option) {
|
||||
emit('update:modelValue', option.value)
|
||||
open.value = false
|
||||
}
|
||||
|
||||
function onClickOutside(event) {
|
||||
if (root.value && !root.value.contains(event.target)) {
|
||||
open.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onKeydown(event) {
|
||||
if (event.key === 'Escape' || event.key === 'Esc') {
|
||||
open.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener('click', onClickOutside)
|
||||
document.addEventListener('keydown', onKeydown)
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('click', onClickOutside)
|
||||
document.removeEventListener('keydown', onKeydown)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="root" class="rich-select">
|
||||
<button
|
||||
type="button"
|
||||
class="rich-select__trigger"
|
||||
:aria-expanded="open"
|
||||
@click="toggle"
|
||||
>
|
||||
<span class="rich-select__value">
|
||||
<template v-if="selected">
|
||||
<Icon v-if="selected.icon" :key="selected.value" :name="selected.icon"/>
|
||||
<span>{{ selected.label }}</span>
|
||||
</template>
|
||||
<span v-else class="rich-select__placeholder">{{ placeholder }}</span>
|
||||
</span>
|
||||
<span class="rich-select__caret" aria-hidden="true">▾</span>
|
||||
</button>
|
||||
|
||||
<ul v-if="open" class="rich-select__list" role="listbox">
|
||||
<li
|
||||
v-for="option in options"
|
||||
:key="option.value"
|
||||
class="rich-select__option"
|
||||
:class="{ 'rich-select__option--active': option.value === modelValue }"
|
||||
role="option"
|
||||
:aria-selected="option.value === modelValue"
|
||||
@click="select(option)"
|
||||
>
|
||||
<Icon v-if="option.icon" :name="option.icon"/>
|
||||
<span>{{ option.label }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.rich-select {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rich-select__trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
gap: 10px;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 0.95rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.rich-select__trigger:hover {
|
||||
border-color: #2563eb;
|
||||
}
|
||||
|
||||
.rich-select__value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rich-select__placeholder {
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.rich-select__caret {
|
||||
color: #6b7280;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.rich-select__list {
|
||||
position: absolute;
|
||||
z-index: 50;
|
||||
top: calc(100% + 4px);
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
list-style: none;
|
||||
background: #fff;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
max-height: 260px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.rich-select__option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rich-select__option:hover {
|
||||
background: #eff6ff;
|
||||
}
|
||||
|
||||
.rich-select__option--active {
|
||||
background: #dbeafe;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,39 @@
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- Dev-Hack: event_payment_methods von available_payment_method_id auf slug.
|
||||
--
|
||||
-- Nur für das lokale Dev-System, das noch die alte Drift-Struktur trägt.
|
||||
-- Bringt die Tabelle in den committeten Stand (2026_07_28_140020_create_event_payment_methods
|
||||
-- + 2026_07_29_140030_fix_event_payment_methods_slug), ohne migrate:fresh / Datenverlust.
|
||||
--
|
||||
-- Ausführen z.B.:
|
||||
-- docker exec -i mareike-mareike-app-1 sh -c 'mysql -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" "$DB_DATABASE"' < database/dev-hacks/fix_event_payment_methods_slug.sql
|
||||
-- ---------------------------------------------------------------------------
|
||||
|
||||
-- 1. slug nullable anlegen.
|
||||
ALTER TABLE `event_payment_methods`
|
||||
ADD COLUMN `slug` VARCHAR(255) NULL AFTER `event_id`;
|
||||
|
||||
-- 2. slug aus der verknüpften available_payment_methods-Zeile befüllen.
|
||||
UPDATE `event_payment_methods` epm
|
||||
JOIN `available_payment_methods` apm ON apm.`id` = epm.`available_payment_method_id`
|
||||
SET epm.`slug` = apm.`slug`;
|
||||
|
||||
-- 3. Alte Spalte samt FK entfernen.
|
||||
ALTER TABLE `event_payment_methods`
|
||||
DROP FOREIGN KEY `event_payment_methods_available_payment_method_id_foreign`;
|
||||
ALTER TABLE `event_payment_methods`
|
||||
DROP COLUMN `available_payment_method_id`;
|
||||
|
||||
-- 4. slug final absichern: NOT NULL, Unique (event_id, slug), FK auf payment_methods.slug.
|
||||
ALTER TABLE `event_payment_methods`
|
||||
MODIFY `slug` VARCHAR(255) NOT NULL;
|
||||
ALTER TABLE `event_payment_methods`
|
||||
ADD UNIQUE `event_payment_methods_event_id_slug_unique` (`event_id`, `slug`);
|
||||
ALTER TABLE `event_payment_methods`
|
||||
ADD CONSTRAINT `event_payment_methods_slug_foreign`
|
||||
FOREIGN KEY (`slug`) REFERENCES `payment_methods` (`slug`)
|
||||
ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
|
||||
-- Hinweis: Die Reparatur-Migration 2026_07_29_140030 bleibt danach "pending", ist aber ein
|
||||
-- sicherer No-Op (ihr Guard prüft available_payment_method_id) -- ein späteres
|
||||
-- `php artisan migrate` verbucht sie, ohne etwas zu verändern.
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('payment_methods', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('slug')->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('available_payment_methods', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('tenant');
|
||||
$table->string('slug');
|
||||
$table->string('name');
|
||||
$table->string('description')->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
|
||||
$table->foreign('slug')->references('slug')->on('payment_methods')->restrictOnDelete()->cascadeOnUpdate();
|
||||
$table->unique(['tenant', 'slug']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('available_payment_methods');
|
||||
Schema::dropIfExists('payment_methods');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('event_payment_methods', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('event_id')->constrained('events', 'id')->restrictOnDelete()->cascadeOnUpdate();
|
||||
$table->string('slug');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('slug')->references('slug')->on('payment_methods')->restrictOnDelete()->cascadeOnUpdate();
|
||||
$table->unique(['event_id', 'slug']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('event_payment_methods');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('event_participants', function (Blueprint $table) {
|
||||
$table->string('payment_method')->nullable()->after('payment_purpose');
|
||||
$table->foreign('payment_method')->references('slug')->on('payment_methods')->restrictOnDelete()->cascadeOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('event_participants', function (Blueprint $table) {
|
||||
$table->dropForeign(['payment_method']);
|
||||
$table->dropColumn('payment_method');
|
||||
});
|
||||
}
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('available_payment_methods', function (Blueprint $table) {
|
||||
$table->json('configuration')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('available_payment_methods', function (Blueprint $table) {
|
||||
$table->dropColumn('configuration');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->json('configuration')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->dropColumn('configuration');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Reparatur-Migration für eine Drift in event_payment_methods:
|
||||
*
|
||||
* Eine frühere Version von 2026_07_28_140020_create_event_payment_methods hatte die Verknüpfung
|
||||
* über available_payment_method_id (FK auf available_payment_methods.id) modelliert. Die Migration
|
||||
* wurde später in-place auf slug (FK auf payment_methods.slug) umgestellt -- Systeme, die noch die
|
||||
* alte Version ausgeführt haben, tragen daher available_payment_method_id statt slug.
|
||||
*
|
||||
* Diese Migration konvertiert solche Systeme verlustfrei auf slug. Auf Systemen, die bereits die
|
||||
* korrekte slug-Struktur haben (frische Installationen), ist sie ein No-Op.
|
||||
*/
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
// Frisch / bereits korrekt -> nichts zu tun.
|
||||
if (!Schema::hasColumn('event_payment_methods', 'available_payment_method_id')
|
||||
|| Schema::hasColumn('event_payment_methods', 'slug')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. slug zunächst nullable anlegen (für den Backfill).
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->string('slug')->nullable()->after('event_id');
|
||||
});
|
||||
|
||||
// 2. slug aus der verknüpften available_payment_methods-Zeile übernehmen.
|
||||
DB::statement('
|
||||
UPDATE event_payment_methods epm
|
||||
JOIN available_payment_methods apm ON apm.id = epm.available_payment_method_id
|
||||
SET epm.slug = apm.slug
|
||||
');
|
||||
|
||||
// 3. Alte Spalte samt FK entfernen.
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->dropForeign(['available_payment_method_id']);
|
||||
$table->dropColumn('available_payment_method_id');
|
||||
});
|
||||
|
||||
// 4. slug final absichern: NOT NULL, Unique (event_id, slug), FK auf payment_methods.slug.
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->string('slug')->nullable(false)->change();
|
||||
$table->unique(['event_id', 'slug']);
|
||||
$table->foreign('slug')->references('slug')->on('payment_methods')->restrictOnDelete()->cascadeOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Nur umkehren, wenn tatsächlich die slug-Struktur vorliegt.
|
||||
if (!Schema::hasColumn('event_payment_methods', 'slug')
|
||||
|| Schema::hasColumn('event_payment_methods', 'available_payment_method_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('available_payment_method_id')->nullable()->after('event_id');
|
||||
});
|
||||
|
||||
// Backfill über den Tenant des Events, da available_payment_methods pro (tenant, slug) eindeutig ist.
|
||||
DB::statement('
|
||||
UPDATE event_payment_methods epm
|
||||
JOIN events e ON e.id = epm.event_id
|
||||
JOIN available_payment_methods apm ON apm.slug = epm.slug AND apm.tenant = e.tenant
|
||||
SET epm.available_payment_method_id = apm.id
|
||||
');
|
||||
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->dropForeign(['slug']);
|
||||
$table->dropUnique(['event_id', 'slug']);
|
||||
$table->dropColumn('slug');
|
||||
});
|
||||
|
||||
Schema::table('event_payment_methods', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('available_payment_method_id')->nullable(false)->change();
|
||||
$table->foreign('available_payment_method_id')->references('id')->on('available_payment_methods')->cascadeOnUpdate();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('payment_status', function (Blueprint $table) {
|
||||
$table->string('slug')->primary();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_status');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('event_participants', function (Blueprint $table) {
|
||||
// Payer-seitige Eingaben der gewählten Zahlungsart (Schema je Modul: getParticipantOptions()).
|
||||
$table->json('payment_options')->nullable()->after('payment_method');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('event_participants', function (Blueprint $table) {
|
||||
$table->dropColumn('payment_options');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -144,6 +144,10 @@ th:after {
|
||||
content: ":";
|
||||
}
|
||||
|
||||
.empty:after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
#show_username {
|
||||
position: relative;
|
||||
top: -30px;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Kuratierte Liste zahlungsrelevanter Font-Awesome-Solid-Icons für die Symbol-Auswahl einer
|
||||
// Zahlungsart. Die Namen sind über app/Views/Components/Icon.vue (free-solid) gedeckt und werden
|
||||
// beim Build gebündelt (kein Netzwerk-Load). value === icon (FA-Solid-Name im kebab-case).
|
||||
export const PAYMENT_METHOD_ICONS = [
|
||||
{value: 'building-columns', label: 'Bank / Überweisung', icon: 'building-columns'},
|
||||
{value: 'money-bill-wave', label: 'Bargeld', icon: 'money-bill-wave'},
|
||||
{value: 'credit-card', label: 'Kreditkarte', icon: 'credit-card'},
|
||||
{value: 'wallet', label: 'Geldbörse', icon: 'wallet'},
|
||||
{value: 'coins', label: 'Münzen', icon: 'coins'},
|
||||
{value: 'euro-sign', label: 'Euro', icon: 'euro-sign'},
|
||||
{value: 'hand-holding-dollar', label: 'Spende', icon: 'hand-holding-dollar'},
|
||||
{value: 'sack-dollar', label: 'Geldsack', icon: 'sack-dollar'},
|
||||
{value: 'money-check-dollar', label: 'Scheck', icon: 'money-check-dollar'},
|
||||
{value: 'receipt', label: 'Beleg', icon: 'receipt'},
|
||||
{value: 'piggy-bank', label: 'Sparschwein', icon: 'piggy-bank'},
|
||||
{value: 'mobile-screen', label: 'Mobil / App', icon: 'mobile-screen'},
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<p>
|
||||
Für die Veranstaltung "{{ $eventTitle }}" wurde die letzte aktive Zahlungsmöglichkeit deaktiviert.
|
||||
</p>
|
||||
<p>
|
||||
Die Anmeldung für diese Veranstaltung wurde deshalb automatisch deaktiviert, da aktuell keine
|
||||
Zahlungsmöglichkeit mehr zur Verfügung steht.
|
||||
</p>
|
||||
<p>
|
||||
Bitte aktiviert mindestens eine Zahlungsmöglichkeit für diese Veranstaltung, um die Anmeldung wieder
|
||||
zu ermöglichen.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -38,14 +38,9 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@if ($paymentRequired)
|
||||
@if ($paymentSummary['hasPaymentInformation'])
|
||||
<p>
|
||||
Deine Teilnahme ist <strong>noch nicht bestätigt,</strong> da dsies erst nach vollständigem Zahlungseingang der
|
||||
Fall ist.
|
||||
Bitte zahle den Betrag in Höhe von <strong>{{$amount}}</strong> bis zum <strong>{{$paymentFinalDate}},</strong>
|
||||
da andernfalls die Stornierung deiner Anmeldung erfolgen kann.
|
||||
|
||||
Um deine Anmeldung zu vervollständigen, überweise den Betrag bitte zugunsten folgender Bankverbindung:
|
||||
Zu deiner Anmeldung liegen noch folgende Zahlungsinformationen vor:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -36,14 +36,11 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@if ($paymentRequired)
|
||||
@if ($paymentSummary['hasPaymentInformation'])
|
||||
<p>
|
||||
Wahrscheinlich hast du vergessen, deinen Teilnahmebeitrag zu überweisen, sodass deine Anmeldung leider <strong>noch nicht bestätigt,</strong> werden konnte.
|
||||
|
||||
Um deine Anmeldung zu bestätigen, zahle bitte den Betrag in Höhe von <strong>{{$amount}}</strong> bis zum <strong>{{$paymentFinalDate}},</strong>
|
||||
da andernfalls die Stornierung deiner Anmeldung erfolgen kann.
|
||||
|
||||
Um deine Anmeldung zu vervollständigen, überweise den Betrag bitte zugunsten folgender Bankverbindung:
|
||||
Wahrscheinlich hast du vergessen, deinen Teilnahmebeitrag zu zahlen, sodass deine Anmeldung leider
|
||||
<strong>noch nicht bestätigt</strong> werden konnte. Bitte hole die Zahlung anhand der folgenden
|
||||
Zahlungsinformationen nach:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1,72 +1,7 @@
|
||||
<table cellpadding="0" cellspacing="0" border="0"
|
||||
style="width: 100%; max-width: 640px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; color: #1f2937;">
|
||||
<tr>
|
||||
<td style="padding: 8px 12px; width: 180px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
|
||||
Kontoinhaber*in
|
||||
</td>
|
||||
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">
|
||||
{{ $accountOwner }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 12px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
|
||||
IBAN
|
||||
</td>
|
||||
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb; font-family: monospace;">
|
||||
{{ $accountIban }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 12px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
|
||||
Verwendungszweck
|
||||
</td>
|
||||
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">
|
||||
{{ $paymentPurpose }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 10px 12px; font-weight: 700; color: #111827; border-top: 2px solid #d1d5db;">
|
||||
Betrag
|
||||
</td>
|
||||
<td style="padding: 10px 12px; font-weight: 700; color: #111827; border-top: 2px solid #d1d5db;">
|
||||
{{ $amount }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@php
|
||||
$girocodeSrc = $message->embedData($girocodeBinary, 'girocode.png', 'image/png');
|
||||
@endphp
|
||||
<table style="margin: 20px;">
|
||||
<tr style="vertical-align: top; background-color: #eaeaea; border-spacing: 0">
|
||||
|
||||
<td style="padding: 20px; text-align: center; font-weight: bold;">
|
||||
<strong>
|
||||
Bequem überweisen mit QR-Code
|
||||
</strong><br/><br/>
|
||||
|
||||
<img
|
||||
style="padding-left: 20px;width: 150px; height: 150px;"
|
||||
src="{{ $girocodeSrc }}"
|
||||
alt="Giro-Code">
|
||||
</td>
|
||||
<td>
|
||||
<p style="padding-left:10px; padding-right: 10px; text-align: left;">
|
||||
<strong>Und so funktioniert es</strong><br/>
|
||||
<ul style="text-align: left; list-style: decimal; font-weight: normal">
|
||||
<li style="padding-right: 10px;">Mache einen Screenshot des QR-Codes</li>
|
||||
<li style="padding-right: 10px;">Öffne deine Banking-App und wähle den Menüpunkt
|
||||
„(Foto-)Überweisung“.
|
||||
</li>
|
||||
<li style="padding-right: 10px;">Wähle das gespeicherte Bild aus</li>
|
||||
</ul>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
Bitte zahle immer mit dem vorgegeben Betreff, damit deine Zahlung möglichst einfach zugeordnet werden kann.<br/>
|
||||
Sollte die Zahlung innerhalb dieser Frist nicht oder nur teilweise möglich sein, kontaktiere bitte die
|
||||
Aktionsleitung, sodass wir eine gemeinsame Lösung finden können.
|
||||
</p>
|
||||
{{-- Der Zahlungs-Block kommt fertig aus dem Zahlungsmodul ($paymentSummary['html']). Hier wird lediglich
|
||||
der GiroCode-Binary (falls vorhanden) als Inline-CID bereitgestellt, damit das im Modul-HTML
|
||||
referenzierte cid:girocode.png in der Mail auflöst. --}}
|
||||
@if (!empty($girocodeBinary))
|
||||
@php $message->embedData($girocodeBinary, 'girocode.png', 'image/png'); @endphp
|
||||
@endif
|
||||
{!! $paymentSummary['html'] !!}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
{{-- Zahlungs-Block der Überweisung -- MAIL-Kontext. E-Mail-taugliches Markup (Inline-Styles, Tabellen).
|
||||
$giroCodeSrc: Bildquelle des GiroCodes (cid:) -- null, wenn kein GiroCode. --}}
|
||||
<table cellpadding="0" cellspacing="0" border="0"
|
||||
style="width: 100%; max-width: 640px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; color: #1f2937;">
|
||||
<tr>
|
||||
<td style="padding: 8px 12px; width: 180px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
|
||||
Kontoinhaber
|
||||
</td>
|
||||
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">{{ $accountOwner }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 12px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">IBAN</td>
|
||||
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb; font-family: monospace;">{{ $iban }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 12px; font-weight: 600; color: #4b5563; border-bottom: 1px solid #e5e7eb;">
|
||||
Verwendungszweck
|
||||
</td>
|
||||
<td style="padding: 8px 12px; border-bottom: 1px solid #e5e7eb;">{{ $paymentPurpose }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 10px 12px; font-weight: 700; color: #111827; border-top: 2px solid #d1d5db;">Betrag</td>
|
||||
<td style="padding: 10px 12px; font-weight: 700; color: #111827; border-top: 2px solid #d1d5db;">{{ $amount }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@if ($giroCodeSrc)
|
||||
<table style="margin: 20px 0; border-collapse: collapse;">
|
||||
<tr style="vertical-align: top; background-color: #eaeaea;">
|
||||
<td style="padding: 20px; text-align: center; font-weight: bold;">
|
||||
<strong>Bequem überweisen mit QR-Code</strong><br/><br/>
|
||||
<img src="{{ $giroCodeSrc }}" alt="Giro-Code" style="width: 150px; height: 150px;"/>
|
||||
</td>
|
||||
<td style="padding: 10px 16px;">
|
||||
<strong>Und so funktioniert es</strong>
|
||||
<ol style="text-align: left; font-weight: normal; margin: 8px 0 0 18px; padding: 0;">
|
||||
<li style="margin-bottom: 4px;">Öffne deine Banking-App und wähle „(Foto-)Überweisung“.</li>
|
||||
<li style="margin-bottom: 4px;">Scanne den QR-Code (oder wähle einen Screenshot davon aus).</li>
|
||||
<li>Prüfe die Daten und gib die Überweisung frei.</li>
|
||||
</ol>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p style="margin: 8px 0;">
|
||||
<a href="{{ $reminderUrl }}">Zahlungserinnerung in den Kalender setzen</a>
|
||||
</p>
|
||||
@endif
|
||||
|
||||
<p style="margin: 12px 0 0;">
|
||||
Bitte zahle immer mit dem vorgegebenen Verwendungszweck, damit deine Zahlung eindeutig zugeordnet werden kann.
|
||||
</p>
|
||||
|
||||
@if ($paymentDeadline)
|
||||
<p style="margin: 12px 0 0;">
|
||||
Bitte beachte, dass deine Anmeldung erst nach vollständigem Zahlungseingang bestätigt ist. Erfolgt dieser nicht
|
||||
bis zum <strong>{{ $paymentDeadline }}</strong>, kann deine Anmeldung storniert werden. Solltest du den Betrag
|
||||
bis dahin nicht oder nur teilweise zahlen können, kontaktiere bitte die Aktionsleitung, damit wir eine
|
||||
gemeinsame Lösung finden können.
|
||||
</p>
|
||||
@endif
|
||||
@@ -0,0 +1,57 @@
|
||||
{{-- Zahlungs-Block der Überweisung -- WEB-Kontext. Nutzt globale SPA-Klassen (form-table, link) aus
|
||||
SignupForm.vue; wird per v-html in SubmitSuccess.vue ausgegeben.
|
||||
$giroCodeSrc: Bildquelle des GiroCodes (Web-Endpoint) -- null, wenn kein GiroCode. --}}
|
||||
<table class="form-table" style="margin-bottom: 16px;">
|
||||
<tr>
|
||||
<td>Kontoinhaber:</td>
|
||||
<td>{{ $accountOwner }}</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IBAN:</td>
|
||||
<td>{{ $iban }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Verwendungszweck:</td>
|
||||
<td>{{ $paymentPurpose }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Betrag:</td>
|
||||
<td><strong>{{ $amount }}</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@if ($giroCodeSrc)
|
||||
<div style="display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px;">
|
||||
<div style="text-align: center;">
|
||||
<img src="{{ $giroCodeSrc }}" alt="Giro-Code" style="max-width: 180px;"/>
|
||||
<span style="display: block; font-size: 0.8rem; color: #6b7280; margin-top: 4px;">Giro-Code</span>
|
||||
</div>
|
||||
<div>
|
||||
<strong>Bequem überweisen mit QR-Code</strong>
|
||||
<ol style="margin: 8px 0 0 18px; padding: 0;">
|
||||
<li>Öffne deine Banking-App und wähle „(Foto-)Überweisung“.</li>
|
||||
<li>Scanne den QR-Code (oder wähle einen Screenshot davon aus).</li>
|
||||
<li>Prüfe die Daten und gib die Überweisung frei.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p style="margin: 8px 0;">
|
||||
<a class="link" href="{{ $reminderUrl }}">Zahlungserinnerung in den Kalender setzen</a>
|
||||
</p>
|
||||
@endif
|
||||
|
||||
<p style="margin: 12px 0 0;">
|
||||
Bitte zahle immer mit dem vorgegebenen Verwendungszweck, damit deine Zahlung eindeutig zugeordnet werden kann.
|
||||
</p>
|
||||
|
||||
@if ($paymentDeadline)
|
||||
<p style="margin: 12px 0 0;">
|
||||
Bitte beachte, dass deine Anmeldung erst nach vollständigem Zahlungseingang bestätigt ist. Erfolgt dieser nicht
|
||||
bis zum <strong>{{ $paymentDeadline }}</strong>, kann deine Anmeldung storniert werden. Solltest du den Betrag
|
||||
bis dahin nicht oder nur teilweise zahlen können, kontaktiere bitte die Aktionsleitung, damit wir eine
|
||||
gemeinsame Lösung finden können.
|
||||
</p>
|
||||
@endif
|
||||
@@ -0,0 +1,4 @@
|
||||
{{-- Barzahlung/Sonstiges -- MAIL-Kontext. E-Mail-tauglicher Rahmen um den nutzerdefinierten Freitext (richtext). --}}
|
||||
<div style="font-family: Arial, sans-serif; font-size: 14px; color: #1f2937; line-height: 1.5;">
|
||||
{!! $paymentInformation !!}
|
||||
</div>
|
||||
@@ -0,0 +1,4 @@
|
||||
{{-- Barzahlung/Sonstiges -- WEB-Kontext. Inhalt ist der nutzerdefinierte Freitext (richtext, HTML). --}}
|
||||
<div class="payment-information">
|
||||
{!! $paymentInformation !!}
|
||||
</div>
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\EfzStatus;
|
||||
use App\Enumerations\FirstAidPermission;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Enumerations\SwimmingPermission;
|
||||
use App\EventPaymentModules\DTO\RegistrationRenderContext;
|
||||
use App\EventPaymentModules\ProvidesGiroCode;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\Tenant;
|
||||
use App\RelationModels\EventPaymentMethods;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EventParticipantPaymentSummaryTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Tenant $tenant;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->tenant = Tenant::create([
|
||||
'slug' => 'tv', 'name' => 'Test', 'email' => 't@example.com', 'email_finance' => 'f@example.com',
|
||||
'url' => 'test.local', 'account_name' => 'Test e.V.', 'account_iban' => 'DE00', 'account_bic' => 'XY',
|
||||
'city' => 'Stadt', 'postcode' => '00000', 'is_active_local_group' => true, 'has_active_instance' => true,
|
||||
]);
|
||||
app()->instance('tenant', $this->tenant);
|
||||
|
||||
PaymentMethod::create(['slug' => PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION]);
|
||||
PaymentMethod::create(['slug' => PaymentMethod::PAYMENT_NOT_DEFINED]);
|
||||
|
||||
DB::table('participation_fee_types')->insert(['slug' => 'FIXED', 'name' => 'Fixed', 'created_at' => now(), 'updated_at' => now()]);
|
||||
ParticipationType::create(['slug' => ParticipationType::PARTICIPATION_TYPE_PARTICIPANT, 'name' => 'Teilnehmende']);
|
||||
EfzStatus::create(['slug' => EfzStatus::EFZ_STATUS_NOT_CHECKED, 'name' => 'Nicht geprüft']);
|
||||
SwimmingPermission::create(['slug' => SwimmingPermission::SWIMMING_PERMISSION_ALLOWED, 'name' => 'Darf baden', 'short' => 'Erteilt']);
|
||||
FirstAidPermission::create(['slug' => FirstAidPermission::FIRST_AID_PERMISSION_ALLOWED, 'name' => 'Zugestimmt', 'description' => '']);
|
||||
EatingHabit::create(['slug' => EatingHabit::EATING_HABIT_OMNIVOR, 'name' => 'Omnivor']);
|
||||
}
|
||||
|
||||
private function createEventWithTransfer(array $config): Event
|
||||
{
|
||||
$event = Event::create([
|
||||
'tenant' => $this->tenant->slug, 'name' => 'Event', 'identifier' => 'evt-1', 'location' => 'Ort',
|
||||
'postal_code' => '00000', 'email' => 'e@example.com', 'start_date' => '2026-08-01', 'end_date' => '2026-08-05',
|
||||
'early_bird_end' => '2026-07-01', 'registration_final_end' => '2026-07-20', 'early_bird_end_amount_increase' => 0,
|
||||
'account_owner' => 'Owner', 'account_iban' => 'DE00', 'participation_fee_type' => 'FIXED',
|
||||
'pay_per_day' => false, 'pay_direct' => false,
|
||||
]);
|
||||
|
||||
AvailablePaymentMethod::create([
|
||||
'tenant' => $this->tenant->slug, 'slug' => PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION,
|
||||
'name' => 'Überweisung', 'active' => true, 'configuration' => $config,
|
||||
]);
|
||||
|
||||
EventPaymentMethods::create([
|
||||
'event_id' => $event->id,
|
||||
'slug' => PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION,
|
||||
'configuration' => $config,
|
||||
]);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
private function createParticipant(Event $event, float $amount, string $paymentMethod = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION): EventParticipant
|
||||
{
|
||||
return EventParticipant::create([
|
||||
'tenant' => $this->tenant->slug, 'event_id' => $event->id, 'identifier' => 'p-1',
|
||||
'firstname' => 'Hans', 'lastname' => 'Muster', 'participation_type' => ParticipationType::PARTICIPATION_TYPE_PARTICIPANT,
|
||||
'birthday' => '2000-01-01', 'address_1' => 'Weg 1', 'postcode' => '00000', 'city' => 'Stadt',
|
||||
'email_1' => 'h@example.com', 'phone_1' => '123', 'arrival_date' => '2026-08-01', 'departure_date' => '2026-08-05',
|
||||
'arrival_eating' => 0, 'departure_eating' => 0, 'amount' => $amount, 'payment_purpose' => 'Event - Beitrag Hans Muster',
|
||||
'efz_status' => EfzStatus::EFZ_STATUS_NOT_CHECKED, 'payment_method' => $paymentMethod,
|
||||
'swimming_permission' => SwimmingPermission::SWIMMING_PERMISSION_ALLOWED,
|
||||
'first_aid_permission' => FirstAidPermission::FIRST_AID_PERMISSION_ALLOWED,
|
||||
'eating_habit' => EatingHabit::EATING_HABIT_OMNIVOR,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_transfer_module_produces_giro_code(): void
|
||||
{
|
||||
$event = $this->createEventWithTransfer(['account_owner' => 'Kasse', 'iban' => 'DE-EVENT']);
|
||||
$participant = $this->createParticipant($event, 50.0);
|
||||
|
||||
$module = $participant->paymentModule();
|
||||
$this->assertInstanceOf(ProvidesGiroCode::class, $module);
|
||||
|
||||
$giro = $module->giroCode($participant, $participant->paymentConfiguration());
|
||||
$this->assertNotNull($giro);
|
||||
$this->assertNotSame('', $giro);
|
||||
}
|
||||
|
||||
public function test_cash_module_provides_no_giro_code(): void
|
||||
{
|
||||
$event = $this->createEventWithTransfer(['account_owner' => 'Kasse', 'iban' => 'DE-EVENT']);
|
||||
$participant = $this->createParticipant($event, 50.0, PaymentMethod::PAYMENT_NOT_DEFINED);
|
||||
|
||||
$this->assertNotInstanceOf(ProvidesGiroCode::class, $participant->paymentModule());
|
||||
}
|
||||
|
||||
public function test_payment_configuration_resolves_event_pivot_config(): void
|
||||
{
|
||||
$event = $this->createEventWithTransfer(['account_owner' => 'Kasse', 'iban' => 'DE-EVENT']);
|
||||
$participant = $this->createParticipant($event, 50.0);
|
||||
|
||||
$config = $participant->paymentConfiguration();
|
||||
|
||||
$this->assertSame('DE-EVENT', $config['iban']);
|
||||
$this->assertSame('Kasse', $config['account_owner']);
|
||||
}
|
||||
|
||||
public function test_payment_summary_renders_html_from_resolved_config(): void
|
||||
{
|
||||
$event = $this->createEventWithTransfer(['account_owner' => 'Kasse', 'iban' => 'DE-EVENT']);
|
||||
$participant = $this->createParticipant($event, 50.0);
|
||||
|
||||
// Web-Kontext: SPA-Markup (form-table), IBAN aus der Config + GiroCode-Bild über den Endpoint.
|
||||
$web = $participant->paymentSummary(RegistrationRenderContext::Web);
|
||||
$this->assertTrue($web->hasPaymentInformation);
|
||||
$this->assertStringContainsString('DE-EVENT', $web->html);
|
||||
$this->assertStringContainsString('/print-girocode/', $web->html);
|
||||
$this->assertStringContainsString('class="form-table"', $web->html);
|
||||
|
||||
// Mail-Kontext: E-Mail-Markup (Inline-Styles), GiroCode als inline-CID.
|
||||
$mail = $participant->paymentSummary(RegistrationRenderContext::Mail);
|
||||
$this->assertStringContainsString('cid:girocode.png', $mail->html);
|
||||
$this->assertStringContainsString('style="', $mail->html);
|
||||
$this->assertStringNotContainsString('class="form-table"', $mail->html);
|
||||
}
|
||||
|
||||
public function test_cash_summary_renders_configured_text(): void
|
||||
{
|
||||
$event = $this->createEventWithTransfer(['account_owner' => 'Kasse', 'iban' => 'DE-EVENT']);
|
||||
|
||||
$cashConfig = ['payment_information' => '<p>Bitte bar vor Ort zahlen.</p>'];
|
||||
AvailablePaymentMethod::create([
|
||||
'tenant' => $this->tenant->slug, 'slug' => PaymentMethod::PAYMENT_NOT_DEFINED,
|
||||
'name' => 'Barzahlung', 'active' => true, 'configuration' => $cashConfig,
|
||||
]);
|
||||
EventPaymentMethods::create([
|
||||
'event_id' => $event->id, 'slug' => PaymentMethod::PAYMENT_NOT_DEFINED, 'configuration' => $cashConfig,
|
||||
]);
|
||||
|
||||
$participant = $this->createParticipant($event, 50.0, PaymentMethod::PAYMENT_NOT_DEFINED);
|
||||
|
||||
$summary = $participant->paymentSummary(RegistrationRenderContext::Web);
|
||||
$this->assertTrue($summary->hasPaymentInformation);
|
||||
$this->assertStringContainsString('Bitte bar vor Ort zahlen.', $summary->html);
|
||||
$this->assertStringContainsString('class="payment-information"', $summary->html);
|
||||
}
|
||||
|
||||
public function test_paid_participant_has_no_payment_information(): void
|
||||
{
|
||||
$event = $this->createEventWithTransfer(['account_owner' => 'Kasse', 'iban' => 'DE-EVENT']);
|
||||
$participant = $this->createParticipant($event, 50.0);
|
||||
$participant->amount_paid = 50.0;
|
||||
$participant->save();
|
||||
|
||||
$this->assertFalse($participant->paymentSummary()->hasPaymentInformation);
|
||||
}
|
||||
|
||||
public function test_resource_exposes_payment_summary(): void
|
||||
{
|
||||
$event = $this->createEventWithTransfer(['account_owner' => 'Kasse', 'iban' => 'DE-EVENT']);
|
||||
$participant = $this->createParticipant($event, 50.0);
|
||||
|
||||
$array = $participant->toResource()->toArray(request());
|
||||
|
||||
$this->assertTrue($array['paymentSummary']['hasPaymentInformation']);
|
||||
$this->assertStringContainsString('DE-EVENT', $array['paymentSummary']['html']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domains\Admin\Actions\UpdateAvailablePaymentMethod\UpdateAvailablePaymentMethodAction;
|
||||
use App\Domains\Admin\Actions\UpdateAvailablePaymentMethod\UpdateAvailablePaymentMethodRequest;
|
||||
use App\Domains\Event\Actions\SetPaymentMethods\SetPaymentMethodsCommand;
|
||||
use App\Domains\Event\Actions\SetPaymentMethods\SetPaymentMethodsRequest;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\Event;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PaymentMethodConfigurationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Tenant $tenant;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->tenant = Tenant::create([
|
||||
'slug' => 'tv',
|
||||
'name' => 'Test',
|
||||
'email' => 't@example.com',
|
||||
'email_finance' => 'finance@example.com',
|
||||
'url' => 'test.local',
|
||||
'account_name' => 'Test e.V.',
|
||||
'account_iban' => 'DE00',
|
||||
'account_bic' => 'XY',
|
||||
'city' => 'Stadt',
|
||||
'postcode' => '00000',
|
||||
'is_active_local_group' => true,
|
||||
'has_active_instance' => true,
|
||||
]);
|
||||
|
||||
app()->instance('tenant', $this->tenant);
|
||||
|
||||
PaymentMethod::create(['slug' => PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION]);
|
||||
PaymentMethod::create(['slug' => PaymentMethod::PAYMENT_NOT_DEFINED]);
|
||||
|
||||
DB::table('participation_fee_types')->insert([
|
||||
'slug' => 'FIXED',
|
||||
'name' => 'Fixed',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
private function availableMethod(string $slug, bool $active = false, array $config = []): AvailablePaymentMethod
|
||||
{
|
||||
return AvailablePaymentMethod::create([
|
||||
'tenant' => $this->tenant->slug,
|
||||
'slug' => $slug,
|
||||
'name' => 'Konto',
|
||||
'description' => null,
|
||||
'active' => $active,
|
||||
'configuration' => $config,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_activation_is_blocked_when_required_options_missing(): void
|
||||
{
|
||||
$method = $this->availableMethod(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
|
||||
|
||||
$response = new UpdateAvailablePaymentMethodAction(new UpdateAvailablePaymentMethodRequest(
|
||||
availablePaymentMethod: $method,
|
||||
name: 'Konto',
|
||||
description: null,
|
||||
active: true,
|
||||
configuration: ['iban' => 'DE123'], // account_owner fehlt
|
||||
))->execute();
|
||||
|
||||
$this->assertFalse($response->success);
|
||||
$this->assertFalse($method->fresh()->active);
|
||||
}
|
||||
|
||||
public function test_activation_succeeds_when_configuration_complete(): void
|
||||
{
|
||||
$method = $this->availableMethod(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
|
||||
|
||||
$response = new UpdateAvailablePaymentMethodAction(new UpdateAvailablePaymentMethodRequest(
|
||||
availablePaymentMethod: $method,
|
||||
name: 'Konto',
|
||||
description: null,
|
||||
active: true,
|
||||
configuration: ['iban' => 'DE123', 'account_owner' => 'Kasse', 'bic' => 'XY', 'evil' => 'x'],
|
||||
))->execute();
|
||||
|
||||
$this->assertTrue($response->success);
|
||||
|
||||
$fresh = $method->fresh();
|
||||
$this->assertTrue($fresh->active);
|
||||
$this->assertSame('DE123', $fresh->configuration['iban']);
|
||||
$this->assertArrayNotHasKey('evil', $fresh->configuration); // unbekannte Keys verworfen
|
||||
}
|
||||
|
||||
public function test_event_assignment_copies_snapshot_and_preserves_overrides(): void
|
||||
{
|
||||
$this->availableMethod(
|
||||
PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION,
|
||||
active: true,
|
||||
config: ['iban' => 'DE-TENANT', 'account_owner' => 'Kasse'],
|
||||
);
|
||||
|
||||
$event = $this->createEvent();
|
||||
|
||||
// 1. Zuweisung -> Snapshot der Tenant-Config landet im Pivot.
|
||||
$this->runUpdateEvent($event, [PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION]);
|
||||
|
||||
$pivotConfig = $event->fresh()->paymentMethods()->first()->pivot->configuration;
|
||||
$this->assertSame('DE-TENANT', $pivotConfig['iban']);
|
||||
|
||||
// 2. Pro-Event-Override setzen.
|
||||
$this->runUpdateEvent($event, [PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION], [
|
||||
PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION => ['iban' => 'DE-EVENT', 'account_owner' => 'Kasse'],
|
||||
]);
|
||||
$this->assertSame('DE-EVENT', $event->fresh()->paymentMethods()->first()->pivot->configuration['iban']);
|
||||
|
||||
// 3. Erneutes Speichern OHNE Override -> Override bleibt erhalten (kein Reset-Wipe).
|
||||
$this->runUpdateEvent($event, [PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION]);
|
||||
$this->assertSame('DE-EVENT', $event->fresh()->paymentMethods()->first()->pivot->configuration['iban']);
|
||||
}
|
||||
|
||||
private function createEvent(): Event
|
||||
{
|
||||
return Event::create([
|
||||
'tenant' => $this->tenant->slug,
|
||||
'name' => 'Event',
|
||||
'identifier' => 'evt-1',
|
||||
'location' => 'Ort',
|
||||
'postal_code' => '00000',
|
||||
'email' => 'e@example.com',
|
||||
'start_date' => '2026-08-01',
|
||||
'end_date' => '2026-08-05',
|
||||
'early_bird_end' => '2026-07-01',
|
||||
'registration_final_end' => '2026-07-20',
|
||||
'early_bird_end_amount_increase' => 0,
|
||||
'account_owner' => 'Owner',
|
||||
'account_iban' => 'DE00',
|
||||
'participation_fee_type' => 'FIXED',
|
||||
'pay_per_day' => false,
|
||||
'pay_direct' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $slugs
|
||||
* @param array<string, array<string, mixed>> $configs
|
||||
*/
|
||||
private function runUpdateEvent(Event $event, array $slugs, array $configs = []): void
|
||||
{
|
||||
$request = new SetPaymentMethodsRequest($event, $slugs, $configs);
|
||||
|
||||
$response = new SetPaymentMethodsCommand($request)->execute();
|
||||
$this->assertTrue($response->success, $response->message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domains\Event\Actions\SignUp\SignUpCommand;
|
||||
use App\Domains\Event\Actions\SignUp\SignUpRequest;
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\EfzStatus;
|
||||
use App\Enumerations\FirstAidPermission;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Enumerations\SwimmingPermission;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\Event;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\Tenant;
|
||||
use App\Resources\AvailablePaymentMethodResource;
|
||||
use App\ValueObjects\Amount;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SignUpPaymentOptionsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Tenant $tenant;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->tenant = Tenant::create([
|
||||
'slug' => 'tv', 'name' => 'Test', 'email' => 't@example.com', 'email_finance' => 'f@example.com',
|
||||
'url' => 'test.local', 'account_name' => 'Test e.V.', 'account_iban' => 'DE00', 'account_bic' => 'XY',
|
||||
'city' => 'Stadt', 'postcode' => '00000', 'is_active_local_group' => true, 'has_active_instance' => true,
|
||||
]);
|
||||
app()->instance('tenant', $this->tenant);
|
||||
|
||||
PaymentMethod::create(['slug' => PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION]);
|
||||
DB::table('participation_fee_types')->insert(['slug' => 'FIXED', 'name' => 'Fixed', 'created_at' => now(), 'updated_at' => now()]);
|
||||
ParticipationType::create(['slug' => ParticipationType::PARTICIPATION_TYPE_PARTICIPANT, 'name' => 'Teilnehmende']);
|
||||
EfzStatus::create(['slug' => EfzStatus::EFZ_STATUS_NOT_CHECKED, 'name' => 'Nicht geprüft']);
|
||||
EfzStatus::create(['slug' => EfzStatus::EFZ_STATUS_NOT_REQUIRED, 'name' => 'Nicht erforderlich']);
|
||||
SwimmingPermission::create(['slug' => SwimmingPermission::SWIMMING_PERMISSION_ALLOWED, 'name' => 'Darf baden', 'short' => 'Erteilt']);
|
||||
FirstAidPermission::create(['slug' => FirstAidPermission::FIRST_AID_PERMISSION_ALLOWED, 'name' => 'Zugestimmt', 'description' => '']);
|
||||
EatingHabit::create(['slug' => EatingHabit::EATING_HABIT_VEGAN, 'name' => 'Vegan']);
|
||||
}
|
||||
|
||||
private function createEvent(): Event
|
||||
{
|
||||
return Event::create([
|
||||
'tenant' => $this->tenant->slug, 'name' => 'Event', 'identifier' => 'evt-1', 'location' => 'Ort',
|
||||
'postal_code' => '00000', 'email' => 'e@example.com', 'start_date' => '2026-08-01', 'end_date' => '2026-08-05',
|
||||
'early_bird_end' => '2026-07-01', 'registration_final_end' => '2026-07-20', 'early_bird_end_amount_increase' => 0,
|
||||
'account_owner' => 'Owner', 'account_iban' => 'DE00', 'participation_fee_type' => 'FIXED',
|
||||
'pay_per_day' => false, 'pay_direct' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
private function signUpRequest(Event $event, array $paymentOptions): SignUpRequest
|
||||
{
|
||||
return new SignUpRequest(
|
||||
$event, null, 'Hans', 'Muster', null, ParticipationType::PARTICIPATION_TYPE_PARTICIPANT,
|
||||
$this->tenant, new \DateTime('2000-01-01'), 'Weg 1', null, '00000', 'Stadt',
|
||||
'h@example.com', '123', null, null, null, null, null, null, null,
|
||||
'vegan', null, null, false, false, false, false, false,
|
||||
new \DateTime('2026-08-01'), new \DateTime('2026-08-05'), 0, 0, null,
|
||||
new Amount(50.0, ' Euro'), PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION, $paymentOptions,
|
||||
);
|
||||
}
|
||||
|
||||
public function test_payment_options_are_sanitized_and_stored(): void
|
||||
{
|
||||
$event = $this->createEvent();
|
||||
|
||||
// Überweisung hat keine Teilnehmer-Eingaben -> alles wird verworfen, payment_options bleibt leer.
|
||||
$response = new SignUpCommand($this->signUpRequest($event, ['evil' => 'x']))->execute();
|
||||
|
||||
$this->assertTrue($response->success);
|
||||
$this->assertSame([], $response->participant->payment_options);
|
||||
// payment_purpose wird immer erzeugt (AC #4).
|
||||
$this->assertStringContainsString('Beitrag Hans Muster', $response->participant->payment_purpose);
|
||||
}
|
||||
|
||||
public function test_resource_exposes_participant_options_schema(): void
|
||||
{
|
||||
$event = $this->createEvent();
|
||||
AvailablePaymentMethod::create([
|
||||
'tenant' => $this->tenant->slug, 'slug' => PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION,
|
||||
'name' => 'Überweisung', 'active' => true, 'configuration' => ['account_owner' => 'Kasse', 'iban' => 'DE1'],
|
||||
]);
|
||||
|
||||
$method = AvailablePaymentMethod::where('slug', PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION)->first();
|
||||
$array = new AvailablePaymentMethodResource($method)->toArray(request());
|
||||
|
||||
$this->assertArrayHasKey('participantOptionsSchema', $array);
|
||||
$this->assertSame([], $array['participantOptionsSchema']); // Überweisung: keine Teilnehmer-Eingaben
|
||||
}
|
||||
|
||||
public function test_payment_methods_serialize_without_data_wrapper(): void
|
||||
{
|
||||
AvailablePaymentMethod::create([
|
||||
'tenant' => $this->tenant->slug, 'slug' => PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION,
|
||||
'name' => 'Überweisung', 'active' => true, 'configuration' => ['account_owner' => 'Kasse', 'iban' => 'DE1'],
|
||||
]);
|
||||
$method = AvailablePaymentMethod::where('slug', PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION)->first();
|
||||
|
||||
// Exakt so serialisiert EventResource die Methoden fürs Frontend.
|
||||
$serialized = collect([$method])->map(
|
||||
fn($m) => new AvailablePaymentMethodResource($m)->toArray(request())
|
||||
)->toArray();
|
||||
|
||||
// Kein data-Wrapper: slug/active liegen top-level (sonst wäre m.active im Frontend undefined -> leere Liste).
|
||||
$this->assertArrayNotHasKey('data', $serialized[0]);
|
||||
$this->assertSame(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION, $serialized[0]['slug']);
|
||||
$this->assertTrue($serialized[0]['active']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
||||
use App\EventPaymentModules\Modules\AccountTransferPaymentModule;
|
||||
use App\EventPaymentModules\Modules\UndefinedPaymentModule;
|
||||
use App\EventPaymentModules\ProvidesGiroCode;
|
||||
use App\Models\PaymentMethod;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EventPaymentModuleRegistryTest extends TestCase
|
||||
{
|
||||
public function test_for_slug_resolves_known_modules(): void
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
AccountTransferPaymentModule::class,
|
||||
EventPaymentModuleRegistry::forSlug(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION)
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
UndefinedPaymentModule::class,
|
||||
EventPaymentModuleRegistry::forSlug(PaymentMethod::PAYMENT_NOT_DEFINED)
|
||||
);
|
||||
}
|
||||
|
||||
public function test_for_slug_returns_null_for_unknown(): void
|
||||
{
|
||||
$this->assertNull(EventPaymentModuleRegistry::forSlug('DOES_NOT_EXIST'));
|
||||
}
|
||||
|
||||
public function test_slugs_lists_all_registered_modules(): void
|
||||
{
|
||||
$slugs = EventPaymentModuleRegistry::slugs();
|
||||
|
||||
$this->assertContains(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION, $slugs);
|
||||
$this->assertContains(PaymentMethod::PAYMENT_NOT_DEFINED, $slugs);
|
||||
}
|
||||
|
||||
public function test_module_option_helpers(): void
|
||||
{
|
||||
$module = new AccountTransferPaymentModule();
|
||||
|
||||
$this->assertSame(['account_owner', 'iban'], $module->requiredOptionKeys());
|
||||
// Rückgabe folgt der Schema-Reihenfolge, unbekannte Keys werden verworfen.
|
||||
$this->assertSame(
|
||||
['account_owner' => 'Kasse', 'iban' => 'DE123'],
|
||||
$module->sanitizeConfiguration(['iban' => 'DE123', 'account_owner' => 'Kasse', 'evil' => 'x'])
|
||||
);
|
||||
$this->assertFalse($module->isConfigurationComplete(['iban' => 'DE123']));
|
||||
$this->assertTrue($module->isConfigurationComplete(['iban' => 'DE123', 'account_owner' => 'Kasse']));
|
||||
}
|
||||
|
||||
public function test_participant_options_per_module(): void
|
||||
{
|
||||
// Überweisung: keine payer-seitigen Eingaben.
|
||||
$this->assertSame([], (new AccountTransferPaymentModule())->getParticipantOptions());
|
||||
|
||||
// Sonstiges: exemplarische Teilnehmer-Eingaben (Betrag + Passend-Checkbox).
|
||||
$undefined = (new UndefinedPaymentModule())->getParticipantOptions();
|
||||
$this->assertSame(['amount_brought', 'has_exact_amount'], array_column($undefined, 'name'));
|
||||
$this->assertSame('checkbox', $undefined[1]['type']);
|
||||
}
|
||||
|
||||
public function test_participant_option_helpers(): void
|
||||
{
|
||||
// Anonymes Modul mit einer Pflicht-Teilnehmereingabe.
|
||||
$module = new class extends \App\EventPaymentModules\AbstractEventPaymentModule {
|
||||
public static function slug(): string
|
||||
{
|
||||
return 'TEST';
|
||||
}
|
||||
|
||||
public function defaultName(): string
|
||||
{
|
||||
return 'Test';
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getParticipantOptions(): array
|
||||
{
|
||||
return [['name' => 'iban', 'label' => 'IBAN', 'type' => 'string', 'required' => true]];
|
||||
}
|
||||
|
||||
protected function invoiceClosingStatement(\App\EventPaymentModules\DTO\CreateInvoiceRequest $request): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
// sanitize verwirft unbekannte Keys, complete verlangt Pflichtfeld non-empty.
|
||||
$this->assertSame(['iban' => 'DE1'], $module->sanitizeParticipantOptions(['iban' => 'DE1', 'evil' => 'x']));
|
||||
$this->assertFalse($module->participantOptionsComplete([]));
|
||||
$this->assertFalse($module->participantOptionsComplete(['iban' => '']));
|
||||
$this->assertTrue($module->participantOptionsComplete(['iban' => 'DE1']));
|
||||
}
|
||||
|
||||
public function test_only_account_transfer_provides_giro_code(): void
|
||||
{
|
||||
$this->assertInstanceOf(ProvidesGiroCode::class, new AccountTransferPaymentModule());
|
||||
$this->assertNotInstanceOf(ProvidesGiroCode::class, new UndefinedPaymentModule());
|
||||
}
|
||||
|
||||
public function test_defaults_are_built_from_modules(): void
|
||||
{
|
||||
$defaults = PaymentMethod::defaults();
|
||||
|
||||
$this->assertSame('Überweisung auf Veranstaltungskonto', $defaults[PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION]['name']);
|
||||
$this->assertArrayHasKey(PaymentMethod::PAYMENT_NOT_DEFINED, $defaults);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaymentMethodOptionsTest extends TestCase
|
||||
{
|
||||
public function test_options_for_returns_schema_for_known_slug(): void
|
||||
{
|
||||
$options = PaymentMethod::optionsFor(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
|
||||
|
||||
$this->assertNotEmpty($options);
|
||||
$this->assertSame('account_owner', $options[0]['name']);
|
||||
}
|
||||
|
||||
public function test_options_for_returns_empty_for_unknown_slug(): void
|
||||
{
|
||||
$this->assertSame([], PaymentMethod::optionsFor('DOES_NOT_EXIST'));
|
||||
}
|
||||
|
||||
public function test_required_option_keys_only_returns_required(): void
|
||||
{
|
||||
$keys = PaymentMethod::requiredOptionKeys(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION);
|
||||
|
||||
$this->assertContains('account_owner', $keys);
|
||||
$this->assertContains('iban', $keys);
|
||||
$this->assertNotContains('bic', $keys); // bic ist optional
|
||||
}
|
||||
|
||||
public function test_sanitize_configuration_drops_unknown_keys(): void
|
||||
{
|
||||
$sanitized = PaymentMethod::sanitizeConfiguration(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION, [
|
||||
'iban' => 'DE123',
|
||||
'account_owner' => 'Kasse',
|
||||
'evil' => 'x',
|
||||
]);
|
||||
|
||||
$this->assertArrayHasKey('iban', $sanitized);
|
||||
$this->assertArrayHasKey('account_owner', $sanitized);
|
||||
$this->assertArrayNotHasKey('evil', $sanitized);
|
||||
}
|
||||
|
||||
public function test_is_configuration_complete_requires_all_required_options(): void
|
||||
{
|
||||
$slug = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION;
|
||||
|
||||
$this->assertFalse(PaymentMethod::isConfigurationComplete($slug, []));
|
||||
$this->assertFalse(PaymentMethod::isConfigurationComplete($slug, ['iban' => 'DE123']));
|
||||
$this->assertFalse(PaymentMethod::isConfigurationComplete($slug, ['iban' => 'DE123', 'account_owner' => '']));
|
||||
$this->assertTrue(PaymentMethod::isConfigurationComplete($slug, ['iban' => 'DE123', 'account_owner' => 'Kasse']));
|
||||
}
|
||||
|
||||
public function test_unknown_slug_is_always_complete(): void
|
||||
{
|
||||
// Kein Modul -> keine Pflichtfelder -> stets vollständig.
|
||||
$this->assertTrue(PaymentMethod::isConfigurationComplete('NO_MODULE', []));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user