|
|
@@ -56,6 +56,8 @@ class ShopService
|
|
|
private LoggerInterface $logger,
|
|
|
private MessageBusInterface $messageBus,
|
|
|
private Trial $trial,
|
|
|
+ private string $faqUrl,
|
|
|
+ private readonly string $softwareWebsiteUrl
|
|
|
) {
|
|
|
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
|
|
|
}
|
|
|
@@ -84,13 +86,11 @@ class ShopService
|
|
|
*
|
|
|
* @param array<string, mixed> $data
|
|
|
*/
|
|
|
- protected function controlShopRequestData(ShopRequestType $type, NewStructureArtistPremiumTrialRequest|array $data): void
|
|
|
+ protected function controlShopRequestData(ShopRequestType $type, array $data): void
|
|
|
{
|
|
|
// @phpstan-ignore-next-line identical.alwaysTrue
|
|
|
if ($type === ShopRequestType::NEW_STRUCTURE_ARTIST_PREMIUM_TRIAL) {
|
|
|
- /** @var NewStructureArtistPremiumTrialRequest $request */
|
|
|
- $request = $data;
|
|
|
- $this->validateNewStructureArtistPremiumTrialRequest($request);
|
|
|
+ $this->validateNewStructureArtistPremiumTrialRequest($data);
|
|
|
} else {
|
|
|
throw new \RuntimeException('request type not supported');
|
|
|
}
|
|
|
@@ -145,8 +145,9 @@ class ShopService
|
|
|
protected function sendRequestValidationLink(ShopRequest $shopRequest): void
|
|
|
{
|
|
|
$validationUrl = UrlBuilder::concat(
|
|
|
- $this->publicBaseUrl,
|
|
|
- ['/api/public/shop/validate', $shopRequest->getToken()]
|
|
|
+ $this->softwareWebsiteUrl,
|
|
|
+ ['/shop/try/validation'],
|
|
|
+ ['token' => $shopRequest->getToken()]
|
|
|
);
|
|
|
|
|
|
$data = $shopRequest->getData();
|
|
|
@@ -231,15 +232,21 @@ class ShopService
|
|
|
* Vérifie la validité d'une requête d'essai artist premium pour une nouvelle structure.
|
|
|
*/
|
|
|
protected function validateNewStructureArtistPremiumTrialRequest(
|
|
|
- NewStructureArtistPremiumTrialRequest $request,
|
|
|
+ array $data,
|
|
|
): void {
|
|
|
+ $trialRequestObj = $this->serializer->deserialize(
|
|
|
+ json_encode($data),
|
|
|
+ NewStructureArtistPremiumTrialRequest::class,
|
|
|
+ 'json'
|
|
|
+ );
|
|
|
+
|
|
|
// Validate phone number
|
|
|
- if (!$this->phoneNumberUtil->isPossibleNumber($request->getRepresentativePhone())) {
|
|
|
+ if (!$this->phoneNumberUtil->isPossibleNumber($trialRequestObj->getRepresentativePhone())) {
|
|
|
throw new \RuntimeException('Invalid phone number');
|
|
|
}
|
|
|
|
|
|
// Check if organization already exists
|
|
|
- $organizationCreationRequest = $this->createOrganizationCreationRequestFromTrialRequest($request);
|
|
|
+ $organizationCreationRequest = $this->createOrganizationCreationRequestFromTrialRequest($trialRequestObj);
|
|
|
$this->organizationFactory->interruptIfOrganizationExists($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
@@ -312,7 +319,7 @@ class ShopService
|
|
|
$model
|
|
|
->setTrialRequest($trialRequest)
|
|
|
->setAccountCreationUrl(UrlBuilder::concat($this->publicBaseUrl, ['/account/create']))
|
|
|
- ->setFaqUrl(UrlBuilder::concat($this->publicBaseUrl, ['/faq/opentalent-artist']))
|
|
|
+ ->setFaqUrl($this->faqUrl)
|
|
|
->setSenderId(AccessIdsEnum::ADMIN_2IOPENSERVICE->value);
|
|
|
|
|
|
// Send the email to the representative
|