Skip to content

Commit

Permalink
Fixed name servers in domain info response.
Browse files Browse the repository at this point in the history
  • Loading branch information
teye committed Oct 18, 2023
1 parent de0b459 commit c22c4c8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 26 deletions.
26 changes: 1 addition & 25 deletions src/Dynadot/DynadotApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,31 +170,6 @@ public function getDomainInfo(string $domain): DomainResponse\Domain

// set mapping
$sabreService->elementMap = [
'{}NameServers' => function (Reader $reader) {

$nameservers = [];
$id = '';

$children = (array)$reader->parseInnerTree();

foreach ($children as $child) {
if ($child['name'] == '{}ServerId') {
$id = $child['value'];
} elseif ($child['name'] == '{}ServerName') {
if (!empty($id) && !empty($child['value'])) {
$nameserver = new DomainResponse\NameServer();

$nameserver->ServerId = $id;
$nameserver->ServerName = $child['value'];

$nameservers[] = $nameserver;
}
$id = null;
}
}

return $nameservers;
},
'{}Registrant' => $this->contactIdDeserializer,
'{}Admin' => $this->contactIdDeserializer,
'{}Technical' => $this->contactIdDeserializer,
Expand All @@ -214,6 +189,7 @@ public function getDomainInfo(string $domain): DomainResponse\Domain
$sabreService->mapValueObject('{}DomainInfoContent', DomainInfoResponse\DomainInfoContent::class);
$sabreService->mapValueObject('{}Domain', DomainResponse\Domain::class);
$sabreService->mapValueObject('{}NameServerSettings', DomainResponse\NameServerSettings::class);
$sabreService->mapValueObject('{}NameServer', DomainResponse\NameServer::class);
$sabreService->mapValueObject('{}Whois', DomainResponse\Whois::class);
$sabreService->mapValueObject('{}Folder', DomainResponse\Folder::class);
$sabreService->mapValueObject('{}Response', GeneralResponse\Response::class);
Expand Down
63 changes: 62 additions & 1 deletion tests/ApiTests/MockHttpResponses/validDomainInfoResponseBody.txt
Original file line number Diff line number Diff line change
@@ -1 +1,62 @@
<DomainInfoResponse><DomainInfoHeader><SuccessCode>0</SuccessCode><Status>success</Status></DomainInfoHeader><DomainInfoContent><Domain><Name>example.com</Name><Expiration>1512648147000</Expiration><Registration>1323259347000</Registration><NameServerSettings><Type>Name Servers</Type><NameServers><ServerId>1201</ServerId><ServerName>ns1.example.com</ServerName><ServerId>1202</ServerId><ServerName>ns2.example.com</ServerName><ServerId>1203</ServerId><ServerName>ns3.example.com</ServerName><ServerId>1204</ServerId><ServerName>ns4.example.com</ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName><ServerId></ServerId><ServerName></ServerName></NameServers></NameServerSettings><Whois><Registrant><ContactId>1301</ContactId></Registrant><Admin><ContactId>1302</ContactId></Admin><Technical><ContactId>1303</ContactId></Technical><Billing><ContactId>1304</ContactId></Billing></Whois><Locked>yes</Locked><Disabled>no</Disabled><UdrpLocked>no</UdrpLocked><RegistrantUnverified>no</RegistrantUnverified><Hold>no</Hold><Privacy>full</Privacy><isForSale>no</isForSale><RenewOption>auto-renew</RenewOption><Note></Note><Folder><FolderId>1501</FolderId><FolderName>FolderName</FolderName></Folder></Domain></DomainInfoContent></DomainInfoResponse>
<?xml version="1.0" encoding="UTF-8"?>
<DomainInfoResponse>
<DomainInfoHeader>
<ResponseCode>0</ResponseCode>
<Status>success</Status>
</DomainInfoHeader>
<DomainInfoContent>
<Domain>
<Name>123discounter.com</Name>
<Expiration>1727349773000</Expiration>
<Registration>1664191373000</Registration>
<NameServerSettings>
<Type>Name Servers</Type>
<NameServers>
<NameServer>
<ServerId>1924415</ServerId>
<ServerName>ns-859.awsdns-43.net</ServerName>
</NameServer>
<NameServer>
<ServerId>1468084</ServerId>
<ServerName>ns-1893.awsdns-44.co.uk</ServerName>
</NameServer>
<NameServer>
<ServerId>1028302</ServerId>
<ServerName>ns-1307.awsdns-35.org</ServerName>
</NameServer>
<NameServer>
<ServerId>1677079</ServerId>
<ServerName>ns-280.awsdns-35.com</ServerName>
</NameServer>
</NameServers>
</NameServerSettings>
<Whois>
<Registrant>
<ContactId>467231</ContactId>
</Registrant>
<Admin>
<ContactId>467231</ContactId>
</Admin>
<Technical>
<ContactId>467231</ContactId>
</Technical>
<Billing>
<ContactId>467231</ContactId>
</Billing>
</Whois>
<Locked>yes</Locked>
<Disabled>no</Disabled>
<UdrpLocked>no</UdrpLocked>
<RegistrantUnverified>no</RegistrantUnverified>
<Hold>no</Hold>
<Privacy>full</Privacy>
<isForSale>no</isForSale>
<RenewOption>auto-renew</RenewOption>
<Note />
<Folder>
<FolderId>-1</FolderId>
<FolderName>(no folder)</FolderName>
</Folder>
</Domain>
</DomainInfoContent>
</DomainInfoResponse>

0 comments on commit c22c4c8

Please sign in to comment.