More improvements
This commit is contained in:
@@ -7,6 +7,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\ProvidesGiroCode;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\Event;
|
||||
@@ -117,21 +118,54 @@ class EventParticipantPaymentSummaryTest extends TestCase
|
||||
$this->assertSame('Kasse', $config['account_owner']);
|
||||
}
|
||||
|
||||
public function test_payment_summary_builds_lines_from_resolved_config(): void
|
||||
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);
|
||||
|
||||
$summary = $participant->paymentSummary();
|
||||
// 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->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']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user