diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3df6759..295c550 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -70,6 +70,8 @@ jobs: platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ github.repository }},name-canonical=true,push=true + cache-from: type=gha + cache-to: type=gha,mode=max - name: Export digest run: | diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index f5bdf8c..9b3cbbc 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -41,3 +41,8 @@ api_platform: App\Exception\MalformedDomainException: 400 App\Exception\TldNotSupportedException: 400 App\Exception\UnknownRdapServerException: 400 + App\Exception\UnsupportedDsnScheme: 400 + + # Provider exception + App\Exception\Provider\UserNoExplicitConsentException: 451 + App\Exception\Provider\AbstractProviderException: 400 diff --git a/src/Config/ConnectorProvider.php b/src/Config/ConnectorProvider.php index 44cb789..136105b 100644 --- a/src/Config/ConnectorProvider.php +++ b/src/Config/ConnectorProvider.php @@ -2,12 +2,12 @@ namespace App\Config; -use App\Service\Connector\AutodnsProvider; -use App\Service\Connector\EppClientProvider; -use App\Service\Connector\GandiProvider; -use App\Service\Connector\NamecheapProvider; -use App\Service\Connector\NameComProvider; -use App\Service\Connector\OvhProvider; +use App\Service\Provider\AutodnsProvider; +use App\Service\Provider\EppClientProvider; +use App\Service\Provider\GandiProvider; +use App\Service\Provider\NamecheapProvider; +use App\Service\Provider\NameComProvider; +use App\Service\Provider\OvhProvider; enum ConnectorProvider: string { diff --git a/src/Controller/DomainRefreshController.php b/src/Controller/DomainRefreshController.php index 032de90..97859b4 100644 --- a/src/Controller/DomainRefreshController.php +++ b/src/Controller/DomainRefreshController.php @@ -58,7 +58,7 @@ class DomainRefreshController extends AbstractController && !$this->kernel->isDebug() && true !== filter_var($request->get('forced', false), FILTER_VALIDATE_BOOLEAN) ) { - $this->logger->info('It is not necessary to update the domain name', [ + $this->logger->debug('It is not necessary to update the domain name', [ 'ldhName' => $idnDomain, 'updatedAt' => $domain->getUpdatedAt()->format(\DateTimeInterface::ATOM), ]); diff --git a/src/Exception/DomainNotFoundException.php b/src/Exception/DomainNotFoundException.php index 5741443..c0e21f5 100644 --- a/src/Exception/DomainNotFoundException.php +++ b/src/Exception/DomainNotFoundException.php @@ -4,8 +4,8 @@ namespace App\Exception; class DomainNotFoundException extends \Exception { - public static function fromDomain(string $ldhName): DomainNotFoundException + public static function fromDomain(string $ldhName): self { - return new DomainNotFoundException("The domain name $ldhName is not present in the WHOIS database"); + return new self("The domain name $ldhName is not present in the WHOIS database"); } } diff --git a/src/Exception/MalformedDomainException.php b/src/Exception/MalformedDomainException.php index 96d18be..5843e50 100644 --- a/src/Exception/MalformedDomainException.php +++ b/src/Exception/MalformedDomainException.php @@ -4,8 +4,8 @@ namespace App\Exception; class MalformedDomainException extends \Exception { - public static function fromDomain(string $ldhName): MalformedDomainException + public static function fromDomain(string $ldhName): self { - return new MalformedDomainException("Domain name ($ldhName) must contain at least one dot"); + return new self("Domain name ($ldhName) must contain at least one dot"); } } diff --git a/src/Exception/Provider/AbstractProviderException.php b/src/Exception/Provider/AbstractProviderException.php new file mode 100644 index 0000000..1ca4af1 --- /dev/null +++ b/src/Exception/Provider/AbstractProviderException.php @@ -0,0 +1,7 @@ +logger->warning('Unable to complete purchase : an error message is sent to user', [ + $this->logger->warning('Unable to complete purchase : an error message is sent to the user', [ 'watchlist' => $message->watchListToken, 'connector' => $connector->getId(), 'ldhName' => $message->ldhName, diff --git a/src/MessageHandler/SendDomainEventNotifHandler.php b/src/MessageHandler/SendDomainEventNotifHandler.php index 9924d0b..651150a 100644 --- a/src/MessageHandler/SendDomainEventNotifHandler.php +++ b/src/MessageHandler/SendDomainEventNotifHandler.php @@ -73,22 +73,29 @@ final readonly class SendDomainEventNotifHandler /** @var WatchListTrigger $watchListTrigger */ foreach ($watchListTriggers->getIterator() as $watchListTrigger) { - $this->logger->info('New action has been detected on this domain name : a notification is sent to user', [ - 'event' => $event->getAction(), - 'ldhName' => $message->ldhName, - 'username' => $watchList->getUser()->getUserIdentifier(), - ]); - $recipient = new Recipient($watchList->getUser()->getEmail()); $notification = new DomainUpdateNotification($this->sender, $event); if (TriggerAction::SendEmail == $watchListTrigger->getAction()) { + $this->logger->info('New action has been detected on this domain name : an email is sent to user', [ + 'event' => $event->getAction(), + 'ldhName' => $message->ldhName, + 'username' => $watchList->getUser()->getUserIdentifier(), + ]); + $this->mailer->send($notification->asEmailMessage($recipient)->getMessage()); } elseif (TriggerAction::SendChat == $watchListTrigger->getAction()) { $webhookDsn = $watchList->getWebhookDsn(); if (null === $webhookDsn || 0 === count($webhookDsn)) { continue; } + + $this->logger->info('New action has been detected on this domain name : a notification is sent to user', [ + 'event' => $event->getAction(), + 'ldhName' => $message->ldhName, + 'username' => $watchList->getUser()->getUserIdentifier(), + ]); + $this->chatNotificationService->sendChatNotification($watchList, $notification); } diff --git a/src/MessageHandler/UpdateDomainsFromWatchlistHandler.php b/src/MessageHandler/UpdateDomainsFromWatchlistHandler.php index 0449792..e4a02fd 100644 --- a/src/MessageHandler/UpdateDomainsFromWatchlistHandler.php +++ b/src/MessageHandler/UpdateDomainsFromWatchlistHandler.php @@ -14,8 +14,8 @@ use App\Notifier\DomainDeletedNotification; use App\Repository\DomainRepository; use App\Repository\WatchListRepository; use App\Service\ChatNotificationService; -use App\Service\Connector\AbstractProvider; -use App\Service\Connector\CheckDomainProviderInterface; +use App\Service\Provider\AbstractProvider; +use App\Service\Provider\CheckDomainProviderInterface; use App\Service\RDAPService; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -55,7 +55,7 @@ final readonly class UpdateDomainsFromWatchlistHandler /** @var WatchList $watchList */ $watchList = $this->watchListRepository->findOneBy(['token' => $message->watchListToken]); - $this->logger->info('Domain names listed in the Watchlist will be updated', [ + $this->logger->debug('Domain names listed in the Watchlist will be updated', [ 'watchlist' => $message->watchListToken, ]); @@ -63,18 +63,19 @@ final readonly class UpdateDomainsFromWatchlistHandler $connectorProvider = $this->getConnectorProvider($watchList); if ($connectorProvider instanceof CheckDomainProviderInterface) { - $this->logger->notice('Watchlist is linked to a connector', [ + $this->logger->debug('Watchlist is linked to a connector', [ 'watchlist' => $watchList->getToken(), 'connector' => $watchList->getConnector()->getId(), ]); + $domainList = array_unique(array_map(fn (Domain $d) => $d->getLdhName(), $watchList->getDomains()->toArray())); + try { - $checkedDomains = $connectorProvider->checkDomains( - ...array_unique(array_map(fn (Domain $d) => $d->getLdhName(), $watchList->getDomains()->toArray())) - ); + $checkedDomains = $connectorProvider->checkDomains(...$domainList); } catch (\Throwable $exception) { $this->logger->warning('Unable to check domain names availability with this connector', [ 'connector' => $watchList->getConnector()->getId(), + 'ldhName' => $domainList, ]); throw $exception; diff --git a/src/MessageHandler/ValidateConnectorCredentialsHandler.php b/src/MessageHandler/ValidateConnectorCredentialsHandler.php index 3cf8074..bd999c7 100644 --- a/src/MessageHandler/ValidateConnectorCredentialsHandler.php +++ b/src/MessageHandler/ValidateConnectorCredentialsHandler.php @@ -5,7 +5,7 @@ namespace App\MessageHandler; use App\Message\ValidateConnectorCredentials; use App\Notifier\ValidateConnectorCredentialsErrorNotification; use App\Repository\ConnectorRepository; -use App\Service\Connector\AbstractProvider; +use App\Service\Provider\AbstractProvider; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Mailer\Exception\TransportExceptionInterface; diff --git a/src/Service/ChatNotificationService.php b/src/Service/ChatNotificationService.php index 08c3a25..c8788f7 100644 --- a/src/Service/ChatNotificationService.php +++ b/src/Service/ChatNotificationService.php @@ -4,10 +4,9 @@ namespace App\Service; use App\Config\WebhookScheme; use App\Entity\WatchList; +use App\Exception\UnsupportedDsnSchemeException; use App\Notifier\DomainWatchdogNotification; -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Symfony\Component\Notifier\Exception\InvalidArgumentException; +use Symfony\Component\Notifier\Exception\TransportExceptionInterface; use Symfony\Component\Notifier\Recipient\NoRecipient; use Symfony\Component\Notifier\Transport\AbstractTransportFactory; use Symfony\Component\Notifier\Transport\Dsn; @@ -15,10 +14,13 @@ use Symfony\Component\Notifier\Transport\Dsn; readonly class ChatNotificationService { public function __construct( - private LoggerInterface $logger, ) { } + /** + * @throws UnsupportedDsnSchemeException + * @throws TransportExceptionInterface + */ public function sendChatNotification(WatchList $watchList, DomainWatchdogNotification $notification): void { $webhookDsn = $watchList->getWebhookDsn(); @@ -28,17 +30,13 @@ readonly class ChatNotificationService } foreach ($webhookDsn as $dsnString) { - try { - $dsn = new Dsn($dsnString); - } catch (InvalidArgumentException $exception) { - throw new BadRequestHttpException($exception->getMessage()); - } + $dsn = new Dsn($dsnString); $scheme = $dsn->getScheme(); $webhookScheme = WebhookScheme::tryFrom($scheme); if (null === $webhookScheme) { - throw new BadRequestHttpException("The DSN scheme ($scheme) is not supported"); + throw new UnsupportedDsnSchemeException($scheme); } $transportFactoryClass = $webhookScheme->getChatTransportFactory(); @@ -48,29 +46,14 @@ readonly class ChatNotificationService $push = $notification->asPushMessage(new NoRecipient()); $chat = $notification->asChatMessage(new NoRecipient(), $webhookScheme->value); - try { - $factory = $transportFactory->create($dsn); + $factory = $transportFactory->create($dsn); - if ($factory->supports($push)) { - $factory->send($push); - } elseif ($factory->supports($chat)) { - $factory->send($chat); - } else { - throw new BadRequestHttpException('Unsupported message type'); - } - - $this->logger->info('Chat message sent', [ - 'username' => $watchList->getUser()->getUserIdentifier(), - 'scheme' => $webhookScheme->name, - 'watchlist' => $watchList->getToken(), - ]); - } catch (\Throwable $exception) { - $this->logger->error('Unable to send a chat message', [ - 'username' => $watchList->getUser()->getUserIdentifier(), - 'scheme' => $webhookScheme->name, - 'watchlist' => $watchList->getToken(), - ]); - throw new BadRequestHttpException($exception->getMessage()); + if ($factory->supports($push)) { + $factory->send($push); + } elseif ($factory->supports($chat)) { + $factory->send($chat); + } else { + throw new \InvalidArgumentException('Unsupported message type'); } } } diff --git a/src/Service/Connector/AbstractProvider.php b/src/Service/Provider/AbstractProvider.php similarity index 94% rename from src/Service/Connector/AbstractProvider.php rename to src/Service/Provider/AbstractProvider.php index 1daae4e..f49e537 100644 --- a/src/Service/Connector/AbstractProvider.php +++ b/src/Service/Provider/AbstractProvider.php @@ -1,9 +1,10 @@ client->request( - 'GET', - '/v1/hello', - (new HttpOptions()) - ->setAuthBasic($this->authData->username, $this->authData->password) - ->setHeader('Accept', 'application/json') - ->setHeader('X-Domainrobot-Context', (string) $this->authData->context) - ->setBaseUri(self::BASE_URL) - ->toArray() - ); - } catch (\Exception) { - throw new BadRequestHttpException('Invalid Login'); - } + $response = $this->client->request( + 'GET', + '/v1/hello', + (new HttpOptions()) + ->setAuthBasic($this->authData->username, $this->authData->password) + ->setHeader('Accept', 'application/json') + ->setHeader('X-Domainrobot-Context', (string) $this->authData->context) + ->setBaseUri(self::BASE_URL) + ->toArray() + ); if (Response::HTTP_OK !== $response->getStatusCode()) { - throw new BadRequestHttpException('The status of these credentials is not valid'); + throw InvalidLoginException::fromIdentifier($this->authData->username); } } } diff --git a/src/Service/Connector/CheckDomainProviderInterface.php b/src/Service/Provider/CheckDomainProviderInterface.php similarity index 77% rename from src/Service/Connector/CheckDomainProviderInterface.php rename to src/Service/Provider/CheckDomainProviderInterface.php index f0bc649..25e8c73 100644 --- a/src/Service/Connector/CheckDomainProviderInterface.php +++ b/src/Service/Provider/CheckDomainProviderInterface.php @@ -1,6 +1,6 @@ eppClient->request(new eppCheckContactRequest($contacts)); foreach ($resp->getCheckedContacts() as $contact => $available) { if ($available) { - throw new BadRequestHttpException("At least one of the entered contacts cannot be used because it is indicated as available ($contact)."); + throw EppContactIsAvailableException::fromContact($contact); } } diff --git a/src/Service/Connector/GandiProvider.php b/src/Service/Provider/GandiProvider.php similarity index 93% rename from src/Service/Connector/GandiProvider.php rename to src/Service/Provider/GandiProvider.php index 5f34bf9..6bfe0f9 100644 --- a/src/Service/Connector/GandiProvider.php +++ b/src/Service/Provider/GandiProvider.php @@ -1,17 +1,17 @@ getStatusCode()) || ($dryRun && Response::HTTP_OK !== $res->getStatusCode())) { - throw new HttpException($res->toArray()['message']); + throw new DomainOrderFailedExeption($res->toArray()['message']); } } /** * @throws TransportExceptionInterface + * @throws InvalidLoginException */ protected function assertAuthentication(): void { @@ -111,7 +112,7 @@ class GandiProvider extends AbstractProvider ); if (Response::HTTP_OK !== $response->getStatusCode()) { - throw new BadRequestHttpException('The status of these credentials is not valid'); + throw new InvalidLoginException(); } } diff --git a/src/Service/Connector/NameComProvider.php b/src/Service/Provider/NameComProvider.php similarity index 82% rename from src/Service/Connector/NameComProvider.php rename to src/Service/Provider/NameComProvider.php index 40a9826..866158b 100644 --- a/src/Service/Connector/NameComProvider.php +++ b/src/Service/Provider/NameComProvider.php @@ -1,17 +1,17 @@ client->request( - 'GET', - '/v4/hello', - (new HttpOptions()) - ->setHeader('Accept', 'application/json') - ->setAuthBasic($this->authData->username, $this->authData->token) - ->setBaseUri($this->kernel->isDebug() ? self::DEV_BASE_URL : self::BASE_URL) - ->toArray() - ); - } catch (\Exception) { - throw new BadRequestHttpException('Invalid Login'); - } + $response = $this->client->request( + 'GET', + '/v4/hello', + (new HttpOptions()) + ->setHeader('Accept', 'application/json') + ->setAuthBasic($this->authData->username, $this->authData->token) + ->setBaseUri($this->kernel->isDebug() ? self::DEV_BASE_URL : self::BASE_URL) + ->toArray() + ); if (Response::HTTP_OK !== $response->getStatusCode()) { - throw new BadRequestHttpException('The status of these credentials is not valid'); + throw InvalidLoginException::fromIdentifier($this->authData->username); } } } diff --git a/src/Service/Connector/NamecheapProvider.php b/src/Service/Provider/NamecheapProvider.php similarity index 92% rename from src/Service/Connector/NamecheapProvider.php rename to src/Service/Provider/NamecheapProvider.php index 930e0f4..1a0a5eb 100644 --- a/src/Service/Connector/NamecheapProvider.php +++ b/src/Service/Provider/NamecheapProvider.php @@ -1,15 +1,16 @@ call('namecheap.users.address.getList', [], $dryRun)->AddressGetListResult->List; if (count($addresses) < 1) { - throw new BadRequestHttpException('Namecheap account requires at least one address to purchase a domain'); + throw new NamecheapRequiresAddressException(); } $addressId = (string) $addresses->attributes()['AddressId']; @@ -105,7 +106,7 @@ class NamecheapProvider extends AbstractProvider $data = new \SimpleXMLElement($response->getContent()); if ($data->Errors->Error) { - throw new BadRequestHttpException($data->Errors->Error); + throw new ProviderGenericErrorException($data->Errors->Error); } return $data->CommandResponse; @@ -116,13 +117,14 @@ class NamecheapProvider extends AbstractProvider * @throws ServerExceptionInterface * @throws RedirectionExceptionInterface * @throws ClientExceptionInterface + * @throws NamecheapRequiresAddressException */ protected function assertAuthentication(): void { $addresses = $this->call('namecheap.users.address.getList', [], false)->AddressGetListResult->List; if (count($addresses) < 1) { - throw new BadRequestHttpException('Namecheap account requires at least one address to purchase a domain'); + throw new NamecheapRequiresAddressException(); } } diff --git a/src/Service/Connector/OvhProvider.php b/src/Service/Provider/OvhProvider.php similarity index 89% rename from src/Service/Connector/OvhProvider.php rename to src/Service/Provider/OvhProvider.php index 86b59af..92ed679 100644 --- a/src/Service/Connector/OvhProvider.php +++ b/src/Service/Provider/OvhProvider.php @@ -1,10 +1,15 @@ delete("/order/cart/{$cartId}"); - throw new \InvalidArgumentException('Cannot buy this domain name'); + throw new DomainOrderFailedExeption(); } $item = $conn->post("/order/cart/{$cartId}/domain", [ @@ -153,15 +157,15 @@ class OvhProvider extends AbstractProvider try { $res = $conn->get('/auth/currentCredential'); if (null !== $res['expiration'] && new \DateTimeImmutable($res['expiration']) < new \DateTimeImmutable()) { - throw new BadRequestHttpException('These credentials have expired'); + throw ExpiredLoginException::fromIdentifier($this->authData->appKey); } $status = $res['status']; if ('validated' !== $status) { - throw new BadRequestHttpException("The status of these credentials is not valid ($status)"); + throw InvalidLoginStatusException::fromStatus($status); } } catch (ClientException $exception) { - throw new BadRequestHttpException($exception->getMessage()); + throw new ProviderGenericErrorException($exception->getMessage()); } foreach (self::REQUIRED_ROUTES as $requiredRoute) { @@ -177,7 +181,7 @@ class OvhProvider extends AbstractProvider } if (!$ok) { - throw new BadRequestHttpException('This Connector does not have enough permissions on the Provider API. Please recreate this Connector.'); + throw PermissionErrorException::fromIdentifier($this->authData->appKey); } } } diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index d8e1b9d..18dabe8 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -119,7 +119,7 @@ class RDAPService $idnDomain = RDAPService::convertToIdn($fqdn); $tld = $this->getTld($idnDomain); - $this->logger->info('Update request for a domain name is requested', [ + $this->logger->debug('Update request for a domain name is requested', [ 'ldhName' => $idnDomain, ]); @@ -187,7 +187,7 @@ class RDAPService $tldEntity = $this->tldRepository->findOneBy(['tld' => $tld, 'deletedAt' => null]); if (null === $tldEntity) { - $this->logger->warning('Domain name cannot be updated because the TLD is not supported', [ + $this->logger->debug('Domain name cannot be updated because the TLD is not supported', [ 'ldhName' => $domain, ]); throw TldNotSupportedException::fromTld($tld); @@ -210,7 +210,7 @@ class RDAPService $rdapServer = $this->rdapServerRepository->findOneBy(['tld' => $tldString], ['updatedAt' => 'DESC']); if (null === $rdapServer) { - $this->logger->warning('Unable to determine which RDAP server to contact', [ + $this->logger->debug('Unable to determine which RDAP server to contact', [ 'tld' => $tldString, ]); @@ -231,7 +231,7 @@ class RDAPService private function fetchRdapResponse(RdapServer $rdapServer, string $idnDomain, ?Domain $domain): array { $rdapServerUrl = $rdapServer->getUrl(); - $this->logger->notice('An RDAP query to update this domain name will be made', [ + $this->logger->info('An RDAP query to update this domain name will be made', [ 'ldhName' => $idnDomain, 'server' => $rdapServerUrl, ]); @@ -261,7 +261,7 @@ class RDAPService || ($e instanceof TransportExceptionInterface && null !== $response && !in_array('content-length', $response->getHeaders(false)) && 404 === $response->getStatusCode()) ) { if (null !== $domain) { - $this->logger->notice('Domain name has been deleted from the WHOIS database', [ + $this->logger->info('Domain name has been deleted from the WHOIS database', [ 'ldhName' => $idnDomain, ]); @@ -295,7 +295,7 @@ class RDAPService { $domain = new Domain(); - $this->logger->info('Domain name was not known to this instance', [ + $this->logger->debug('Domain name was not known to this instance', [ 'ldhName' => $idnDomain, ]); @@ -304,7 +304,7 @@ class RDAPService private function updateDomainStatus(Domain $domain, array $rdapData): void { - if (isset($rdapData['status'])) { + if (isset($rdapData['status']) && is_array($rdapData['status'])) { $status = array_unique($rdapData['status']); $addedStatus = array_diff($status, $domain->getStatus()); $deletedStatus = array_diff($domain->getStatus(), $status); @@ -429,7 +429,7 @@ class RDAPService */ private function updateDomainNameservers(Domain $domain, array $rdapData): void { - if (array_key_exists('nameservers', $rdapData) && is_array($rdapData['nameservers'])) { + if (isset($rdapData['nameservers']) && is_array($rdapData['nameservers'])) { $domain->getNameservers()->clear(); $this->em->persist($domain); @@ -549,7 +549,7 @@ class RDAPService if (null === $entity) { $entity = (new Entity())->setTld($tld); - $this->logger->info('Entity was not known to this instance', [ + $this->logger->debug('Entity was not known to this instance', [ 'handle' => $rdapEntity['handle'], 'ldhName' => $domain, ]); diff --git a/src/State/ConnectorCreateProcessor.php b/src/State/ConnectorCreateProcessor.php index 16b5242..6f632d2 100644 --- a/src/State/ConnectorCreateProcessor.php +++ b/src/State/ConnectorCreateProcessor.php @@ -7,8 +7,8 @@ use ApiPlatform\State\ProcessorInterface; use App\Config\ConnectorProvider; use App\Entity\Connector; use App\Entity\User; -use App\Service\Connector\AbstractProvider; -use App\Service\Connector\EppClientProvider; +use App\Service\Provider\AbstractProvider; +use App\Service\Provider\EppClientProvider; use Psr\Log\LoggerInterface; use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\DependencyInjection\Attribute\Autowire; diff --git a/src/State/ConnectorDeleteProcessor.php b/src/State/ConnectorDeleteProcessor.php index 9f2ff14..7d35fd4 100644 --- a/src/State/ConnectorDeleteProcessor.php +++ b/src/State/ConnectorDeleteProcessor.php @@ -6,7 +6,7 @@ use ApiPlatform\Metadata\Operation; use ApiPlatform\State\ProcessorInterface; use App\Config\ConnectorProvider; use App\Entity\Connector; -use App\Service\Connector\EppClientProvider; +use App\Service\Provider\EppClientProvider; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; diff --git a/src/State/WatchListUpdateProcessor.php b/src/State/WatchListUpdateProcessor.php index 6221c66..79ee9b8 100644 --- a/src/State/WatchListUpdateProcessor.php +++ b/src/State/WatchListUpdateProcessor.php @@ -9,7 +9,7 @@ use App\Entity\User; use App\Entity\WatchList; use App\Notifier\TestChatNotification; use App\Service\ChatNotificationService; -use App\Service\Connector\AbstractProvider; +use App\Service\Provider\AbstractProvider; use Psr\Log\LoggerInterface; use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -68,7 +68,7 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface foreach ($data->getDomains()->getIterator() as $domain) { if (in_array($domain, $trackedDomains)) { $ldhName = $domain->getLdhName(); - $this->logger->notice('User tried to update a watchlist : it is forbidden to register the same domain name twice with limited mode', [ + $this->logger->notice('User tried to update a Watchlist : it is forbidden to register the same domain name twice with limited mode', [ 'username' => $user->getUserIdentifier(), 'watchlist' => $data->getToken(), 'ldhName' => $ldhName, @@ -117,7 +117,7 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface $supported = $connectorProvider->isSupported(...$data->getDomains()->toArray()); if (!$supported) { - $this->logger->notice('Connector does not support all TLDs in this Watchlist', [ + $this->logger->debug('Connector does not support all TLDs in this Watchlist', [ 'username' => $user->getUserIdentifier(), 'connector' => $connector->getId(), 'provider' => $connector->getProvider()->value,