|
|
@@ -7,17 +7,16 @@ namespace App\Service\Shop;
|
|
|
use App\ApiResources\Organization\OrganizationCreationRequest;
|
|
|
use App\ApiResources\Shop\NewStructureArtistPremiumTrialRequest;
|
|
|
use App\Entity\Organization\Organization;
|
|
|
-use App\Entity\Organization\Subdomain;
|
|
|
use App\Entity\Shop\ShopRequest;
|
|
|
use App\Enum\Access\AccessIdsEnum;
|
|
|
use App\Enum\Organization\SettingsProductEnum;
|
|
|
use App\Enum\Shop\ShopRequestStatus;
|
|
|
use App\Enum\Shop\ShopRequestType;
|
|
|
use App\Message\Message\Shop\NewStructureArtistPremiumTrial;
|
|
|
-use App\Service\Dolibarr\DolibarrApiService;
|
|
|
-use App\Service\Dolibarr\DolibarrUtils;
|
|
|
use App\Service\Mailer\Mailer;
|
|
|
-use App\Service\Mailer\Model\NewStructureArtistPremiumTrialRequestValidationModel;
|
|
|
+use App\Service\Mailer\Model\Shop\NewStructureArtistPremium\ConfirmationToRepresentativeModel;
|
|
|
+use App\Service\Mailer\Model\Shop\NewStructureArtistPremium\NotificationToSalesAdminModel;
|
|
|
+use App\Service\Mailer\Model\Shop\TokenValidationModel;
|
|
|
use App\Service\Organization\OrganizationFactory;
|
|
|
use App\Service\Utils\DatesUtils;
|
|
|
use App\Service\Utils\UrlBuilder;
|
|
|
@@ -152,7 +151,7 @@ class ShopService
|
|
|
|
|
|
$data = $shopRequest->getData();
|
|
|
|
|
|
- $model = new NewStructureArtistPremiumTrialRequestValidationModel();
|
|
|
+ $model = new TokenValidationModel();
|
|
|
$model
|
|
|
->setToken($shopRequest->getToken())
|
|
|
->setRepresentativeEmail($data['representativeEmail'] ?? '')
|
|
|
@@ -206,6 +205,9 @@ class ShopService
|
|
|
// Send email to sales administration
|
|
|
$this->sendMailToSalesAdministration($trialRequest);
|
|
|
|
|
|
+ // Send email to representative
|
|
|
+ $this->sendConfirmationMailToRepresentative($trialRequest);
|
|
|
+
|
|
|
$this->logger->info('Successfully processed NewStructureArtistPremiumTrial for token: '.$token);
|
|
|
}
|
|
|
|
|
|
@@ -285,7 +287,7 @@ class ShopService
|
|
|
protected function sendMailToSalesAdministration(NewStructureArtistPremiumTrialRequest $trialRequest): void
|
|
|
{
|
|
|
// Create the email model
|
|
|
- $model = new Model\NewStructureArtistPremiumTrialRequestSalesAdminModel();
|
|
|
+ $model = new NotificationToSalesAdminModel();
|
|
|
$model
|
|
|
->setTrialRequest($trialRequest)
|
|
|
->setSenderId(AccessIdsEnum::ADMIN_2IOPENSERVICE->value);
|
|
|
@@ -293,4 +295,26 @@ class ShopService
|
|
|
// Send the email to the sales administration
|
|
|
$this->mailer->main($model);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Envoie un email au représentant pour l'informer que sa demande d'essai artist premium a été validée
|
|
|
+ * et lui fournir un lien pour créer son compte et accéder au logiciel.
|
|
|
+ *
|
|
|
+ * @param NewStructureArtistPremiumTrialRequest $trialRequest La demande d'essai
|
|
|
+ *
|
|
|
+ * @throws TransportExceptionInterface
|
|
|
+ */
|
|
|
+ protected function sendConfirmationMailToRepresentative(NewStructureArtistPremiumTrialRequest $trialRequest): void
|
|
|
+ {
|
|
|
+ // Create the email model
|
|
|
+ $model = new ConfirmationToRepresentativeModel();
|
|
|
+ $model
|
|
|
+ ->setTrialRequest($trialRequest)
|
|
|
+ ->setAccountCreationUrl(UrlBuilder::concat($this->publicBaseUrl, ['/account/create']))
|
|
|
+ ->setFaqUrl(UrlBuilder::concat($this->publicBaseUrl, ['/faq/opentalent-artist']))
|
|
|
+ ->setSenderId(AccessIdsEnum::ADMIN_2IOPENSERVICE->value);
|
|
|
+
|
|
|
+ // Send the email to the representative
|
|
|
+ $this->mailer->main($model);
|
|
|
+ }
|
|
|
}
|