Preparation for prices per registrar

This commit is contained in:
Pinga 2024-07-28 18:42:41 +03:00
parent 0799781491
commit 76f8c52f3a
8 changed files with 13 additions and 13 deletions

View file

@ -52,7 +52,7 @@ try {
} }
} }
$returnValue = getDomainPrice($dbh, $name, $tld_id, $date_add, 'transfer'); $returnValue = getDomainPrice($dbh, $name, $tld_id, $date_add, 'transfer', $reid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (($registrar_balance + $creditLimit) < $price) { if (($registrar_balance + $creditLimit) < $price) {

View file

@ -45,7 +45,7 @@ try {
if ($set_autorenewPeriod) { if ($set_autorenewPeriod) {
list($registrar_balance, $creditLimit) = $dbh->query("SELECT accountBalance, creditLimit FROM registrar WHERE id = '$clid' LIMIT 1")->fetch(PDO::FETCH_NUM); list($registrar_balance, $creditLimit) = $dbh->query("SELECT accountBalance, creditLimit FROM registrar WHERE id = '$clid' LIMIT 1")->fetch(PDO::FETCH_NUM);
$returnValue = getDomainPrice($dbh, $name, $tldid, 12, 'renew'); $returnValue = getDomainPrice($dbh, $name, $tldid, 12, 'renew', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (($registrar_balance + $creditLimit) > $price) { if (($registrar_balance + $creditLimit) > $price) {

View file

@ -117,7 +117,7 @@ function processHostCheck($conn, $db, $xml, $trans) {
sendEppResponse($conn, $xml); sendEppResponse($conn, $xml);
} }
function processDomainCheck($conn, $db, $xml, $trans) { function processDomainCheck($conn, $db, $xml, $trans, $clid) {
$domains = $xml->command->check->children('urn:ietf:params:xml:ns:domain-1.0')->check->name; $domains = $xml->command->check->children('urn:ietf:params:xml:ns:domain-1.0')->check->name;
$clTRID = (string) $xml->command->clTRID; $clTRID = (string) $xml->command->clTRID;
@ -374,7 +374,7 @@ function processDomainCheck($conn, $db, $xml, $trans) {
$tld_id = $result['id']; $tld_id = $result['id'];
// Calculate or retrieve fee for this command // Calculate or retrieve fee for this command
$returnValue = getDomainPrice($db, $domainName, $tld_id, $date_add, $commandName); $returnValue = getDomainPrice($db, $domainName, $tld_id, $date_add, $commandName, $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
$sth = $db->prepare("SELECT price FROM domain_restore_price WHERE tldid = ? LIMIT 1"); $sth = $db->prepare("SELECT price FROM domain_restore_price WHERE tldid = ? LIMIT 1");

View file

@ -869,7 +869,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
$registrar_balance = $result['accountBalance']; $registrar_balance = $result['accountBalance'];
$creditLimit = $result['creditLimit']; $creditLimit = $result['creditLimit'];
$returnValue = getDomainPrice($db, $domainName, $tld_id, $date_add, 'create'); $returnValue = getDomainPrice($db, $domainName, $tld_id, $date_add, 'create', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (!$price) { if (!$price) {

View file

@ -301,7 +301,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
$addPeriod_id = $stmt->fetchColumn(); $addPeriod_id = $stmt->fetchColumn();
if ($addPeriod_id) { if ($addPeriod_id) {
$returnValue = getDomainPrice($db, $domainName, $tldid, $addPeriod, 'create'); $returnValue = getDomainPrice($db, $domainName, $tldid, $addPeriod, 'create', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (!isset($price)) { if (!isset($price)) {
@ -359,7 +359,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
$autoRenewPeriod_id = $stmt->fetchColumn(); $autoRenewPeriod_id = $stmt->fetchColumn();
if ($autoRenewPeriod_id) { if ($autoRenewPeriod_id) {
$returnValue = getDomainPrice($db, $domainName, $tldid, $autoRenewPeriod, 'renew'); $returnValue = getDomainPrice($db, $domainName, $tldid, $autoRenewPeriod, 'renew', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (!isset($price)) { if (!isset($price)) {
@ -382,7 +382,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
$renewPeriod_id = $stmt->fetchColumn(); $renewPeriod_id = $stmt->fetchColumn();
if ($renewPeriod_id) { if ($renewPeriod_id) {
$returnValue = getDomainPrice($db, $domainName, $tldid, $renewPeriod, 'renew'); $returnValue = getDomainPrice($db, $domainName, $tldid, $renewPeriod, 'renew', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (!isset($price)) { if (!isset($price)) {
@ -407,7 +407,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
if ($transferPeriod_id) { if ($transferPeriod_id) {
// Return money if a transfer was also a renew // Return money if a transfer was also a renew
if ($transferPeriod > 0) { if ($transferPeriod > 0) {
$returnValue = getDomainPrice($db, $domainName, $tldid, $transferPeriod, 'renew'); $returnValue = getDomainPrice($db, $domainName, $tldid, $transferPeriod, 'renew', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (!isset($price)) { if (!isset($price)) {

View file

@ -113,7 +113,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
$registrar_balance = $row['accountBalance']; $registrar_balance = $row['accountBalance'];
$creditLimit = $row['creditLimit']; $creditLimit = $row['creditLimit'];
$returnValue = getDomainPrice($db, $domainData['name'], $domainData['tldid'], $date_add, 'renew'); $returnValue = getDomainPrice($db, $domainData['name'], $domainData['tldid'], $date_add, 'renew', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (($registrar_balance + $creditLimit) < $price) { if (($registrar_balance + $creditLimit) < $price) {

View file

@ -470,7 +470,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans)
$stmt->execute([$domainName]); $stmt->execute([$domainName]);
$date_add = $stmt->fetchColumn(); $date_add = $stmt->fetchColumn();
$returnValue = getDomainPrice($db, $domainName, $tldid, $date_add, 'transfer'); $returnValue = getDomainPrice($db, $domainName, $tldid, $date_add, 'transfer', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (($registrar_balance + $creditLimit) < $price) { if (($registrar_balance + $creditLimit) < $price) {
@ -992,7 +992,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans)
$registrar_balance = $result["accountBalance"]; $registrar_balance = $result["accountBalance"];
$creditLimit = $result["creditLimit"]; $creditLimit = $result["creditLimit"];
$returnValue = getDomainPrice($db, $domainName, $tldid, $date_add, 'transfer'); $returnValue = getDomainPrice($db, $domainName, $tldid, $date_add, 'transfer', $clid);
$price = $returnValue['price']; $price = $returnValue['price'];
if (($registrar_balance + $creditLimit) < $price) { if (($registrar_balance + $creditLimit) < $price) {

View file

@ -377,7 +377,7 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID); sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
$conn->close(); $conn->close();
} }
processDomainCheck($conn, $pdo, $xml, $trans); processDomainCheck($conn, $pdo, $xml, $trans, $data['clid']);
break; break;
} }