|
@@ -51,7 +51,7 @@ class ShopService
|
|
|
private EntityManagerInterface $entityManager,
|
|
private EntityManagerInterface $entityManager,
|
|
|
private Mailer $mailer,
|
|
private Mailer $mailer,
|
|
|
private string $publicBaseUrl,
|
|
private string $publicBaseUrl,
|
|
|
- private string $publicAdminBaseUrl,
|
|
|
|
|
|
|
+ private string $adminBaseUrl,
|
|
|
private OrganizationFactory $organizationFactory,
|
|
private OrganizationFactory $organizationFactory,
|
|
|
private SerializerInterface $serializer,
|
|
private SerializerInterface $serializer,
|
|
|
private LoggerInterface $logger,
|
|
private LoggerInterface $logger,
|
|
@@ -191,29 +191,39 @@ class ShopService
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Convert the stored JSON data to a NewStructureArtistPremiumTrialRequest object
|
|
|
|
|
- $data = $shopRequest->getData();
|
|
|
|
|
- $trialRequest = $this->serializer->deserialize(
|
|
|
|
|
- json_encode($data),
|
|
|
|
|
- NewStructureArtistPremiumTrialRequest::class,
|
|
|
|
|
- 'json'
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ // Convert the stored JSON data to a NewStructureArtistPremiumTrialRequest object
|
|
|
|
|
+ $data = $shopRequest->getData();
|
|
|
|
|
+ $trialRequest = $this->serializer->deserialize(
|
|
|
|
|
+ json_encode($data),
|
|
|
|
|
+ NewStructureArtistPremiumTrialRequest::class,
|
|
|
|
|
+ 'json'
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ $organization = $this->createOrganization($trialRequest);
|
|
|
|
|
|
|
|
- $organization = $this->createOrganization($trialRequest);
|
|
|
|
|
|
|
+ // Set the admin account password
|
|
|
|
|
+ $this->organizationFactory->setAdminAccountPassword($organization, $trialRequest->getPassword());
|
|
|
|
|
|
|
|
- // Set the admin account password
|
|
|
|
|
- $this->organizationFactory->setAdminAccountPassword($organization, $trialRequest->getPassword());
|
|
|
|
|
|
|
+ // Start the artist premium trial
|
|
|
|
|
+ $this->trial->startArtistPremiumTrialForNewStructure($organization, $trialRequest);
|
|
|
|
|
|
|
|
- // Start the artist premium trial
|
|
|
|
|
- $this->trial->startArtistPremiumTrialForNewStructure($organization, $trialRequest);
|
|
|
|
|
|
|
+ // Send email to sales administration
|
|
|
|
|
+ $this->sendMailToSalesAdministration($trialRequest);
|
|
|
|
|
|
|
|
- // Send email to sales administration
|
|
|
|
|
- $this->sendMailToSalesAdministration($trialRequest);
|
|
|
|
|
|
|
+ // Send email to representative
|
|
|
|
|
+ $this->sendConfirmationMailToRepresentative($trialRequest);
|
|
|
|
|
|
|
|
- // Send email to representative
|
|
|
|
|
- $this->sendConfirmationMailToRepresentative($trialRequest);
|
|
|
|
|
|
|
+ $this->logger->info('Successfully processed NewStructureArtistPremiumTrial for token: '.$token);
|
|
|
|
|
+ } catch (\Throwable $e) {
|
|
|
|
|
+ $shopRequest->setStatus(ShopRequestStatus::ERROR);
|
|
|
|
|
+ $this->entityManager->persist($shopRequest);
|
|
|
|
|
+ $this->entityManager->flush();
|
|
|
|
|
|
|
|
- $this->logger->info('Successfully processed NewStructureArtistPremiumTrial for token: '.$token);
|
|
|
|
|
|
|
+ $this->logger->error('Error processing NewStructureArtistPremiumTrial for token: '.$token.'. Error: '.$e->getMessage());
|
|
|
|
|
+
|
|
|
|
|
+ throw $e;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -324,7 +334,7 @@ class ShopService
|
|
|
$adminUsername = 'admin' . $trialRequest->getStructureIdentifier();
|
|
$adminUsername = 'admin' . $trialRequest->getStructureIdentifier();
|
|
|
|
|
|
|
|
// Create the admin login URL
|
|
// Create the admin login URL
|
|
|
- $adminLoginUrl = UrlBuilder::concat($this->publicAdminBaseUrl, ['#/login/']);
|
|
|
|
|
|
|
+ $adminLoginUrl = UrlBuilder::concat($this->adminBaseUrl, ['#/login/']);
|
|
|
|
|
|
|
|
// Create the email model
|
|
// Create the email model
|
|
|
$model = new ConfirmationToRepresentativeModel();
|
|
$model = new ConfirmationToRepresentativeModel();
|