-
Notifications
You must be signed in to change notification settings - Fork 2
premium op #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
premium op #72
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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'])) { | ||||||
throw new Exception($row['reason']); | ||||||
} | ||||||
|
||||||
|
@@ -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'), | ||||||
|
@@ -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; | ||||||
|
@@ -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']); | ||||||
} | ||||||
|
||||||
|
@@ -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 { | ||||||
|
@@ -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'])) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typos in variable name and exception class may cause runtime errors
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
Suggested change
|
||||||
throw new Exception($row['reason']); | ||||||
} | ||||||
|
||||||
$zone = $this->getZone($row); | ||||||
|
@@ -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'); | ||||||
|
@@ -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, | ||||||
])); | ||||||
} | ||||||
|
@@ -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', | ||||||
|
@@ -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'], | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: