<?php
namespace Products\NotificationsBundle\Controller\System;
use App\Controller\AbstractController;
use Products\NotificationsBundle\Entity\AbstractNotification;
use Products\NotificationsBundle\Entity\Notifications\Channels\ChannelsInterface;
use Products\NotificationsBundle\Service\ContactMonitor;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route(
* "/sendgrid",
* )
*/
final class SendgridWebhookController extends AbstractController
{
const ROUTES__EMAIL = 'app.notifications.system.sendgrid_webhook.email';
/**
* @return ContactMonitor|object
*/
protected function getContactMonitor(): ContactMonitor
{
return $this->get(__METHOD__);
}
/**
* @param Request $request
* @return Response
*
* @Route(
* "/email",
* name = SendgridWebhookController::ROUTES__EMAIL,
* )
*/
public function emailAction(Request $request): Response
{
$this->getContactMonitor()->queueOrHandleWebhook(ChannelsInterface::CHANNELS__EMAIL, $request);
return new Response();
}
}