Configurations for payment modules

This commit is contained in:
2026-07-29 15:49:26 +02:00
parent 8d6a4041c1
commit 78f4d813f9
19 changed files with 584 additions and 51 deletions
@@ -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,25 @@
<?php
namespace App\EventPaymentModules\DTO;
use App\Models\Event;
use App\ValueObjects\Amount;
/**
* Eingabe für {@see \App\EventPaymentModules\EventPaymentModule::registrationSummary()}.
*
* Bewusst ohne persistierten EventParticipant: Die Zusammenfassung wird im Anmeldefluss VOR dem
* Absenden erzeugt, es existiert also noch kein Teilnehmer-Datensatz.
*/
final class RegistrationSummaryRequest
{
/**
* @param array<string, mixed> $configuration Aufgelöste (pro-Event-)Konfiguration des Moduls.
*/
public function __construct(
public readonly Event $event,
public readonly Amount $amount,
public readonly array $configuration = [],
) {
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\EventPaymentModules\DTO;
/**
* Ausgabe von {@see \App\EventPaymentModules\EventPaymentModule::registrationSummary()}.
*
* Strukturierte Daten (kein reines Vue) -- speisen sowohl die Anmelde-Zusammenfassung im Frontend
* als auch spätere API-Actions. Der obere Teil der Zusammenfassung ist für alle gleich; hier kommt
* ausschließlich der zahlungsspezifische Abschnitt.
*/
final class RegistrationSummaryResponse
{
public string $title = '';
/** @var array<int, array{label: string, value: string}> Zeilen des Zahlungs-Abschnitts. */
public array $lines = [];
/** Bestätigungstext für die Checkbox, z.B. "Ich bestätige, den Betrag von X zu überweisen.". */
public ?string $confirmationLabel = null;
}