Skip to content

Commit

Permalink
Fixed #43
Browse files Browse the repository at this point in the history
  • Loading branch information
getpinga committed Dec 29, 2023
1 parent bd5ada8 commit d5be484
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
10 changes: 9 additions & 1 deletion epp/src/EppWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ private function _info_domain($writer, $resp) {
$writer->endElement(); // End of 'resData'

// Begin the extension part if any of the extensions are present
if (isset($resp['rgpstatus']) || isset($resp['secDNS']) || isset($resp['launch_phase'])) {
if (isset($resp['rgpstatus']) || isset($resp['secDNS']) || isset($resp['launch_phase'] || isset($resp['allocation'])) {
$writer->startElement('extension');

// Handle RGP status
Expand Down Expand Up @@ -978,6 +978,14 @@ private function _info_domain($writer, $resp) {

$writer->endElement(); // End of 'launch:infData'
}

// Handle Allocation Token
if (isset($resp['allocation'])) {
$writer->startElement('allocationToken:allocationToken');
$writer->writeAttribute('xmlns:allocationToken', 'urn:ietf:params:xml:ns:allocationToken-1.0');
$writer->text($resp['allocation']);
$writer->endElement(); // End of 'allocationToken:allocationToken'
}

$writer->endElement(); // End of 'extension'
}
Expand Down
14 changes: 14 additions & 0 deletions epp/src/epp-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ function processDomainInfo($conn, $db, $xml, $trans) {
$extensionNode = $xml->command->extension;
if (isset($extensionNode)) {
$launch_info = $xml->xpath('//launch:info')[0] ?? null;
$allocation_token = $xml->xpath('//allocationToken:info')[0] ?? null;
}

$result = $xml->xpath('//domain:authInfo/domain:pw[1]');
Expand Down Expand Up @@ -476,6 +477,19 @@ function processDomainInfo($conn, $db, $xml, $trans) {
$response['rgpstatus'] = $rgpstatus;
}

if ($allocation_token !== null) {
$stmt = $db->prepare("SELECT token FROM allocation_tokens WHERE domain_name = :domainName LIMIT 1");
$stmt->bindParam(':domainName', $domainName, PDO::PARAM_STR);
$stmt->execute();
$token = $stmt->fetchColumn();

if ($token) {
$response['allocation'] = $token;
} else {
$response['allocation'] = 'ERROR';
}
}

$epp = new EPP\EppWriter();
$xml = $epp->epp_writer($response);
updateTransaction($db, 'info', 'domain', 'D_'.$domain['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
Expand Down

0 comments on commit d5be484

Please sign in to comment.