mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-28 07:03:28 +02:00
Added launch phase delete for EPP
This commit is contained in:
parent
de119b013f
commit
7e34dd7501
5 changed files with 196 additions and 169 deletions
|
@ -1325,35 +1325,6 @@ class ApplicationsController extends Controller
|
||||||
try {
|
try {
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
|
|
||||||
$hostIds = $db->select(
|
|
||||||
'SELECT id FROM host WHERE domain_id = ?',
|
|
||||||
[$domain_id]
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($hostIds as $host) {
|
|
||||||
$host_id = $host['id'];
|
|
||||||
|
|
||||||
// Delete operations
|
|
||||||
$db->delete(
|
|
||||||
'host_addr',
|
|
||||||
[
|
|
||||||
'host_id' => $host_id
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$db->delete(
|
|
||||||
'host_status',
|
|
||||||
[
|
|
||||||
'host_id' => $host_id
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$db->delete(
|
|
||||||
'application_host_map',
|
|
||||||
[
|
|
||||||
'host_id' => $host_id
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete domain related records
|
// Delete domain related records
|
||||||
$db->delete(
|
$db->delete(
|
||||||
'application_contact_map',
|
'application_contact_map',
|
||||||
|
|
|
@ -577,6 +577,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$extensionNode = $xml->command->extension;
|
$extensionNode = $xml->command->extension;
|
||||||
if (isset($extensionNode)) {
|
if (isset($extensionNode)) {
|
||||||
$fee_create = $xml->xpath('//fee:create')[0] ?? null;
|
$fee_create = $xml->xpath('//fee:create')[0] ?? null;
|
||||||
|
$launch_create = $xml->xpath('//launch:create')[0] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = extractDomainAndTLD($domainName);
|
$parts = extractDomainAndTLD($domainName);
|
||||||
|
|
|
@ -169,6 +169,11 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$domainName = $xml->command->delete->children('urn:ietf:params:xml:ns:domain-1.0')->delete->name;
|
$domainName = $xml->command->delete->children('urn:ietf:params:xml:ns:domain-1.0')->delete->name;
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
|
||||||
|
$extensionNode = $xml->command->extension;
|
||||||
|
if (isset($extensionNode)) {
|
||||||
|
$launch_delete = $xml->xpath('//launch:delete')[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$domainName) {
|
if (!$domainName) {
|
||||||
sendEppError($conn, $db, 2003, 'Please specify the domain name that will be deleted', $clTRID, $trans);
|
sendEppError($conn, $db, 2003, 'Please specify the domain name that will be deleted', $clTRID, $trans);
|
||||||
return;
|
return;
|
||||||
|
@ -181,7 +186,11 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT id, tldid, registrant, crdate, exdate, clid, crid, upid, trdate, trstatus, reid, redate, acid, acdate, rgpstatus, addPeriod, autoRenewPeriod, renewPeriod, renewedDate, transferPeriod FROM domain WHERE name = :name LIMIT 1");
|
if (isset($launch_delete)) {
|
||||||
|
$stmt = $db->prepare("SELECT id, tldid, registrant, crdate, exdate, clid, crid, upid, trdate, trstatus, reid, redate, acid, acdate, rgpstatus, addPeriod, autoRenewPeriod, renewPeriod, renewedDate, transferPeriod FROM application WHERE name = :name LIMIT 1");
|
||||||
|
} else {
|
||||||
|
$stmt = $db->prepare("SELECT id, tldid, registrant, crdate, exdate, clid, crid, upid, trdate, trstatus, reid, redate, acid, acdate, rgpstatus, addPeriod, autoRenewPeriod, renewPeriod, renewedDate, transferPeriod FROM domain WHERE name = :name LIMIT 1");
|
||||||
|
}
|
||||||
$stmt->execute([':name' => $domainName]);
|
$stmt->execute([':name' => $domainName]);
|
||||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
@ -222,144 +231,77 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT status FROM domain_status WHERE domain_id = :domain_id");
|
if (!isset($launch_delete)) {
|
||||||
$stmt->execute([':domain_id' => $domain_id]);
|
$stmt = $db->prepare("SELECT status FROM domain_status WHERE domain_id = :domain_id");
|
||||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
$stmt->execute([':domain_id' => $domain_id]);
|
||||||
$status = $row['status'];
|
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) {
|
$status = $row['status'];
|
||||||
sendEppError($conn, $db, 2304, 'The domain name has a status that does not allow deletion', $clTRID, $trans);
|
if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) {
|
||||||
return;
|
sendEppError($conn, $db, 2304, 'The domain name has a status that does not allow deletion', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$grace_period = 30;
|
if (isset($launch_delete)) {
|
||||||
|
$phaseType = (string) $launch_delete->children('urn:ietf:params:xml:ns:launch-1.0')->phase;
|
||||||
|
$applicationID = (string) $launch_delete->children('urn:ietf:params:xml:ns:launch-1.0')->applicationID;
|
||||||
|
|
||||||
// DELETE FROM domain_status
|
$stmt = $db->prepare("SELECT id FROM application WHERE name = ? AND phase_type = ? AND application_id = ? LIMIT 1");
|
||||||
$stmt = $db->prepare("DELETE FROM domain_status WHERE domain_id = ?");
|
$stmt->execute([$domainName, $phaseType, $applicationID]);
|
||||||
$stmt->execute([$domain_id]);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// UPDATE domain
|
if (!$result) {
|
||||||
$stmt = $db->prepare("UPDATE domain SET rgpstatus = 'redemptionPeriod', delTime = DATE_ADD(CURRENT_TIMESTAMP(3), INTERVAL ? DAY) WHERE id = ?");
|
sendEppError($conn, $db, 2306, "Please verify the launch phase and/or the application ID", $clTRID, $trans);
|
||||||
$stmt->execute([$grace_period, $domain_id]);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// INSERT INTO domain_status
|
// Delete application related records
|
||||||
$stmt = $db->prepare("INSERT INTO domain_status (domain_id, status) VALUES(?, 'pendingDelete')");
|
$db->exec("DELETE FROM application_contact_map WHERE domain_id = $domain_id");
|
||||||
$stmt->execute([$domain_id]);
|
$db->exec("DELETE FROM application_host_map WHERE domain_id = $domain_id");
|
||||||
|
$db->exec("DELETE FROM application_status WHERE domain_id = $domain_id");
|
||||||
|
|
||||||
if ($rgpstatus) {
|
$stmt = $db->prepare("DELETE FROM application WHERE id = ?");
|
||||||
if ($rgpstatus === 'addPeriod') {
|
$stmt->execute([$domain_id]);
|
||||||
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(crdate, INTERVAL 5 DAY)) LIMIT 1");
|
|
||||||
$stmt->execute([$domain_id]);
|
|
||||||
$addPeriod_id = $stmt->fetchColumn();
|
|
||||||
|
|
||||||
if ($addPeriod_id) {
|
if ($stmt->errorCode() != "00000") {
|
||||||
$returnValue = getDomainPrice($db, $domainName, $tldid, $addPeriod, 'create');
|
sendEppError($conn, $db, 2400, 'The application has not been deleted, it has something to do with other objects', $clTRID, $trans);
|
||||||
$price = $returnValue['price'];
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($price)) {
|
$svTRID = generateSvTRID();
|
||||||
sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans);
|
$response = [
|
||||||
return;
|
'command' => 'delete_domain',
|
||||||
}
|
'resultCode' => 1000,
|
||||||
|
'lang' => 'en-US',
|
||||||
|
'message' => 'Command completed successfully',
|
||||||
|
'clTRID' => $clTRID,
|
||||||
|
'svTRID' => $svTRID,
|
||||||
|
];
|
||||||
|
|
||||||
// Update registrar
|
} else {
|
||||||
$stmt = $db->prepare("UPDATE registrar SET accountBalance = (accountBalance + ?) WHERE id = ?");
|
$grace_period = 30;
|
||||||
$stmt->execute([$price, $clid]);
|
|
||||||
|
|
||||||
// Insert into payment_history
|
// DELETE FROM domain_status
|
||||||
$description = "domain name is deleted by the registrar during grace addPeriod, the registry provides a credit for the cost of the registration domain $domainName for period $addPeriod MONTH";
|
$stmt = $db->prepare("DELETE FROM domain_status WHERE domain_id = ?");
|
||||||
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
$stmt->execute([$domain_id]);
|
||||||
$stmt->execute([$clid, $description, $price]);
|
|
||||||
|
|
||||||
// Fetch host ids
|
// UPDATE domain
|
||||||
$stmt = $db->prepare("SELECT id FROM host WHERE domain_id = ?");
|
$stmt = $db->prepare("UPDATE domain SET rgpstatus = 'redemptionPeriod', delTime = DATE_ADD(CURRENT_TIMESTAMP(3), INTERVAL ? DAY) WHERE id = ?");
|
||||||
|
$stmt->execute([$grace_period, $domain_id]);
|
||||||
|
|
||||||
|
// INSERT INTO domain_status
|
||||||
|
$stmt = $db->prepare("INSERT INTO domain_status (domain_id, status) VALUES(?, 'pendingDelete')");
|
||||||
|
$stmt->execute([$domain_id]);
|
||||||
|
|
||||||
|
if ($rgpstatus) {
|
||||||
|
if ($rgpstatus === 'addPeriod') {
|
||||||
|
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(crdate, INTERVAL 5 DAY)) LIMIT 1");
|
||||||
$stmt->execute([$domain_id]);
|
$stmt->execute([$domain_id]);
|
||||||
|
$addPeriod_id = $stmt->fetchColumn();
|
||||||
|
|
||||||
while ($host_id = $stmt->fetchColumn()) {
|
if ($addPeriod_id) {
|
||||||
$db->exec("DELETE FROM host_addr WHERE host_id = $host_id");
|
$returnValue = getDomainPrice($db, $domainName, $tldid, $addPeriod, 'create');
|
||||||
$db->exec("DELETE FROM host_status WHERE host_id = $host_id");
|
|
||||||
$db->exec("DELETE FROM domain_host_map WHERE host_id = $host_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete domain related records
|
|
||||||
$db->exec("DELETE FROM domain_contact_map WHERE domain_id = $domain_id");
|
|
||||||
$db->exec("DELETE FROM domain_host_map WHERE domain_id = $domain_id");
|
|
||||||
$db->exec("DELETE FROM domain_authInfo WHERE domain_id = $domain_id");
|
|
||||||
$db->exec("DELETE FROM domain_status WHERE domain_id = $domain_id");
|
|
||||||
$db->exec("DELETE FROM secdns WHERE domain_id = $domain_id");
|
|
||||||
$db->exec("DELETE FROM host WHERE domain_id = $domain_id");
|
|
||||||
|
|
||||||
$stmt = $db->prepare("DELETE FROM domain WHERE id = ?");
|
|
||||||
$stmt->execute([$domain_id]);
|
|
||||||
|
|
||||||
if ($stmt->errorCode() != "00000") {
|
|
||||||
sendEppError($conn, $db, 2400, 'The domain name has not been deleted, it has something to do with other objects', $clTRID, $trans);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle statistics
|
|
||||||
$curdate_id = $db->query("SELECT id FROM statistics WHERE date = CURDATE()")->fetchColumn();
|
|
||||||
|
|
||||||
if (!$curdate_id) {
|
|
||||||
$db->exec("INSERT IGNORE INTO statistics (date) VALUES(CURDATE())");
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->exec("UPDATE statistics SET deleted_domains = deleted_domains + 1 WHERE date = CURDATE()");
|
|
||||||
}
|
|
||||||
} elseif ($rgpstatus === 'autoRenewPeriod') {
|
|
||||||
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(renewedDate, INTERVAL 45 DAY)) LIMIT 1");
|
|
||||||
$stmt->execute([$domain_id]);
|
|
||||||
$autoRenewPeriod_id = $stmt->fetchColumn();
|
|
||||||
|
|
||||||
if ($autoRenewPeriod_id) {
|
|
||||||
$returnValue = getDomainPrice($db, $domainName, $tldid, $autoRenewPeriod, 'renew');
|
|
||||||
$price = $returnValue['price'];
|
|
||||||
|
|
||||||
if (!isset($price)) {
|
|
||||||
sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update registrar
|
|
||||||
$stmt = $db->prepare("UPDATE registrar SET accountBalance = (accountBalance + ?) WHERE id = ?");
|
|
||||||
$stmt->execute([$price, $clid]);
|
|
||||||
|
|
||||||
// Insert into payment_history
|
|
||||||
$description = "domain name is deleted by the registrar during grace autoRenewPeriod, the registry provides a credit for the cost of the renewal domain $domainName for period $autoRenewPeriod MONTH";
|
|
||||||
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
|
||||||
$stmt->execute([$clid, $description, $price]);
|
|
||||||
}
|
|
||||||
} elseif ($rgpstatus === 'renewPeriod') {
|
|
||||||
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(renewedDate, INTERVAL 5 DAY)) LIMIT 1");
|
|
||||||
$stmt->execute([$domain_id]);
|
|
||||||
$renewPeriod_id = $stmt->fetchColumn();
|
|
||||||
|
|
||||||
if ($renewPeriod_id) {
|
|
||||||
$returnValue = getDomainPrice($db, $domainName, $tldid, $renewPeriod, 'renew');
|
|
||||||
$price = $returnValue['price'];
|
|
||||||
|
|
||||||
if (!isset($price)) {
|
|
||||||
sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update registrar
|
|
||||||
$stmt = $db->prepare("UPDATE registrar SET accountBalance = (accountBalance + ?) WHERE id = ?");
|
|
||||||
$stmt->execute([$price, $clid]);
|
|
||||||
|
|
||||||
// Insert into payment_history
|
|
||||||
$description = "domain name is deleted by the registrar during grace renewPeriod, the registry provides a credit for the cost of the renewal domain $domainName for period $renewPeriod MONTH";
|
|
||||||
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
|
||||||
$stmt->execute([$clid, $description, $price]);
|
|
||||||
}
|
|
||||||
} elseif ($rgpstatus === 'transferPeriod') {
|
|
||||||
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(trdate, INTERVAL 5 DAY)) LIMIT 1");
|
|
||||||
$stmt->execute([$domain_id]);
|
|
||||||
$transferPeriod_id = $stmt->fetchColumn();
|
|
||||||
|
|
||||||
if ($transferPeriod_id) {
|
|
||||||
// Return money if a transfer was also a renew
|
|
||||||
if ($transferPeriod > 0) {
|
|
||||||
$returnValue = getDomainPrice($db, $domainName, $tldid, $transferPeriod, 'renew');
|
|
||||||
$price = $returnValue['price'];
|
$price = $returnValue['price'];
|
||||||
|
|
||||||
if (!isset($price)) {
|
if (!isset($price)) {
|
||||||
|
@ -372,23 +314,130 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$stmt->execute([$price, $clid]);
|
$stmt->execute([$price, $clid]);
|
||||||
|
|
||||||
// Insert into payment_history
|
// Insert into payment_history
|
||||||
$description = "domain name is deleted by the registrar during grace transferPeriod, the registry provides a credit for the cost of the transfer domain $domainName for period $transferPeriod MONTH";
|
$description = "domain name is deleted by the registrar during grace addPeriod, the registry provides a credit for the cost of the registration domain $domainName for period $addPeriod MONTH";
|
||||||
|
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
||||||
|
$stmt->execute([$clid, $description, $price]);
|
||||||
|
|
||||||
|
// Fetch host ids
|
||||||
|
$stmt = $db->prepare("SELECT id FROM host WHERE domain_id = ?");
|
||||||
|
$stmt->execute([$domain_id]);
|
||||||
|
|
||||||
|
while ($host_id = $stmt->fetchColumn()) {
|
||||||
|
$db->exec("DELETE FROM host_addr WHERE host_id = $host_id");
|
||||||
|
$db->exec("DELETE FROM host_status WHERE host_id = $host_id");
|
||||||
|
$db->exec("DELETE FROM domain_host_map WHERE host_id = $host_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete domain related records
|
||||||
|
$db->exec("DELETE FROM domain_contact_map WHERE domain_id = $domain_id");
|
||||||
|
$db->exec("DELETE FROM domain_host_map WHERE domain_id = $domain_id");
|
||||||
|
$db->exec("DELETE FROM domain_authInfo WHERE domain_id = $domain_id");
|
||||||
|
$db->exec("DELETE FROM domain_status WHERE domain_id = $domain_id");
|
||||||
|
$db->exec("DELETE FROM secdns WHERE domain_id = $domain_id");
|
||||||
|
$db->exec("DELETE FROM host WHERE domain_id = $domain_id");
|
||||||
|
|
||||||
|
$stmt = $db->prepare("DELETE FROM domain WHERE id = ?");
|
||||||
|
$stmt->execute([$domain_id]);
|
||||||
|
|
||||||
|
if ($stmt->errorCode() != "00000") {
|
||||||
|
sendEppError($conn, $db, 2400, 'The domain name has not been deleted, it has something to do with other objects', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle statistics
|
||||||
|
$curdate_id = $db->query("SELECT id FROM statistics WHERE date = CURDATE()")->fetchColumn();
|
||||||
|
|
||||||
|
if (!$curdate_id) {
|
||||||
|
$db->exec("INSERT IGNORE INTO statistics (date) VALUES(CURDATE())");
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->exec("UPDATE statistics SET deleted_domains = deleted_domains + 1 WHERE date = CURDATE()");
|
||||||
|
}
|
||||||
|
} elseif ($rgpstatus === 'autoRenewPeriod') {
|
||||||
|
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(renewedDate, INTERVAL 45 DAY)) LIMIT 1");
|
||||||
|
$stmt->execute([$domain_id]);
|
||||||
|
$autoRenewPeriod_id = $stmt->fetchColumn();
|
||||||
|
|
||||||
|
if ($autoRenewPeriod_id) {
|
||||||
|
$returnValue = getDomainPrice($db, $domainName, $tldid, $autoRenewPeriod, 'renew');
|
||||||
|
$price = $returnValue['price'];
|
||||||
|
|
||||||
|
if (!isset($price)) {
|
||||||
|
sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update registrar
|
||||||
|
$stmt = $db->prepare("UPDATE registrar SET accountBalance = (accountBalance + ?) WHERE id = ?");
|
||||||
|
$stmt->execute([$price, $clid]);
|
||||||
|
|
||||||
|
// Insert into payment_history
|
||||||
|
$description = "domain name is deleted by the registrar during grace autoRenewPeriod, the registry provides a credit for the cost of the renewal domain $domainName for period $autoRenewPeriod MONTH";
|
||||||
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
||||||
$stmt->execute([$clid, $description, $price]);
|
$stmt->execute([$clid, $description, $price]);
|
||||||
}
|
}
|
||||||
|
} elseif ($rgpstatus === 'renewPeriod') {
|
||||||
|
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(renewedDate, INTERVAL 5 DAY)) LIMIT 1");
|
||||||
|
$stmt->execute([$domain_id]);
|
||||||
|
$renewPeriod_id = $stmt->fetchColumn();
|
||||||
|
|
||||||
|
if ($renewPeriod_id) {
|
||||||
|
$returnValue = getDomainPrice($db, $domainName, $tldid, $renewPeriod, 'renew');
|
||||||
|
$price = $returnValue['price'];
|
||||||
|
|
||||||
|
if (!isset($price)) {
|
||||||
|
sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update registrar
|
||||||
|
$stmt = $db->prepare("UPDATE registrar SET accountBalance = (accountBalance + ?) WHERE id = ?");
|
||||||
|
$stmt->execute([$price, $clid]);
|
||||||
|
|
||||||
|
// Insert into payment_history
|
||||||
|
$description = "domain name is deleted by the registrar during grace renewPeriod, the registry provides a credit for the cost of the renewal domain $domainName for period $renewPeriod MONTH";
|
||||||
|
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
||||||
|
$stmt->execute([$clid, $description, $price]);
|
||||||
|
}
|
||||||
|
} elseif ($rgpstatus === 'transferPeriod') {
|
||||||
|
$stmt = $db->prepare("SELECT id FROM domain WHERE id = ? AND (CURRENT_TIMESTAMP(3) < DATE_ADD(trdate, INTERVAL 5 DAY)) LIMIT 1");
|
||||||
|
$stmt->execute([$domain_id]);
|
||||||
|
$transferPeriod_id = $stmt->fetchColumn();
|
||||||
|
|
||||||
|
if ($transferPeriod_id) {
|
||||||
|
// Return money if a transfer was also a renew
|
||||||
|
if ($transferPeriod > 0) {
|
||||||
|
$returnValue = getDomainPrice($db, $domainName, $tldid, $transferPeriod, 'renew');
|
||||||
|
$price = $returnValue['price'];
|
||||||
|
|
||||||
|
if (!isset($price)) {
|
||||||
|
sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update registrar
|
||||||
|
$stmt = $db->prepare("UPDATE registrar SET accountBalance = (accountBalance + ?) WHERE id = ?");
|
||||||
|
$stmt->execute([$price, $clid]);
|
||||||
|
|
||||||
|
// Insert into payment_history
|
||||||
|
$description = "domain name is deleted by the registrar during grace transferPeriod, the registry provides a credit for the cost of the transfer domain $domainName for period $transferPeriod MONTH";
|
||||||
|
$stmt = $db->prepare("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES(?, CURRENT_TIMESTAMP(3), ?, ?)");
|
||||||
|
$stmt->execute([$clid, $description, $price]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$svTRID = generateSvTRID();
|
$svTRID = generateSvTRID();
|
||||||
$response = [
|
$response = [
|
||||||
'command' => 'delete_domain',
|
'command' => 'delete_domain',
|
||||||
'resultCode' => 1001,
|
'resultCode' => 1001,
|
||||||
'lang' => 'en-US',
|
'lang' => 'en-US',
|
||||||
'message' => 'Command completed successfully; action pending',
|
'message' => 'Command completed successfully; action pending',
|
||||||
'clTRID' => $clTRID,
|
'clTRID' => $clTRID,
|
||||||
'svTRID' => $svTRID,
|
'svTRID' => $svTRID,
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
|
|
|
@ -172,6 +172,11 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
$domainName = $xml->command->info->children('urn:ietf:params:xml:ns:domain-1.0')->info->name;
|
$domainName = $xml->command->info->children('urn:ietf:params:xml:ns:domain-1.0')->info->name;
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
|
||||||
|
$extensionNode = $xml->command->extension;
|
||||||
|
if (isset($extensionNode)) {
|
||||||
|
$launch_info = $xml->xpath('//launch:info')[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
$result = $xml->xpath('//domain:authInfo/domain:pw[1]');
|
$result = $xml->xpath('//domain:authInfo/domain:pw[1]');
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
$authInfo_pw = (string)$result[0];
|
$authInfo_pw = (string)$result[0];
|
||||||
|
|
|
@ -931,6 +931,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
if (isset($extensionNode)) {
|
if (isset($extensionNode)) {
|
||||||
$rgp_update = $xml->xpath('//rgp:update')[0] ?? null;
|
$rgp_update = $xml->xpath('//rgp:update')[0] ?? null;
|
||||||
$secdns_update = $xml->xpath('//secDNS:update')[0] ?? null;
|
$secdns_update = $xml->xpath('//secDNS:update')[0] ?? null;
|
||||||
|
$launch_update = $xml->xpath('//launch:update')[0] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($domainRem === null && $domainAdd === null && $domainChg === null && $extensionNode === null) {
|
if ($domainRem === null && $domainAdd === null && $domainChg === null && $extensionNode === null) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue