getLdhName(); if (!$ldhName) { throw new \InvalidArgumentException('Domain name cannot be null'); } $payload = [ 'admin_handle' => $this->authData->adminHandle, 'billing_handle' => $this->authData->billingHandle, 'owner_handle' => $this->authData->ownerHandle, 'tech_handle' => $this->authData->techHandle, 'domain' => [ 'name' => explode('.', $domain->getLdhName(), 2)[0], 'extension' => explode('.', $domain->getLdhName(), 2)[1], ], 'period' => '1', 'ns_group' => $this->authData->nsGroup, 'autorenew' => 'default', ]; if (null !== $this->authData->resellerHandle) { $payload['resellerHandle'] = $this->authData->resellerHandle; } $res = $this->client->request('POST', '/domain', (new HttpOptions()) ->setAuthBearer($this->authData->token) ->setHeader('Accept', 'application/json') ->setBaseUri(self::BASE_URL) ->setJson($payload)->toArray()); if ((!$dryRun && Response::HTTP_ACCEPTED !== $res->getStatusCode()) || ($dryRun && Response::HTTP_OK !== $res->getStatusCode())) { throw new HttpException($res->toArray()['message']); } } /** * @throws TransportExceptionInterface */ protected function assertAuthentication(): void { $response = $this->client->request('GET', '/customers', (new HttpOptions()) ->setAuthBearer($this->authData->token) ->setHeader('Accept', 'application/json') ->setBaseUri(self::BASE_URL) ->toArray() ); if (Response::HTTP_OK !== $response->getStatusCode()) { throw new BadRequestHttpException('The status of these credentials is not valid'); } } protected function getSupportedTldList(): array { return []; } /** * @throws \Psr\Cache\InvalidArgumentException */ protected function getCachedTldList(): CacheItemInterface { return $this->cacheItemPool->getItem('app.provider.openprovider.supported-tld'); } }