/** | /** | ||||
* @return Collection|OrderPayment[] | * @return Collection|OrderPayment[] | ||||
*/ | */ | ||||
public function getOrderPayments(): Collection | |||||
public function getOrderPayments($meanPayment = null): Collection | |||||
{ | { | ||||
if($meanPayment) { | |||||
$orderPaymentsReturn = new ArrayCollection() ; | |||||
foreach($this->orderPayments as $orderPayment) { | |||||
if($orderPayment->getMeanPayment() == $meanPayment) { | |||||
$orderPaymentsReturn[] = $orderPayment ; | |||||
} | |||||
} | |||||
return $orderPaymentsReturn ; | |||||
} | |||||
return $this->orderPayments; | return $this->orderPayments; | ||||
} | } | ||||
$title .= ' - ' . $this->getTitle(); | $title .= ' - ' . $this->getTitle(); | ||||
} | } | ||||
if($this->getProductFamily()->hasProductsWithVariousWeight()) { | |||||
$title .= ' - '.$this->getQuantityLabelInherited() ; | |||||
} | |||||
return $title; | return $title; | ||||
} | } | ||||
listLoopBesancon: Adresses de Besançon à spécifier (lat / long) | listLoopBesancon: Adresses de Besançon à spécifier (lat / long) | ||||
User: | User: | ||||
item: Utilisateur | item: Utilisateur | ||||
Notification: | |||||
main: Notifications | |||||
protected $parameterBag; | protected $parameterBag; | ||||
protected $merchantUtils; | protected $merchantUtils; | ||||
public function __construct(MailjetTransport $mailjetTransport, Environment $templating, ParameterBagInterface $parameterBag, MerchantUtilsInterface $merchantUtils) | |||||
{ | |||||
public function __construct( | |||||
MailjetTransport $mailjetTransport, | |||||
Environment $templating, | |||||
ParameterBagInterface $parameterBag, | |||||
MerchantUtilsInterface $merchantUtils | |||||
) { | |||||
$this->transport = $mailjetTransport; | $this->transport = $mailjetTransport; | ||||
$this->templating = $templating; | $this->templating = $templating; | ||||
$this->parameterBag = $parameterBag; | $this->parameterBag = $parameterBag; | ||||
$message->getHeaders()->addMailboxHeader('Disposition-Notification-To', $emailFromDispositionNotificationTo); | $message->getHeaders()->addMailboxHeader('Disposition-Notification-To', $emailFromDispositionNotificationTo); | ||||
}*/ | }*/ | ||||
$this->transport->send($message); | |||||
return $this->transport->send($message); | |||||
} | } | ||||
} | } |
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||||
use Symfony\Component\HttpFoundation\ParameterBag; | use Symfony\Component\HttpFoundation\ParameterBag; | ||||
use Symfony\Contracts\HttpClient\HttpClientInterface; | use Symfony\Contracts\HttpClient\HttpClientInterface; | ||||
use Twig\Environment; | |||||
class MailjetSMS | |||||
class MailjetSmsUtils | |||||
{ | { | ||||
const TO_USER = 'to-user' ; | |||||
const CONTENT_MESSAGE = 'content-message' ; | |||||
const CONTENT_TEMPLATE = 'content-template' ; | |||||
const CONTENT_DATA = 'content-data' ; | |||||
protected $client; | protected $client; | ||||
protected $parameterBag; | protected $parameterBag; | ||||
protected $mailUtils ; | protected $mailUtils ; | ||||
protected $utils ; | protected $utils ; | ||||
protected $templating ; | |||||
public function __construct(HttpClientInterface $client, ParameterBagInterface $parameterBag, UtilsManager $utilsManager) | |||||
{ | |||||
public function __construct( | |||||
HttpClientInterface $client, | |||||
ParameterBagInterface $parameterBag, | |||||
MailUtils $mailUtils, | |||||
Utils $utils, | |||||
Environment $templating | |||||
) { | |||||
$this->client = $client; | $this->client = $client; | ||||
$this->parameterBag = $parameterBag; | $this->parameterBag = $parameterBag; | ||||
$this->mailUtils = $utilsManager->getMailUtils() ; | |||||
$this->utils = $utilsManager->getUtils() ; | |||||
$this->mailUtils = $mailUtils ; | |||||
$this->utils = $utils ; | |||||
$this->templating = $templating ; | |||||
} | } | ||||
public function send($user, $message) | |||||
public function send($params = []) | |||||
{ | { | ||||
$user = isset($params[self::TO_USER]) ? $params[self::TO_USER] : null ; | |||||
if($user) { | if($user) { | ||||
$phone = $this->utils->formatPhoneNumber($user->getPhone()) ; | $phone = $this->utils->formatPhoneNumber($user->getPhone()) ; | ||||
$message = '' ; | |||||
if(isset($params[self::CONTENT_MESSAGE])) { | |||||
$message = $params[self::CONTENT_MESSAGE] ; | |||||
} | |||||
elseif(isset($params[self::CONTENT_TEMPLATE])) { | |||||
$template = $params[self::CONTENT_TEMPLATE] ; | |||||
$paramsTemplate = [] ; | |||||
if(isset($params[self::CONTENT_DATA]) && is_array($params[self::CONTENT_DATA])) { | |||||
$paramsTemplate = $params[self::CONTENT_DATA] ; | |||||
} | |||||
$message = $this->templating->render($template, $paramsTemplate) ; | |||||
} | |||||
if($this->parameterBag->get('mailjet.dev.redirect.active') == 1) { | if($this->parameterBag->get('mailjet.dev.redirect.active') == 1) { | ||||
$this->mailUtils->send([ | $this->mailUtils->send([ | ||||
MailUtils::SUBJECT => 'Notification par SMS à '.$phone, | MailUtils::SUBJECT => 'Notification par SMS à '.$phone, |
protected $statisticsUtils; | protected $statisticsUtils; | ||||
protected $pointLocationUtils ; | protected $pointLocationUtils ; | ||||
protected $sectionUtils ; | protected $sectionUtils ; | ||||
protected $mailjetSmsUtils ; | |||||
public function __construct( | public function __construct( | ||||
Utils $utils, | Utils $utils, | ||||
TicketUtils $ticketUtils, | TicketUtils $ticketUtils, | ||||
PointLocationUtils $pointLocationUtils, | PointLocationUtils $pointLocationUtils, | ||||
UtilsProcess $utilsProcess, | UtilsProcess $utilsProcess, | ||||
SectionUtilsInterface $sectionUtils | |||||
SectionUtilsInterface $sectionUtils, | |||||
MailjetSmsUtils $mailjetSmsUtils | |||||
) | ) | ||||
{ | { | ||||
$this->utils = $utils ; | $this->utils = $utils ; | ||||
$this->pointLocationUtils = $pointLocationUtils ; | $this->pointLocationUtils = $pointLocationUtils ; | ||||
$this->utilsProcess = $utilsProcess ; | $this->utilsProcess = $utilsProcess ; | ||||
$this->sectionUtils = $sectionUtils ; | $this->sectionUtils = $sectionUtils ; | ||||
$this->mailjetSmsUtils = $mailjetSmsUtils ; | |||||
} | } | ||||
public function getUtils(): Utils | public function getUtils(): Utils | ||||
return $this->sectionUtils ; | return $this->sectionUtils ; | ||||
} | } | ||||
public function getMailjetSmsUtils(): MailjetSmsUtils | |||||
{ | |||||
return $this->mailjetSmsUtils ; | |||||
} | |||||
} | } |