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
@@ -0,0 +1,33 @@
<?php
namespace App\Domains\ParticipantInvoice\Controllers;
use App\Domains\ParticipantInvoice\Actions\CreateParticipantInvoice\CreateParticipantInvoiceCommand;
use App\Domains\ParticipantInvoice\Actions\CreateParticipantInvoice\CreateParticipantInvoiceRequest;
use App\Scopes\CommonController;
use Illuminate\Http\Response;
class CreateParticipantInvoiceController extends CommonController
{
public function __invoke(string $participantIdentifier): Response
{
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
if ($participant === null) {
abort(403, 'Zugriff verweigert.');
}
$invoiceRequest = new CreateParticipantInvoiceRequest($participant);
$invoiceCommand = new CreateParticipantInvoiceCommand($invoiceRequest);
$invoiceResponse = $invoiceCommand->execute();
if (!$invoiceResponse->success) {
abort(422, $invoiceResponse->message ?? 'Die Rechnung konnte nicht erstellt werden.');
}
return response($invoiceResponse->pdfContent, 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="' . $invoiceResponse->filename . '"',
]);
}
}