Skip to content
Merged
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
7 changes: 5 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
parameters:
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
level: 8
ignoreErrors:
-
identifier: missingType.iterableValue
-
identifier: missingType.generics
paths:
- src
23 changes: 23 additions & 0 deletions src/Domain/Enum/RenewOnTransferEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php declare(strict_types = 1);

namespace RealtimeRegister\Domain\Enum;

class RenewOnTransferEnum extends AbstractEnum
{
const NO_CHANGE = 'NO_CHANGE';
const RENEW_UNLESS_GRACE = 'RENEW_UNLESS_GRACE';
const RENEWAL = 'RENEWAL';
const NEW_PERIOD = 'NEW_PERIOD';

protected static array $values = [
RenewOnTransferEnum::NO_CHANGE,
RenewOnTransferEnum::RENEW_UNLESS_GRACE,
RenewOnTransferEnum::RENEWAL,
RenewOnTransferEnum::NEW_PERIOD,
];

public static function validate($value): void
{
self::assertValueValid($value);
}
}
30 changes: 28 additions & 2 deletions src/Domain/TLDMetaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use RealtimeRegister\Domain\Enum\DomainPossibleClientDomainStatusEnum;
use RealtimeRegister\Domain\Enum\GDPRCategoryEnum;
use RealtimeRegister\Domain\Enum\PremiumSupportEnum;
use RealtimeRegister\Domain\Enum\RenewOnTransferEnum;
use RealtimeRegister\Domain\Enum\WhoisExposureEnum;
use Webmozart\Assert\Assert;

Expand Down Expand Up @@ -100,6 +101,14 @@ final class TLDMetaData implements DomainObjectInterface

public ?int $transferLockDays;

public string $renewalOnTransfer;

public bool $restoreIncludesRenew;

public ?string $registrationNotice;

public bool $registrantChangeTransferLock;

private function __construct(
array $createDomainPeriods,
array $renewDomainPeriods,
Expand Down Expand Up @@ -142,7 +151,11 @@ private function __construct(
string $premiumSupport,
bool $wdrpNotifications,
bool $errpNotifications,
?int $transferLockDays
?int $transferLockDays,
string $renewalOnTransfer,
?string $registrationNotice,
bool $registrantChangeTransferLock,
bool $restoreIncludesRenew
) {
$this->createDomainPeriods = $createDomainPeriods;
$this->renewDomainPeriods = $renewDomainPeriods;
Expand Down Expand Up @@ -186,6 +199,10 @@ private function __construct(
$this->wdrpNotifications = $wdrpNotifications;
$this->errpNotifications = $errpNotifications;
$this->transferLockDays = $transferLockDays;
$this->renewalOnTransfer = $renewalOnTransfer;
$this->registrationNotice = $registrationNotice;
$this->registrantChangeTransferLock = $registrantChangeTransferLock;
$this->restoreIncludesRenew = $restoreIncludesRenew;
}

public static function fromArray(array $json): TLDMetaData
Expand All @@ -205,6 +222,7 @@ public static function fromArray(array $json): TLDMetaData
WhoisExposureEnum::validate($json['whoisExposure']);
GDPRCategoryEnum::validate($json['gdprCategory']);
PremiumSupportEnum::validate($json['premiumSupport']);
RenewOnTransferEnum::validate($json['renewalOnTransfer']);

return new TLDMetaData(
$json['createDomainPeriods'],
Expand Down Expand Up @@ -248,7 +266,11 @@ public static function fromArray(array $json): TLDMetaData
$json['premiumSupport'],
$json['wdrpNotifications'],
$json['errpNotifications'],
$json['transferLockDays'] ?? null
$json['transferLockDays'] ?? null,
$json['renewalOnTransfer'],
$json['registrationNotice'] ?? null,
$json['registrantChangeTransferLock'],
$json['restoreIncludesRenew'],
);
}

Expand Down Expand Up @@ -297,6 +319,10 @@ public function toArray(): array
'techContacts' => $this->techContacts->toArray(),
'contactProperties' => $this->contactProperties ? $this->contactProperties->toArray() : null,
'launchPhases' => $this->launchPhases ? $this->launchPhases->toArray() : null,
'renewalOnTransfer' => $this->renewalOnTransfer,
'registrationNotice' => $this->registrationNotice,
'registrantChangeTransferLock' => $this->registrantChangeTransferLock,
'restoreIncludesRenew' => $this->restoreIncludesRenew,
], function ($x) {
return ! is_null($x);
});
Expand Down
3 changes: 3 additions & 0 deletions tests/Domain/data/metadata/metadata_unknown_feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@
'adminContacts' => ['min' => 0, 'max' => 10, 'required' => false, 'organizationRequired' => false, 'organizationAllowed' => true], // ContactsConstraint
'billingContacts' => ['min' => 0, 'max' => 10, 'required' => false, 'organizationRequired' => false, 'organizationAllowed' => true], // ContactsConstraint
'techContacts' => ['min' => 0, 'max' => 10, 'required' => false, 'organizationRequired' => false, 'organizationAllowed' => true], // ContactsConstraint
'renewalOnTransfer' => 'RENEWAL',
'registrantChangeTransferLock' => true,
'restoreIncludesRenew' => true,
];
4 changes: 4 additions & 0 deletions tests/Domain/data/metadata/metadata_valid.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@
'adminContacts' => ['min' => 0, 'max' => 10, 'required' => false, 'organizationRequired' => false, 'organizationAllowed' => true], // ContactsConstraint
'billingContacts' => ['min' => 0, 'max' => 10, 'required' => false, 'organizationRequired' => false, 'organizationAllowed' => true], // ContactsConstraint
'techContacts' => ['min' => 0, 'max' => 10, 'required' => false, 'organizationRequired' => false, 'organizationAllowed' => true], // ContactsConstraint
'renewalOnTransfer' => 'NO_CHANGE',
'registrationNotice' => 'Valid!',
'registrantChangeTransferLock' => true,
'restoreIncludesRenew' => false,
];
3 changes: 3 additions & 0 deletions tests/Domain/data/tldinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
'techContacts' => include __DIR__ . '/contacts/contacts_constraint.php',
'contactProperties' => [include __DIR__ . '/contacts/contact_property_valid.php'],
'launchPhases' => [include __DIR__ . '/launch_phase.php'],
'renewalOnTransfer' => 'NO_CHANGE',
'registrantChangeTransferLock' => true,
'restoreIncludesRenew' => false,
],
];
6 changes: 5 additions & 1 deletion tests/Domain/data/tldinfo_com.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@
"validationCategory": "General",
"wdrpNotifications": false,
"errpNotifications": false,
"transferLockDays": 0
"transferLockDays": 0,
"renewalOnTransfer": "NO_CHANGE",
"registrationNotice": "This is a registration notice!",
"registrantChangeTransferLock": false,
"restoreIncludesRenew": false
},
"provider": "Verisign",
"applicableFor": [
Expand Down
5 changes: 4 additions & 1 deletion tests/Domain/data/tldinfo_nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@
},
"wdrpNotifications": false,
"errpNotifications": true,
"transferLockDays": 0
"transferLockDays": 0,
"renewalOnTransfer": "RENEW_UNLESS_GRACE",
"registrantChangeTransferLock": false,
"restoreIncludesRenew": false
},
"provider": "Sidn",
"applicableFor": [
Expand Down