Payment reminder mails
This commit is contained in:
33
app/Domains/Event/Controllers/PaymentReminderController.php
Normal file
33
app/Domains/Event/Controllers/PaymentReminderController.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Domains\Event\Actions\SendMissingPaymentMails\SendMissingPaymentMailsCommand;
|
||||
use App\Domains\Event\Actions\SendMissingPaymentMails\SendMissingPaymentMailsRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PaymentReminderController extends CommonController
|
||||
{
|
||||
public function __invoke(string $eventIdentifier, Request $request)
|
||||
{
|
||||
$event = $this->events->getByIdentifier($eventIdentifier, true);
|
||||
|
||||
$sendPaymentReminderMailsRequest = new SendMissingPaymentMailsRequest(
|
||||
event: $event,
|
||||
eventParticipants: $this->eventParticipants,
|
||||
httpRequest: $request
|
||||
);
|
||||
|
||||
$sendPaymentReminderMailsCommand = new SendMissingPaymentMailsCommand(request: $sendPaymentReminderMailsRequest);
|
||||
$sendPaymentReminderResponse = $sendPaymentReminderMailsCommand->execute();
|
||||
|
||||
return response()->json([
|
||||
'success' => $sendPaymentReminderResponse->success,
|
||||
'message' => $sendPaymentReminderResponse->success ?
|
||||
sprintf('Es wurden %1$s Personen über fehlende Teilnahmebeiträge informiert', $sendPaymentReminderResponse->remindedParticipants) :
|
||||
'Beim Senden der Benachrichtigungen ist ein Fehler aufgetreten.',
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user