fix: https instead of http

This commit is contained in:
Maël Gangloff
2024-10-02 12:01:07 +02:00
parent 81512bebb4
commit e6bf43693d
2 changed files with 37 additions and 5 deletions

View File

@@ -86,9 +86,6 @@ class GandiProvider extends AbstractProvider
}
}
/**
* @throws TransportExceptionInterface
*/
public function verifyAuthData(array $authData): array
{
$token = $authData['token'];
@@ -123,6 +120,9 @@ class GandiProvider extends AbstractProvider
return $authDataReturned;
}
/**
* @throws TransportExceptionInterface
*/
public function assertAuthentication(): void
{
$response = $this->client->request('GET', '/v5/organization/user-info', (new HttpOptions())

View File

@@ -3,9 +3,15 @@
namespace App\Service\Connector;
use App\Entity\Domain;
use Exception;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Cache\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
#[Autoconfigure(public: true)]
@@ -13,13 +19,17 @@ class NamecheapProvider extends AbstractProvider
{
public const BASE_URL = 'https://api.namecheap.com/xml.response';
public const SANDBOX_BASE_URL = 'http://api.sandbox.namecheap.com/xml.response';
public const SANDBOX_BASE_URL = 'https://api.sandbox.namecheap.com/xml.response';
public function __construct(CacheItemPoolInterface $cacheItemPool, private HttpClientInterface $client, private readonly string $outgoingIp)
{
parent::__construct($cacheItemPool);
}
/**
* @throws \Exception
* @throws TransportExceptionInterface
*/
public function orderDomain(Domain $domain, $dryRun): void
{
$addressesRes = $this->call('namecheap.users.address.getList', [], $dryRun);
@@ -51,13 +61,20 @@ class NamecheapProvider extends AbstractProvider
], $domainAddresses), $dryRun);
}
private static function mergePrefixKeys(string $prefix, array|object $src, array &$dest)
private static function mergePrefixKeys(string $prefix, array|object $src, array &$dest): void
{
foreach ($src as $key => $value) {
$dest[$prefix.$key] = $value;
}
}
/**
* @throws TransportExceptionInterface
* @throws ServerExceptionInterface
* @throws RedirectionExceptionInterface
* @throws ClientExceptionInterface
* @throws \Exception
*/
private function call(string $command, array $parameters = [], bool $dryRun = true): object
{
$actualParams = array_merge([
@@ -91,16 +108,31 @@ class NamecheapProvider extends AbstractProvider
];
}
/**
* @throws TransportExceptionInterface
* @throws ServerExceptionInterface
* @throws RedirectionExceptionInterface
* @throws ClientExceptionInterface
*/
public function assertAuthentication(): void
{
$this->call('namecheap.domains.gettldlist', [], false);
}
/**
* @throws InvalidArgumentException
*/
protected function getCachedTldList(): CacheItemInterface
{
return $this->cacheItemPool->getItem('app.provider.namecheap.supported-tld');
}
/**
* @throws TransportExceptionInterface
* @throws ServerExceptionInterface
* @throws RedirectionExceptionInterface
* @throws ClientExceptionInterface
*/
protected function getSupportedTldList(): array
{
$supported = [];