Browse Source

Merge branch 'develop'

master
Guillaume 2 years ago
parent
commit
39b2cab716
2 changed files with 18 additions and 5 deletions
  1. +6
    -4
      Notification/MailMailjetNotification.php
  2. +12
    -1
      Resolver/MerchantResolver.php

+ 6
- 4
Notification/MailMailjetNotification.php View File

@@ -15,6 +15,8 @@ class MailMailjetNotification extends SovMailMailjetNotification
{
protected MerchantResolver $merchantResolver;

const MERCHANT = 'merchant';

public function __construct(
MailjetTransport $mailjetTransport,
Environment $templating,
@@ -29,10 +31,10 @@ class MailMailjetNotification extends SovMailMailjetNotification

public function send($params = [])
{
$merchantCurrent = $this->merchantResolver->getCurrent();
$merchant = isset($params[self::MERCHANT]) ? $params[self::MERCHANT] : $this->merchantResolver->getCurrent();

$merchantConfigEmailFrom = $this->settingSolver->getSettingValue(
$merchantCurrent,
$merchant,
MerchantSettingDefinition::SETTING_EMAIL_FROM
);
$emailFrom = (isset($params[self::FROM_EMAIL]) && $params[self::FROM_EMAIL] && strlen(
@@ -40,13 +42,13 @@ class MailMailjetNotification extends SovMailMailjetNotification
)) ? $params[self::FROM_EMAIL] : $merchantConfigEmailFrom;

$merchantConfigEmailFromName = $this->settingSolver->getSettingValue(
$merchantCurrent,
$merchant,
MerchantSettingDefinition::SETTING_EMAIL_FROM_NAME
);
$emailFromName = isset($params[self::FROM_NAME]) ? $params[self::FROM_NAME] : $merchantConfigEmailFromName;

$merchantConfigEmailSubjectPrefix = $this->settingSolver->getSettingValue(
$merchantCurrent,
$merchant,
MerchantSettingDefinition::SETTING_EMAIL_SUBJECT_PREFIX
);
$emailSubjectPrefix = isset($params[self::SUBJECT_PREFIX]) ? $params[self::SUBJECT_PREFIX] : $merchantConfigEmailSubjectPrefix;

+ 12
- 1
Resolver/MerchantResolver.php View File

@@ -126,7 +126,7 @@ class MerchantResolver
$merchant = $this->getCurrent();
}

//TODO Pas de REPO !!!!!
// @TODO Pas de REPO !!!!!
return $this->userMerchantRepository->findOneBy(
[
'user' => $user,
@@ -135,6 +135,17 @@ class MerchantResolver
);
}

public function getAbsoluteUrl(MerchantInterface $merchant, string $name, array $parameters = []): string
{
$url = $this->settingSolver->getSettingValue($merchant, MerchantSettingDefinition::SETTING_URL);

if(substr($url, strlen($url) - 1, 1) == '/') {
$url = substr($url, 0, strlen($url) - 1);
}

return $url . $this->router->generate($name, $parameters);
}

public function getUrl(SectionInterface $section)
{
$url = $this->settingSolver->getSettingValue($section->getMerchant(), MerchantSettingDefinition::SETTING_URL);

Loading…
Cancel
Save