Teilnahmerechnungen erstellen

This commit is contained in:
2026-09-03 00:08:46 +02:00
parent a61344395a
commit 9c4c28e566
79 changed files with 4303 additions and 75 deletions
@@ -156,14 +156,18 @@ abstract class AbstractEventPaymentModule implements EventPaymentModule
/**
* Template-Method: Der gemeinsame Rechnungs-Rumpf wird hier gebaut, der variierende Schlusssatz
* kommt aus {@see invoiceClosingStatement()} des jeweiligen Moduls.
*
* `$request->amount` ist der noch offene Betrag. Ist nichts mehr offen, gilt unabhängig von der
* Zahlungsart derselbe Satz -- eine Zahlungsaufforderung wäre dann schlicht falsch.
*/
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);
$response->closingStatement = $request->amount->getAmount() <= 0
? 'Der Betrag ist bereits vollständig beglichen — vielen Dank.'
: $this->invoiceClosingStatement($request);
return $response;
}
@@ -171,6 +175,8 @@ abstract class AbstractEventPaymentModule implements EventPaymentModule
/**
* Der je Zahlungsart variierende Schlusssatz der Rechnung
* ("Bitte überweise bis ..." / "wird abgebucht ..." / "wurde per PayPal beglichen").
*
* Wird nur bei tatsächlich offenem Betrag aufgerufen.
*/
abstract protected function invoiceClosingStatement(CreateInvoiceRequest $request): string;
}
@@ -106,7 +106,24 @@ class AccountTransferPaymentModule extends AbstractEventPaymentModule implements
protected function invoiceClosingStatement(CreateInvoiceRequest $request): string
{
// TODO: In einer Folge-Iteration ausformulieren (z.B. "Bitte überweise bis zum ... auf IBAN ...").
return '';
$config = $request->configuration;
$deadline = $request->event->registration_final_end?->format('d.m.Y');
$sentence = $deadline !== null
? sprintf('Bitte überweise %s bis zum %s auf folgendes Konto:', $request->amount->toString(), $deadline)
: sprintf('Bitte überweise %s auf folgendes Konto:', $request->amount->toString());
$lines = [
'Kontoinhaber*in: ' . (string) ($config['account_owner'] ?? ''),
'IBAN: ' . (string) ($config['iban'] ?? ''),
];
if (($config['bic'] ?? '') !== '') {
$lines[] = 'BIC: ' . (string) $config['bic'];
}
$lines[] = 'Verwendungszweck: ' . (string) $request->participant->payment_purpose;
return $sentence . '<br />' . implode('<br />', array_map(e(...), $lines));
}
}
@@ -59,6 +59,9 @@ class UndefinedPaymentModule extends AbstractEventPaymentModule
protected function invoiceClosingStatement(CreateInvoiceRequest $request): string
{
return '';
return sprintf(
'Bitte halte den Betrag von %s in bar am ersten Tag der Veranstaltung bereit.',
$request->amount->toString()
);
}
}