getLdhName(); if (!$ldhName) { throw new \InvalidArgumentException('Domain name cannot be null'); } $this->client->request( 'POST', '/v4/domains', (new HttpOptions()) ->setHeader('Accept', 'application/json') ->setAuthBasic($this->authData['username'], $this->authData['token']) ->setBaseUri($dryRun ? self::DEV_BASE_URL : self::BASE_URL) ->setJson([ 'domain' => [ [ 'domainName' => $domain->getLdhName(), 'locked' => false, 'autorenewEnabled' => false, ], 'purchaseType' => 'registration', 'years' => 1, // 'tldRequirements' => [] ], ]) ->toArray() )->toArray(); } public function isSupported(Domain ...$domainList): bool { return true; } protected function getSupportedTldList(): array { return []; } /** * @throws InvalidArgumentException */ protected function getCachedTldList(): CacheItemInterface { return $this->cacheItemPool->getItem('app.provider.namecom.supported-tld'); } /** * @throws TransportExceptionInterface */ protected function assertAuthentication(): void { try { $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() ); } catch (\Exception) { throw new BadRequestHttpException('Invalid Login'); } if (Response::HTTP_OK !== $response->getStatusCode()) { throw new BadRequestHttpException('The status of these credentials is not valid'); } } }