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,45 @@
<?php
namespace App\Domains\ParticipantRefund\Actions\CancelRefund;
use App\Models\ParticipantRefund;
/**
* Bricht eine freigegebene, aber noch nicht bestätigte Erstattung ab.
*
* Danach läuft der Link des Teilis ins Leere und die Anmeldung sieht aus wie vor der Freigabe. Bewusst
* ohne Mail: der Teili soll nicht über etwas informiert werden, das für ihn nie stattgefunden hat --
* die Aktionsleitung klärt das im Zweifel direkt.
*
* Ein bereits bestätigter Vorgang ist unantastbar: dazu gibt es einen Beleg, und der Teili hat seine
* Bankverbindung im Vertrauen darauf herausgegeben.
*/
class CancelRefundCommand
{
public function __construct(private readonly CancelRefundRequest $request)
{
}
public function execute(): CancelRefundResponse
{
$response = new CancelRefundResponse();
$refund = $this->request->refund;
if (!$refund->isPending()) {
$response->message = $refund->isAccepted()
? 'Diese Erstattung wurde bereits bestätigt und kann nicht mehr abgebrochen werden.'
: 'Diese Erstattung wurde bereits abgebrochen.';
return $response;
}
$refund->status = ParticipantRefund::STATUS_CANCELLED;
$refund->cancelled_at = now();
$refund->save();
$response->success = true;
$response->message = 'Die Erstattung wurde abgebrochen.';
return $response;
}
}
@@ -0,0 +1,13 @@
<?php
namespace App\Domains\ParticipantRefund\Actions\CancelRefund;
use App\Models\ParticipantRefund;
class CancelRefundRequest
{
public function __construct(
public readonly ParticipantRefund $refund,
) {
}
}
@@ -0,0 +1,10 @@
<?php
namespace App\Domains\ParticipantRefund\Actions\CancelRefund;
class CancelRefundResponse
{
public bool $success = false;
public ?string $message = null;
}