Skip to content

Commit 70469d4

Browse files
committed
premium op
1 parent face574 commit 70469d4

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

src/HeppyTool.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ class HeppyTool
7171
'price' => ['urn:ar:params:xml:ns:price-1.1'],
7272
'charge' => ['http://www.unitedtld.com/epp/charge-1.0'],
7373
'fee05' => ['urn:ietf:params:xml:ns:fee-0.5', 'version' => '05'],
74-
'fee06' => ['urn:ietf:params:xml:ns:fee-0.6', 'version' => '06'],
74+
// 'fee06' => ['urn:ietf:params:xml:ns:fee-0.6', 'version' => '06'],
7575
'fee07' => ['urn:ietf:params:xml:ns:fee-0.7', 'version' => '07'],
76-
'fee08' => ['urn:ietf:params:xml:ns:fee-0.8', 'version' => '08'],
76+
// 'fee08' => ['urn:ietf:params:xml:ns:fee-0.8', 'version' => '08'],
7777
'fee09' => ['urn:ietf:params:xml:ns:fee-0.9', 'version' => '09'],
78+
'fee10' => ['urn:ietf:params:xml:ns:epp:fee-1.0', 'version' => '10'],
7879
'fee11' => ['urn:ietf:params:xml:ns:fee-0.11','version' => '11'],
79-
'fee21' => ['urn:ietf:params:xml:ns:fee-0.21','version' => '21'],
80+
// 'fee21' => ['urn:ietf:params:xml:ns:fee-0.21','version' => '21'],
81+
'fee23' => ['urn:ietf:params:xml:ns:fee-0.23','version' => '23'],
8082
'coa' => 'urn:ietf:params:xml:ns:coa-1.0',
8183
'idnLang' => 'http://www.verisign.com/epp/idnLang-1.0',
8284
'premiumdomain' => 'http://www.verisign.com/epp/premiumdomain-1.0',

src/extensions/PriceExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PriceExtension extends AbstractExtension implements ExtensionInterface
2424
'check' => ['*' => true],
2525
'create' => ['*' => true],
2626
'renew' => ['*' => true],
27-
'transer' => ['request' => true, 'query' => 'true'],
27+
'transfer' => ['request' => true, 'query' => 'true'],
2828
// 'update' => ['restore' => true],
2929
// 'restore' => ['*' => true],
3030
],

src/modules/AbstractModule.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ public function isExtensionEnabled(string $extension) : bool
161161
return !empty($extensions[$extension]);
162162
}
163163

164+
public function isExtensionsClassEnabled(string $extension): bool
165+
{
166+
foreach ($this->tool->getExtensions() as $name => $value) {
167+
168+
}
169+
170+
return false;
171+
}
172+
164173
public function isPremiumExtensionAvailable(): bool
165174
{
166175
$extensions = $this->tool->getExtensions();

src/modules/DomainModule.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function domainRegister(array $row): array
218218
$zone = $this->getZone($row);
219219
$row = $this->_domainSetFee($row, 'create');
220220

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

@@ -233,6 +233,7 @@ public function domainRegister(array $row): array
233233
'pw' => $row['password'] ?? $this->generatePassword(16),
234234
'secDNS' => $row['secDNS'] ?? null,
235235
'fee' => $row['fee'] ?? null,
236+
'category_name' => $row['category_name'] ?? null,
236237
'neulevel' => $zone === 'tel' ? implode(' ', [
237238
"WhoisType=NATURAL",
238239
"Publish=" . ($row['whois_protected'] ? 'N' : 'Y'),
@@ -327,7 +328,13 @@ public function domainDelete(array $row): array
327328
public function domainsDelete(array $rows): array
328329
{
329330
foreach ($rows as $id => $row) {
330-
$res[$id] = $this->tool->domainDelete($row);
331+
try {
332+
$res[$id] = $this->tool->domainDelete($row);
333+
} catch (Throwable $e) {
334+
$res[$id] = array_merge($row, [
335+
'_error' => $e->getMessage(),
336+
]);
337+
}
331338
}
332339

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

344-
if (!empty($row['fee']) && floatval((string) $row['fee']) !== floatval((string) $row['standart_price'])) {
351+
if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
345352
throw new Exception($row['reason']);
346353
}
347354

@@ -414,7 +421,7 @@ public function domainCheckTransfer(array $row) : array
414421
public function domainTransfer(array $row): array
415422
{
416423
$row = $this->_domainSetFee($row, 'transfer');
417-
if (!empty($row['fee']) && floatval((string) $row['fee']) !== floatval((string) $row['standart_price'])) {
424+
if (!empty($row['fee']) && floatval((string) $row['fee']) > floatval((string) $row['standart_price'])) {
418425
throw new Excepion($row['reason']);
419426
}
420427

@@ -758,7 +765,7 @@ protected function domainCheck(string $domain, ?string $command = null): array
758765
}
759766
}
760767

761-
if ($res['premium'] === self::DOMAIN_PREMIUM && !empty($res['fee']['category_name'])) {
768+
if (isset($res['premium']) && $res['premium'] === self::DOMAIN_PREMIUM && !empty($res['fee']['category_name'])) {
762769
return $res;
763770
} else {
764771
$checkPremium = $this->_domainCheck($domain, false, $command ?? 'create');
@@ -901,12 +908,16 @@ protected function _domainSetFee(array $row, string $op, bool $allFee = false):
901908
if ($fee == $row['standart_price'] && in_array($op, ['renew', 'transfer'], true)) {
902909
return array_merge($row, array_filter([
903910
'fee' => $fee,
911+
'category' => $data['category'],
912+
'category_name' => $data['category_name'],
904913
]));
905914
}
906915

907916
return array_merge($row, array_filter([
908917
'fee' => $fee,
909918
'reason' => self::DOMAIN_PREMIUM_REASON,
919+
'category' => $data['category'],
920+
'category_name' => $data['category_name'],
910921
'allFee' => $allFee === true ? $data['fee'] : null,
911922
]));
912923
}
@@ -998,7 +1009,6 @@ private function domainUpdate(array $row, array $keysys = null, array $neulevel
9981009
if (empty($data)) {
9991010
return $row;
10001011
}
1001-
10021012
try {
10031013
return $this->tool->commonRequest("{$this->object}:update", array_filter([
10041014
'name' => $row['domain'],

src/modules/HostModule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class HostModule extends AbstractModule
1818
*/
1919
public function hostCheck($row): array
2020
{
21-
$zone = $this->getZOne($row, true);
21+
$zone = $this->getZone($row, true);
2222
$res = $this->tool->commonRequest("{$this->object}:check", [
2323
'names' => [$row['host']],
2424
'reasons' => 'reasons',
@@ -126,7 +126,7 @@ public function hostDelete(array $row): array
126126
return $this->tool->commonRequest("{$this->object}:delete", [
127127
'name' => $row['host'],
128128
], [], [
129-
'id' => $row['id'],
129+
'id' => $row['id'] ?? null,
130130
'host' => $row['host'],
131131
]);
132132
}

0 commit comments

Comments
 (0)