From a0d26648ee0643e10f7dc251e3992942928891c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
| {{ line.label }}: | -{{ line.value }} - {{ line.value }} - | -
- |
-
| - | - Erinnerung - in Kalender setzen - | -
- Bitte beachte, dass deine Anmeldung erst nach Zahlungseiongang vollständig ist.
- Wenn dieser nicht bis zum {{ props.event.registrationFinalEnd.formatted }} erfolgt, kann deine
- Anmeldung storniert werden.
- 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.
-
Du musst keinen Beitrag überweisen. Deine Anmeldung ist bestätigt.
diff --git a/app/EventPaymentModules/CLAUDE.md b/app/EventPaymentModules/CLAUDE.md index 4398067..8961de7 100644 --- a/app/EventPaymentModules/CLAUDE.md +++ b/app/EventPaymentModules/CLAUDE.md @@ -59,13 +59,23 @@ Beispiel GiroCode (nur Überweisung): ## Anmelde-Zusammenfassung / Mail-Anzeige - `registrationSummary(RegistrationSummaryRequest): RegistrationSummaryResponse` liefert den zahlungsspezifischen - Anzeige-Block render-agnostisch: entweder `lines` (label/value, z.B. Überweisung) oder `html` (Freitext, z.B. - Barzahlung), plus `hasPaymentInformation` und `showGiroCode`. + 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()`. -- Konsumiert von `EventParticipantResource` (`paymentSummary`), `SubmitSuccess.vue`, `emails/subparts/payment.blade.php` - (+ `signup_complete`, `missing_amount`). GiroCode in Mails: **inline per CID** (`$message->embedData(...)`), im Web - über `/print-girocode/{token}` (sessionlos, lazy). + `->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 diff --git a/app/EventPaymentModules/DTO/RegistrationRenderContext.php b/app/EventPaymentModules/DTO/RegistrationRenderContext.php new file mode 100644 index 0000000..e0d2049 --- /dev/null +++ b/app/EventPaymentModules/DTO/RegistrationRenderContext.php @@ -0,0 +1,13 @@ + */ - public array $lines = []; - - /** Frei konfigurierter HTML-Text (alternativ zu $lines). */ - public ?string $html = null; - - /** Soll der GiroCode (QR) angezeigt werden? */ - public bool $showGiroCode = false; + /** Fertig gerenderter HTML-Block der Zahlungsinformationen. */ + public string $html = ''; } diff --git a/app/EventPaymentModules/Modules/AccountTransferPaymentModule.php b/app/EventPaymentModules/Modules/AccountTransferPaymentModule.php index e5572bb..a49d362 100644 --- a/app/EventPaymentModules/Modules/AccountTransferPaymentModule.php +++ b/app/EventPaymentModules/Modules/AccountTransferPaymentModule.php @@ -4,6 +4,7 @@ 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; @@ -45,15 +46,32 @@ class AccountTransferPaymentModule extends AbstractEventPaymentModule implements $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 = $amountLeft->getAmount() > 0; - $response->showGiroCode = $response->hasPaymentInformation; - $response->lines = [ - ['label' => 'Kontoinhaber', 'value' => (string)($config['account_owner'] ?? '')], - ['label' => 'IBAN', 'value' => (string)($config['iban'] ?? '')], - ['label' => 'Verwendungszweck', 'value' => (string)$participant->payment_purpose], - ['label' => 'Betrag', 'value' => $amountLeft->toString()], - ]; + $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; } diff --git a/app/EventPaymentModules/Modules/UndefinedPaymentModule.php b/app/EventPaymentModules/Modules/UndefinedPaymentModule.php index a84e655..f62ffb5 100644 --- a/app/EventPaymentModules/Modules/UndefinedPaymentModule.php +++ b/app/EventPaymentModules/Modules/UndefinedPaymentModule.php @@ -4,6 +4,7 @@ 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; @@ -33,12 +34,19 @@ class UndefinedPaymentModule extends AbstractEventPaymentModule public function registrationSummary(RegistrationSummaryRequest $request): RegistrationSummaryResponse { - $html = (string)($request->configuration['payment_information'] ?? ''); + $paymentInformation = (string)($request->configuration['payment_information'] ?? ''); $response = new RegistrationSummaryResponse(); - $response->hasPaymentInformation = trim($html) !== ''; - $response->html = $html; - $response->showGiroCode = false; + $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; } diff --git a/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php b/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php index 84c5637..2b2cea6 100644 --- a/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php +++ b/app/Mail/ParticipantParticipationMails/EventSignUpSuccessfullMail.php @@ -8,6 +8,7 @@ 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; @@ -68,6 +69,9 @@ class EventSignUpSuccessfullMail extends Mailable ? $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(); @@ -83,7 +87,7 @@ class EventSignUpSuccessfullMail extends Mailable 'departure' => $participant['departure'], 'amount' => $participant['amount_left_string'], 'paymentFinalDate' => $event['registrationFinalEnd']['formatted'], - 'paymentSummary' => $participant['paymentSummary'], + 'paymentSummary' => ['hasPaymentInformation' => $paymentSummary->hasPaymentInformation, 'html' => $paymentSummary->html], 'girocodeBinary' => $girocodeBinary, 'efzStatus' => $participant['efz_status'], 'participationIcalFilename' => $participationIcal->filename, diff --git a/app/Mail/ParticipantPaymentMails/ParticipantPaymentMissingPaymentMail.php b/app/Mail/ParticipantPaymentMails/ParticipantPaymentMissingPaymentMail.php index 0594a09..4aa7ce6 100644 --- a/app/Mail/ParticipantPaymentMails/ParticipantPaymentMissingPaymentMail.php +++ b/app/Mail/ParticipantPaymentMails/ParticipantPaymentMissingPaymentMail.php @@ -2,6 +2,7 @@ namespace App\Mail\ParticipantPaymentMails; +use App\EventPaymentModules\DTO\RegistrationRenderContext; use App\EventPaymentModules\ProvidesGiroCode; use App\Models\EventParticipant; use Illuminate\Http\Request; @@ -51,6 +52,9 @@ class ParticipantPaymentMissingPaymentMail extends Mailable ? $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', with: [ @@ -62,7 +66,7 @@ class ParticipantPaymentMissingPaymentMail extends Mailable 'departure' => $participant['departure'], 'amount' => $participant['amount_left_string'], 'paymentFinalDate' => $event['registrationFinalEnd']['formatted'], - 'paymentSummary' => $participant['paymentSummary'], + 'paymentSummary' => ['hasPaymentInformation' => $paymentSummary->hasPaymentInformation, 'html' => $paymentSummary->html], 'girocodeBinary' => $girocodeBinary, ], ); diff --git a/app/Models/EventParticipant.php b/app/Models/EventParticipant.php index 56bc672..54ca90a 100644 --- a/app/Models/EventParticipant.php +++ b/app/Models/EventParticipant.php @@ -8,6 +8,7 @@ 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; @@ -202,14 +203,14 @@ class EventParticipant extends InstancedModel return $method?->pivot->configuration ?? []; } - /** Zahlungs-Zusammenfassung (Anmeldeabschluss/Mail), vom Zahlungsmodul erzeugt. */ - public function paymentSummary(): RegistrationSummaryResponse + /** 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())); + return $module->registrationSummary(new RegistrationSummaryRequest($this, $this->paymentConfiguration(), $context)); } } diff --git a/app/Resources/EventParticipantResource.php b/app/Resources/EventParticipantResource.php index 6b037eb..c5225a7 100644 --- a/app/Resources/EventParticipantResource.php +++ b/app/Resources/EventParticipantResource.php @@ -61,9 +61,7 @@ class EventParticipantResource extends JsonResource && $this->resource->amount_paid?->getAmount() < $this->resource->amount->getAmount(), 'paymentSummary' => [ 'hasPaymentInformation' => $paymentSummary->hasPaymentInformation, - 'lines' => $paymentSummary->lines, 'html' => $paymentSummary->html, - 'showGiroCode' => $paymentSummary->showGiroCode, ], 'nicename' => $this->resource->getNicename(), 'arrival' => $this->resource->arrival_date->format('d.m.Y'), diff --git a/resources/views/emails/events/signup_complete.blade.php b/resources/views/emails/events/signup_complete.blade.php index 4c7b229..09dffb8 100644 --- a/resources/views/emails/events/signup_complete.blade.php +++ b/resources/views/emails/events/signup_complete.blade.php @@ -39,18 +39,9 @@ @if ($paymentSummary['hasPaymentInformation']) - @if ($paymentSummary['showGiroCode']) -- Deine Teilnahme ist noch nicht bestätigt, da dsies erst nach vollständigem Zahlungseingang - der - Fall ist. - Bitte zahle den Betrag in Höhe von {{$amount}} bis zum {{$paymentFinalDate}} - , - da andernfalls die Stornierung deiner Anmeldung erfolgen kann. - - Um deine Anmeldung zu vervollständigen, überweise den Betrag bitte zugunsten folgender Bankverbindung: -
- @endif ++ Zu deiner Anmeldung liegen noch folgende Zahlungsinformationen vor: +
@include('emails.subparts.payment')
diff --git a/resources/views/emails/participantPayments/missing_amount.blade.php b/resources/views/emails/participantPayments/missing_amount.blade.php
index 2379fd1..0bab180 100644
--- a/resources/views/emails/participantPayments/missing_amount.blade.php
+++ b/resources/views/emails/participantPayments/missing_amount.blade.php
@@ -36,14 +36,11 @@
-@if ($paymentSummary['hasPaymentInformation'] && $paymentSummary['showGiroCode'])
+@if ($paymentSummary['hasPaymentInformation'])
- Wahrscheinlich hast du vergessen, deinen Teilnahmebeitrag zu überweisen, sodass deine Anmeldung leider noch nicht bestätigt, werden konnte. - - Um deine Anmeldung zu bestätigen, zahle bitte den Betrag in Höhe von {{$amount}} bis zum {{$paymentFinalDate}}, - 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 + noch nicht bestätigt werden konnte. Bitte hole die Zahlung anhand der folgenden + Zahlungsinformationen nach:
diff --git a/resources/views/emails/subparts/payment.blade.php b/resources/views/emails/subparts/payment.blade.php index cf6dd19..ca710a6 100644 --- a/resources/views/emails/subparts/payment.blade.php +++ b/resources/views/emails/subparts/payment.blade.php @@ -1,58 +1,7 @@ -{{-- Zahlungs-Info-Block aus dem Zahlungsmodul ($paymentSummary). Entweder freier HTML-Text - (z.B. Barzahlung) oder strukturierte Zeilen (z.B. Überweisung) inkl. optionalem GiroCode. --}} -@if (!empty($paymentSummary['html'])) - {!! $paymentSummary['html'] !!} -@else -
| - {{ $line['label'] }} - | -- {{ $line['value'] }} - | -
|
-
- Bequem überweisen mit QR-Code
- - - |
-
-
- Und so funktioniert es
|
-
- Bitte zahle immer mit dem vorgegeben Betreff, damit deine Zahlung möglichst einfach zugeordnet werden
- kann.
- 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.
-
| + Kontoinhaber + | +{{ $accountOwner }} | +
| IBAN | +{{ $iban }} | +
| + Verwendungszweck + | +{{ $paymentPurpose }} | +
| Betrag | +{{ $amount }} | +
|
+ Bequem überweisen mit QR-Code + |
+
+ Und so funktioniert es
+
|
+
+ Zahlungserinnerung in den Kalender setzen +
+@endif + ++ Bitte zahle immer mit dem vorgegebenen Verwendungszweck, damit deine Zahlung eindeutig zugeordnet werden kann. +
+ +@if ($paymentDeadline) ++ Bitte beachte, dass deine Anmeldung erst nach vollständigem Zahlungseingang bestätigt ist. Erfolgt dieser nicht + bis zum {{ $paymentDeadline }}, 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. +
+@endif diff --git a/resources/views/payment-modules/account-transfer/web.blade.php b/resources/views/payment-modules/account-transfer/web.blade.php new file mode 100644 index 0000000..efa12bf --- /dev/null +++ b/resources/views/payment-modules/account-transfer/web.blade.php @@ -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. --}} +| Kontoinhaber: | +{{ $accountOwner }} | + + +
| IBAN: | +{{ $iban }} | +
| Verwendungszweck: | +{{ $paymentPurpose }} | +
| Betrag: | +{{ $amount }} | +
+ Zahlungserinnerung in den Kalender setzen +
+@endif + ++ Bitte zahle immer mit dem vorgegebenen Verwendungszweck, damit deine Zahlung eindeutig zugeordnet werden kann. +
+ +@if ($paymentDeadline) ++ Bitte beachte, dass deine Anmeldung erst nach vollständigem Zahlungseingang bestätigt ist. Erfolgt dieser nicht + bis zum {{ $paymentDeadline }}, 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. +
+@endif diff --git a/resources/views/payment-modules/undefined/mail.blade.php b/resources/views/payment-modules/undefined/mail.blade.php new file mode 100644 index 0000000..2a353de --- /dev/null +++ b/resources/views/payment-modules/undefined/mail.blade.php @@ -0,0 +1,4 @@ +{{-- Barzahlung/Sonstiges -- MAIL-Kontext. E-Mail-tauglicher Rahmen um den nutzerdefinierten Freitext (richtext). --}} +Bitte bar vor Ort zahlen.
']; + 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->assertTrue($summary->showGiroCode); + $this->assertStringContainsString('Bitte bar vor Ort zahlen.', $summary->html); + $this->assertStringContainsString('class="payment-information"', $summary->html); + } - $byLabel = []; - foreach ($summary->lines as $line) { - $byLabel[$line['label']] = $line['value']; - } - $this->assertSame('DE-EVENT', $byLabel['IBAN']); + 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 @@ -142,6 +176,6 @@ class EventParticipantPaymentSummaryTest extends TestCase $array = $participant->toResource()->toArray(request()); $this->assertTrue($array['paymentSummary']['hasPaymentInformation']); - $this->assertTrue($array['paymentSummary']['showGiroCode']); + $this->assertStringContainsString('DE-EVENT', $array['paymentSummary']['html']); } } diff --git a/tests/Unit/RegistrationSummaryTest.php b/tests/Unit/RegistrationSummaryTest.php index 46d8d59..9937878 100644 --- a/tests/Unit/RegistrationSummaryTest.php +++ b/tests/Unit/RegistrationSummaryTest.php @@ -3,12 +3,15 @@ namespace Tests\Unit; use App\EventPaymentModules\DTO\RegistrationSummaryRequest; -use App\EventPaymentModules\Modules\AccountTransferPaymentModule; use App\EventPaymentModules\Modules\UndefinedPaymentModule; use App\Models\EventParticipant; use App\ValueObjects\Amount; use PHPUnit\Framework\TestCase; +/** + * Reine Modul-Logik ohne Framework-Kontext. Das Überweisungs-Modul rendert inzwischen Blade und wird + * daher auf Feature-Ebene getestet (siehe EventParticipantPaymentSummaryTest). + */ class RegistrationSummaryTest extends TestCase { private function participant(float $amount, float $amountPaid, string $purpose = 'Zweck'): EventParticipant @@ -24,56 +27,6 @@ class RegistrationSummaryTest extends TestCase return $participant; } - public function test_account_transfer_summary_builds_lines_from_config(): void - { - $module = new AccountTransferPaymentModule(); - $request = new RegistrationSummaryRequest( - $this->participant(50.0, 0.0, 'Camp - Beitrag'), - ['account_owner' => 'Kasse', 'iban' => 'DE123', 'bic' => 'XY'], - ); - - $summary = $module->registrationSummary($request); - - $this->assertTrue($summary->hasPaymentInformation); - $this->assertTrue($summary->showGiroCode); - $this->assertNull($summary->html); - - $byLabel = []; - foreach ($summary->lines as $line) { - $byLabel[$line['label']] = $line['value']; - } - $this->assertSame('Kasse', $byLabel['Kontoinhaber']); - $this->assertSame('DE123', $byLabel['IBAN']); - $this->assertSame('Camp - Beitrag', $byLabel['Verwendungszweck']); - $this->assertArrayHasKey('Betrag', $byLabel); - } - - public function test_account_transfer_without_open_amount_has_no_payment_information(): void - { - $module = new AccountTransferPaymentModule(); - $summary = $module->registrationSummary(new RegistrationSummaryRequest( - $this->participant(50.0, 50.0), - ['account_owner' => 'Kasse', 'iban' => 'DE123'], - )); - - $this->assertFalse($summary->hasPaymentInformation); - $this->assertFalse($summary->showGiroCode); - } - - public function test_cash_summary_returns_configured_html(): void - { - $module = new UndefinedPaymentModule(); - $summary = $module->registrationSummary(new RegistrationSummaryRequest( - $this->participant(50.0, 0.0), - ['payment_information' => 'Bitte bar vor Ort zahlen.
'], - )); - - $this->assertTrue($summary->hasPaymentInformation); - $this->assertFalse($summary->showGiroCode); - $this->assertSame('Bitte bar vor Ort zahlen.
', $summary->html); - $this->assertSame([], $summary->lines); - } - public function test_cash_summary_empty_when_no_text_configured(): void { $module = new UndefinedPaymentModule();