Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/HeppyTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ class HeppyTool
'price' => ['urn:ar:params:xml:ns:price-1.1'],
'charge' => ['http://www.unitedtld.com/epp/charge-1.0'],
'fee05' => ['urn:ietf:params:xml:ns:fee-0.5', 'version' => '05'],
'fee06' => ['urn:ietf:params:xml:ns:fee-0.6', 'version' => '06'],
// 'fee06' => ['urn:ietf:params:xml:ns:fee-0.6', 'version' => '06'],
'fee07' => ['urn:ietf:params:xml:ns:fee-0.7', 'version' => '07'],
'fee08' => ['urn:ietf:params:xml:ns:fee-0.8', 'version' => '08'],
// 'fee08' => ['urn:ietf:params:xml:ns:fee-0.8', 'version' => '08'],
'fee09' => ['urn:ietf:params:xml:ns:fee-0.9', 'version' => '09'],
'fee10' => ['urn:ietf:params:xml:ns:epp:fee-1.0', 'version' => '10'],
'fee11' => ['urn:ietf:params:xml:ns:fee-0.11','version' => '11'],
'fee21' => ['urn:ietf:params:xml:ns:fee-0.21','version' => '21'],
// 'fee21' => ['urn:ietf:params:xml:ns:fee-0.21','version' => '21'],
'fee23' => ['urn:ietf:params:xml:ns:fee-0.23','version' => '23'],
'coa' => 'urn:ietf:params:xml:ns:coa-1.0',
'idnLang' => 'http://www.verisign.com/epp/idnLang-1.0',
'premiumdomain' => 'http://www.verisign.com/epp/premiumdomain-1.0',
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/ChargeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ChargeExtension extends AbstractExtension implements ExtensionInterface
'domain' => [
'create' => ['*' => true],
'renew' => ['*' => true],
'transer' => ['request' => true, 'query' => 'true'],
'transer' => ['request' => true, 'query' => true],
'update' => ['restore' => true],
'restore' => ['*' => true],
],
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/FeeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FeeExtension extends AbstractExtension implements ExtensionInterface
'check' => ['*' => true],
'create' => ['*' => true],
'renew' => ['*' => true],
'transfer' => ['request' => true, 'query' => 'true'],
'transfer' => ['request' => true, 'query' => true],
// 'update' => ['restore' => true],
// 'restore' => ['*' => true],
],
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/PriceExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PriceExtension extends AbstractExtension implements ExtensionInterface
'check' => ['*' => true],
'create' => ['*' => true],
'renew' => ['*' => true],
'transer' => ['request' => true, 'query' => 'true'],
'transfer' => ['request' => true, 'query' => true],
// 'update' => ['restore' => true],
// 'restore' => ['*' => true],
],
Expand Down
28 changes: 20 additions & 8 deletions src/modules/DomainModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function domainRegister(array $row): array
$zone = $this->getZone($row);
$row = $this->_domainSetFee($row, 'create');

if (!empty($row['fee']) && floatval((string) $row['fee']) !== floatval((string) $row['standart_price'])) {
if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typo in variable name '$row['standart_price']'

The variable name $row['standart_price'] appears to be misspelled. It should likely be $row['standard_price'] to adhere to standard spelling conventions.

Apply this diff to correct the typo:

- if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
+ if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standard_price'])) {

Committable suggestion skipped: line range outside the PR's diff.

throw new Exception($row['reason']);
}

Expand All @@ -233,6 +233,7 @@ public function domainRegister(array $row): array
'pw' => $row['password'] ?? $this->generatePassword(16),
'secDNS' => $row['secDNS'] ?? null,
'fee' => $row['fee'] ?? null,
'category_name' => $row['category_name'] ?? null,
'neulevel' => $zone === 'tel' ? implode(' ', [
"WhoisType=NATURAL",
"Publish=" . ($row['whois_protected'] ? 'N' : 'Y'),
Expand Down Expand Up @@ -327,7 +328,13 @@ public function domainDelete(array $row): array
public function domainsDelete(array $rows): array
{
foreach ($rows as $id => $row) {
$res[$id] = $this->tool->domainDelete($row);
try {
$res[$id] = $this->tool->domainDelete($row);
} catch (Throwable $e) {
$res[$id] = array_merge($row, [
'_error' => $e->getMessage(),
]);
}
}

return $res;
Expand All @@ -341,7 +348,7 @@ public function domainRenew(array $row, ?bool $expired = false): array
{
$row = $this->_domainSetFee($row, 'renew');

if (!empty($row['fee']) && floatval((string) $row['fee']) !== floatval((string) $row['standart_price'])) {
if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
throw new Exception($row['reason']);
}

Expand Down Expand Up @@ -391,7 +398,7 @@ public function domainCheckTransfer(array $row) : array
{
$check = $this->domainCheck($row['domain']);
if ($check['avail'] === 1) {
throw new Excepion('Object does not exist');
throw new Exception('Object does not exist');
}

try {
Expand All @@ -414,8 +421,8 @@ public function domainCheckTransfer(array $row) : array
public function domainTransfer(array $row): array
{
$row = $this->_domainSetFee($row, 'transfer');
if (!empty($row['fee']) && floatval((string) $row['fee']) !== floatval((string) $row['standart_price'])) {
throw new Excepion($row['reason']);
if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typos in variable name and exception class may cause runtime errors

  • The variable $row['standart_price'] is misspelled; it should be $row['standard_price'].
  • The exception class Excepion is misspelled and will cause a fatal error. It should be Exception.

Apply this diff to correct the typos:

- throw new Excepion($row['reason']);
+ throw new Exception($row['reason']);
- if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
+ if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standard_price'])) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standard_price'])) {

throw new Exception($row['reason']);
}

$zone = $this->getZone($row);
Expand Down Expand Up @@ -758,7 +765,7 @@ protected function domainCheck(string $domain, ?string $command = null): array
}
}

if ($res['premium'] === self::DOMAIN_PREMIUM && !empty($res['fee']['category_name'])) {
if (isset($res['premium']) && $res['premium'] === self::DOMAIN_PREMIUM && !empty($res['fee']['category_name'])) {
return $res;
} else {
$checkPremium = $this->_domainCheck($domain, false, $command ?? 'create');
Expand Down Expand Up @@ -901,12 +908,16 @@ protected function _domainSetFee(array $row, string $op, bool $allFee = false):
if ($fee == $row['standart_price'] && in_array($op, ['renew', 'transfer'], true)) {
return array_merge($row, array_filter([
'fee' => $fee,
'category' => $data['category'],
'category_name' => $data['category_name'],
]));
}

return array_merge($row, array_filter([
'fee' => $fee,
'reason' => self::DOMAIN_PREMIUM_REASON,
'category' => $data['category'],
'category_name' => $data['category_name'],
'allFee' => $allFee === true ? $data['fee'] : null,
]));
}
Expand Down Expand Up @@ -951,6 +962,8 @@ protected function _domainRenew(array $row): array
'curExpDate' => $row['expires'],
'period' => $row['period'],
'fee' => $row['fee'] ?? null,
'category' => $row['category'],
'category_name' => $row['category_name'],
]), array_filter([
'domain' => 'name',
'expiration_date' => 'exDate',
Expand Down Expand Up @@ -998,7 +1011,6 @@ private function domainUpdate(array $row, array $keysys = null, array $neulevel
if (empty($data)) {
return $row;
}

try {
return $this->tool->commonRequest("{$this->object}:update", array_filter([
'name' => $row['domain'],
Expand Down
4 changes: 2 additions & 2 deletions src/modules/HostModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class HostModule extends AbstractModule
*/
public function hostCheck($row): array
{
$zone = $this->getZOne($row, true);
$zone = $this->getZone($row, true);
$res = $this->tool->commonRequest("{$this->object}:check", [
'names' => [$row['host']],
'reasons' => 'reasons',
Expand Down Expand Up @@ -126,7 +126,7 @@ public function hostDelete(array $row): array
return $this->tool->commonRequest("{$this->object}:delete", [
'name' => $row['host'],
], [], [
'id' => $row['id'],
'id' => $row['id'] ?? null,
'host' => $row['host'],
]);
}
Expand Down