Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BO] Ajout tag brevo sur les mail de relances #2228

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading