You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Services/Ticket/TicketNotificationTransport...

28 lines
706 B
PHTML

<?php
namespace App\Services\Ticket;
use App\Services\Mail;
use App\Services\TicketTelegramNotifier;
final class TicketNotificationTransportAdapter implements TicketNotificationTransport
{
public function sendMail(
string $email,
string $subject,
string $template,
array $data,
?string $event = null
): void {
Mail::send($email, $subject, $template, $data, [], $event);
}
public function sendTelegram(TicketEvent $event): void
{
if (TicketTelegramNotifier::notify($event)
=== TicketTelegramNotificationResult::Failed) {
throw new \RuntimeException('Telegram ticket delivery failed');
}
}
}