Creating Participation refunds

This commit is contained in:
2026-09-03 21:23:26 +02:00
parent 9c4c28e566
commit 6a183d6498
55 changed files with 3985 additions and 42 deletions
@@ -0,0 +1,59 @@
<?php
namespace App\Mail\ParticipantRefundMails;
use App\Models\EventParticipant;
use App\Models\ParticipantRefund;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
/**
* Fordert den Teili auf, seine Bankverbindung für die freigegebene Erstattung zu hinterlegen.
*/
class RefundReleasedMail extends Mailable
{
public function __construct(
private EventParticipant $participant,
private ParticipantRefund $refund,
) {
}
public function envelope(): Envelope
{
return new Envelope(
subject: sprintf(
'Rückerstattung deines Beitrags für die Veranstaltung %s',
$this->participant->event()->first()->name
),
);
}
public function content(): Content
{
$event = $this->participant->event()->first();
return new Content(
view: 'emails.events.refund_released',
with: [
'name' => $this->participant->getNicename(),
'eventTitle' => $event->name,
'eventEmail' => $event->email,
'amount' => $this->refund->amount?->toString() ?? '0,00 Euro',
'reason' => $this->refund->reasonLabel(),
'reasonNote' => $this->refund->reason_note,
// Absolute URL: der Link muss aus jedem Postfach heraus funktionieren.
'link' => url('/rueckerstattung/' . $this->refund->token),
],
);
}
/**
* @return array<int, Attachment>
*/
public function attachments(): array
{
return [];
}
}