Skip to content

Commit

Permalink
Merge pull request #2228 from MTES-MCT/feature/2227-tag-brevo-mail-re…
Browse files Browse the repository at this point in the history
…lances

[BO] Ajout tag brevo sur les mail de relances
  • Loading branch information
numew committed Feb 7, 2024
2 parents 661ec32 + 38bbfcc commit bb00eee
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Command/Cron/AskFeedbackUsagerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ protected function processSignalementsLastSuiviTechnical(
$nbSignalements = $this->sendMailToUsagers(
$input,
$signalementsIds,
NotificationMailerType::TYPE_SIGNALEMENT_FEEDBACK_USAGER_WITHOUT_RESPONSE
);
if (!$input->getOption('debug')) {
$this->io->success(sprintf(
Expand All @@ -136,6 +137,7 @@ protected function processSignalementsLastSuiviPublic(
$nbSignalements = $this->sendMailToUsagers(
$input,
$signalementsIds,
NotificationMailerType::TYPE_SIGNALEMENT_FEEDBACK_USAGER_WITH_RESPONSE
);
if (!$input->getOption('debug')) {
$this->io->success(sprintf(
Expand All @@ -150,7 +152,7 @@ protected function processSignalementsLastSuiviPublic(
protected function sendMailToUsagers(
InputInterface $input,
array $signalementsIds,
NotificationMailerType $notificationMailerType = NotificationMailerType::TYPE_SIGNALEMENT_FEEDBACK_USAGER
NotificationMailerType $notificationMailerType
): int {
$totalRead = 0;
$signalements = $this->signalementRepository->findAllByIds($signalementsIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SignalementFeedbackUsagerThirdMailer extends AbstractNotificationMailer
protected ?NotificationMailerType $mailerType = NotificationMailerType::TYPE_SIGNALEMENT_FEEDBACK_USAGER_THIRD;
protected ?string $mailerSubject = '%param.platform_name% : faites le point sur votre problème de logement !';
protected ?string $mailerTemplate = 'demande_feedback_usager_third_email';
protected ?string $tagHeader = 'Usager 3e relance';

public function __construct(
protected MailerInterface $mailer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class SignalementFeedbackUsagerMailer extends AbstractNotificationMailer
class SignalementFeedbackUsagerWithResponseMailer extends AbstractNotificationMailer
{
protected ?NotificationMailerType $mailerType = NotificationMailerType::TYPE_SIGNALEMENT_FEEDBACK_USAGER;
protected ?NotificationMailerType $mailerType =
NotificationMailerType::TYPE_SIGNALEMENT_FEEDBACK_USAGER_WITH_RESPONSE;
protected ?string $mailerSubject = '%param.platform_name% : faites le point sur votre problème de logement !';
protected ?string $mailerButtonText = 'Mettre à jour ma situation';
protected ?string $mailerTemplate = 'demande_feedback_usager_email';
protected ?string $tagHeader = 'Usager relance apres reponse';

public function __construct(
protected MailerInterface $mailer,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\Service\Mailer\Mail\Signalement;

use App\Service\Mailer\Mail\AbstractNotificationMailer;
use App\Service\Mailer\NotificationMail;
use App\Service\Mailer\NotificationMailerType;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class SignalementFeedbackUsagerWithoutResponseMailer extends AbstractNotificationMailer
{
protected ?NotificationMailerType $mailerType =
NotificationMailerType::TYPE_SIGNALEMENT_FEEDBACK_USAGER_WITHOUT_RESPONSE;
protected ?string $mailerSubject = '%param.platform_name% : faites le point sur votre problème de logement !';
protected ?string $mailerButtonText = 'Mettre à jour ma situation';
protected ?string $mailerTemplate = 'demande_feedback_usager_email';
protected ?string $tagHeader = 'Usager relance sans reponse';

public function __construct(
protected MailerInterface $mailer,
protected ParameterBagInterface $parameterBag,
protected LoggerInterface $logger,
protected UrlGeneratorInterface $urlGenerator,
) {
parent::__construct($this->mailer, $this->parameterBag, $this->logger, $this->urlGenerator);
}

public function getMailerParamsFromNotification(NotificationMail $notificationMail): array
{
$signalement = $notificationMail->getSignalement();
$toRecipient = $notificationMail->getTo();

return [
'signalement' => $signalement,
'from' => $toRecipient,
'lien_suivi' => $this->generateLink(
'front_suivi_signalement',
['code' => $signalement->getCodeSuivi(), 'from' => $toRecipient]
),
];
}
}
3 changes: 2 additions & 1 deletion src/Service/Mailer/NotificationMailerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ enum NotificationMailerType
case TYPE_SIGNALEMENT_CLOSED_TO_USAGER;
case TYPE_SIGNALEMENT_CLOSED_TO_PARTNERS;
case TYPE_SIGNALEMENT_CLOSED_TO_PARTNER;
case TYPE_SIGNALEMENT_FEEDBACK_USAGER;
case TYPE_SIGNALEMENT_FEEDBACK_USAGER_WITH_RESPONSE;
case TYPE_SIGNALEMENT_FEEDBACK_USAGER_WITHOUT_RESPONSE;
case TYPE_SIGNALEMENT_FEEDBACK_USAGER_THIRD;
case TYPE_SIGNALEMENT_ASK_BAIL_DPE;
case TYPE_CONFIRM_RECEPTION;
Expand Down

0 comments on commit bb00eee

Please sign in to comment.