Skip to content

Commit 81c2dc3

Browse files
Merge pull request #423 from MikeAT/nis2
.at NIS2 extensions
2 parents 7b879de + b4be57a commit 81c2dc3

File tree

10 files changed

+329
-88
lines changed

10 files changed

+329
-88
lines changed

Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppData/atEppConstants.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class atEppConstants
3131
const namespaceMessage="http://www.nic.at/xsd/at-ext-message-1.0";
3232
const schemaLocationMessage="http://www.nic.at/xsd/at-ext-message-1.0 at-ext-message-1.0.xsd";
3333

34+
const namespaceAtExtVerification="http://www.nic.at/xsd/at-ext-verification-1.0";
35+
const schemaLocationAtExtVerification="http://www.nic.at/xsd/at-ext-verification-1.0 at-ext-verification-1.0.xsd";
36+
37+
3438
/*
3539
|--------------------------------------------------------------------------
3640
| Epp and extension constants

Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppData/atEppContact.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class atEppContact extends eppContact {
2929
private $whoisHideFax=0;
3030
private $whoisHideEmail=0;
3131

32+
private $verificationReport;
33+
3234

3335

3436

@@ -43,14 +45,18 @@ class atEppContact extends eppContact {
4345
* @param bool|false $whoisHideFax
4446
* @param null $password
4547
* @param null $status
48+
* @param atEppVerificationReport $verificationReport
4649
* @throws eppException
4750
*/
48-
public function __construct($postalInfo = null,$personType=self::PERS_TYPE_UNSPECIFIED, $email = null, $voice = null, $fax = null,$whoisHideEmail=false,$whoisHidePhone=false,$whoisHideFax=false, $password = null, $status = null) {
51+
public function __construct($postalInfo = null,$personType=self::PERS_TYPE_UNSPECIFIED, $email = null, $voice = null, $fax = null,$whoisHideEmail=false,$whoisHidePhone=false,$whoisHideFax=false, $password = null, $status = null, $verificationReport = null) {
4952
parent::__construct($postalInfo , $email , $voice , $fax , $password , $status );
5053
$this->setPersonType($personType);
5154
$this->setWhoisHideEmail($whoisHideEmail);
5255
$this->setWhoisHideFax($whoisHideFax);
5356
$this->setWhoisHidePhone($whoisHidePhone);
57+
if ($verificationReport) {
58+
$this->setVerificationReport($verificationReport);
59+
}
5460
}
5561

5662

@@ -71,6 +77,11 @@ private function setWhoisHideEmail($whoisHideEmail=false)
7177
$this->whoisHideEmail = $whoisHideEmail? 1 : 0;
7278
}
7379

80+
public function setVerificationReport($verificationReport=null)
81+
{
82+
$this->verificationReport = $verificationReport;
83+
}
84+
7485

7586
public function getWhoisHidePhone()
7687
{
@@ -87,6 +98,11 @@ public function getWhoisHideEmail()
8798
return $this->whoisHideEmail;
8899
}
89100

101+
public function getVerificationReport()
102+
{
103+
return $this->verificationReport;
104+
}
105+
90106

91107
private function setPersonType($personType)
92108
{
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?php
2+
namespace Metaregistrar\EPP;
3+
4+
/**
5+
* Implementation of https://github.com/nic-at/epp-verification-extension
6+
*/
7+
class atEppVerificationReport
8+
{
9+
10+
/**
11+
* verification result: success or failure
12+
* @var string
13+
*/
14+
private $result;
15+
16+
/**
17+
* date of validation in format yyyy-mm-ddThh:mm:ssZ
18+
* @var string
19+
*/
20+
private $verificationDate;
21+
22+
/**
23+
* description of the validation method
24+
* @var string
25+
*/
26+
private $method;
27+
28+
29+
/**
30+
* internal identifiier to identifiy validation
31+
* @var string
32+
*/
33+
34+
private $reference;
35+
36+
/**
37+
* name of entity which did the valdiation
38+
* @var string
39+
*/
40+
private $agent;
41+
42+
/**
43+
* timestamp when validation report was uploaded to registry format yyyy-mm-ddThh:mm:ssZ
44+
* @var string
45+
*/
46+
private $receivedDate;
47+
48+
/**
49+
* clID of transaction which uploaded the validation report
50+
* @var string
51+
*/
52+
private $clID;
53+
54+
55+
const AT_VERIFICATION_RESULT_SUCCESS = 'success';
56+
const AT_VERIFICATION_RESULT_FAILURE = 'failure';
57+
58+
const AT_VERFICATION_STATUS_NONE='none';
59+
const AT_VERFICATION_STATUS_PENDING='pending';
60+
const AT_VERFICATION_STATUS_SERVERHOLD='serverHold';
61+
const AT_VERFICATION_STATUS_VERIFIED='verified';
62+
const AT_VERFICATION_STATUS_FAILED='failed';
63+
64+
/**
65+
*
66+
* @param string $result
67+
* @param string $verificationDate
68+
* @param string $method
69+
* @param string $reference
70+
* @param string $agent
71+
* @param ?string $receivedDate
72+
* @param ?string $clID
73+
*/
74+
public function __construct($result = null,
75+
$verificationDate = null,
76+
$method = null,
77+
$reference = null,
78+
$agent = null,
79+
$receivedDate = null,
80+
$clID= null) {
81+
if ($result) {
82+
$this->setResult($result);
83+
}
84+
if ($verificationDate) {
85+
$this->setVerificationDate($verificationDate);
86+
}
87+
if ($method) {
88+
$this->setMethod($method);
89+
}
90+
if ($reference) {
91+
$this->setReference($reference);
92+
}
93+
if ($agent) {
94+
$this->setAgent($agent);
95+
}
96+
if ($receivedDate) {
97+
$this->setReceivedDate($receivedDate);
98+
}
99+
if ($clID) {
100+
$this->setClID($clID);
101+
}
102+
}
103+
104+
/* setter */
105+
106+
public function setResult($result) {
107+
$this->result = $result;
108+
}
109+
110+
public function setVerificationDate($verificationDate) {
111+
$this->verificationDate = $verificationDate;
112+
}
113+
114+
public function setMethod($method) {
115+
$this->method = $method;
116+
}
117+
118+
public function setReference($reference) {
119+
$this->reference = $reference;
120+
}
121+
122+
public function setAgent($agent) {
123+
$this->agent = $agent;
124+
}
125+
126+
public function setReceivedDate($receivedDate) {
127+
$this->receivedDate = $receivedDate;
128+
}
129+
130+
public function setClID($clID) {
131+
$this->clID = $clID;
132+
}
133+
134+
135+
/* getter */
136+
137+
public function getResult() {
138+
return $this->result;
139+
}
140+
141+
public function getVerificationDate() {
142+
return $this->verificationDate;
143+
}
144+
145+
public function getMethod() {
146+
return $this->method;
147+
}
148+
149+
public function getReference() {
150+
return $this->reference;
151+
}
152+
153+
public function getAgent() {
154+
return $this->agent;
155+
}
156+
157+
public function getReceivedDate() {
158+
return $this->receivedDate;
159+
}
160+
161+
public function getClID() {
162+
return $this->clID;
163+
}
164+
165+
166+
/**
167+
* generates the XML
168+
*
169+
* @param eppRequest $request
170+
* @param DomElement $ext
171+
*/
172+
public function exportXML(eppRequest $request, \DomElement $ext) {
173+
$report = $request->createElement('at-ext-verification:report');
174+
175+
# mandatory fields
176+
foreach (['result', 'verificationDate'] as $element) {
177+
178+
$report->appendChild($request->createElement('at-ext-verification:'.$element, $this->$element));
179+
}
180+
181+
# optional fields
182+
foreach (['method', 'reference', 'agent'] as $element) {
183+
if (!is_null($this->$element)) {
184+
$report->appendChild($request->createElement('at-ext-verification:'.$element, $this->$element));
185+
}
186+
}
187+
188+
$ext->appendChild($report);
189+
190+
}
191+
192+
}

Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppCreateContactExtension.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@ public function setEppRequestExtension(eppRequest $request,\DOMElement $extensio
2525
$facet_->appendChild(new \DOMText($this->atEppContact->getPersonType()));
2626
$contactExt_->appendChild($facet_);
2727
$extension->appendchild($contactExt_);
28+
29+
if ($this->atEppContact->getVerificationReport()) { // add validation report to request if set
30+
$verficiationExt = $request->createElement('at-ext-verification:create');
31+
$verficiationExt->setAttribute('xmlns:at-ext-verification', atEppConstants::namespaceAtExtVerification);
32+
$verficiationExt->setAttribute('xsi:schemaLocation', atEppConstants::schemaLocationAtExtVerification);
33+
$this->atEppContact->getVerificationReport()->exportXML($request, $verficiationExt);
34+
$extension->appendchild($verficiationExt);
35+
}
36+
37+
2838
if(!is_null($this->additionalEppExtension))
2939
{
3040
$this->additionalEppExtension->setEppRequestExtension($request,$extension);
3141
}
3242

33-
3443
}
3544
}

Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppUpdateContactExtension.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ public function setEppRequestExtension(eppRequest $request,\DOMElement $extensio
2828
$extChange_->appendChild($facet_);
2929
$contactExt_->appendChild($extChange_);
3030
$extension->appendchild($contactExt_);
31+
32+
if ($this->atEppContact->getVerificationReport()) { // add validation report to request if set
33+
$verficiationExt = $request->createElement('at-ext-verification:update');
34+
$verficiationExt->setAttribute('xmlns:at-ext-verification', atEppConstants::namespaceAtExtVerification);
35+
$verficiationExt->setAttribute('xsi:schemaLocation', atEppConstants::schemaLocationAtExtVerification);
36+
$this->atEppContact->getVerificationReport()->exportXML($request, $verficiationExt);
37+
$extension->appendchild($verficiationExt);
38+
}
39+
3140
if(!is_null($this->additionalEppExtension))
3241
{
3342
$this->additionalEppExtension->setEppRequestExtension($request,$extension);

Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppCreateContactRequest.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ public function setContact(eppContact $contact) {
3030
$this->setContactId($contact->getId());
3131
$this->setPostalInfo($contact->getPostalInfo(0));
3232
$this->setVoice($contact->getVoice());
33-
$this->setFax($contact->getFax());
3433
$this->setEmail($contact->getEmail());
3534
$this->setPassword($contact->getPassword());
36-
$this->setAtContactDisclosure($contact->getDisclose(), $contact);
3735
$this->setAtExtensions();
3836
}
3937

@@ -109,46 +107,4 @@ public function setPostalInfo(eppContactPostalInfo $postal) {
109107
$this->contactobject->appendChild($postalinfo);
110108
}
111109

112-
113-
114-
/**
115-
* at voice-, fax-, email disclosure
116-
*
117-
* @param $contactdisclose
118-
* @param atEppContact $contact
119-
*/
120-
protected function setAtContactDisclosure($contactdisclose,atEppContact $contact)
121-
{
122-
if (!is_null($contactdisclose)) {
123-
$disclose = $this->createElement('contact:disclose');
124-
$disclose->setAttribute('flag', $contactdisclose);
125-
126-
$disclPhone = $this->createElement('contact:voice');
127-
if ($contactdisclose == 1) {
128-
$disclPhone->setAttribute('type', eppContact::TYPE_LOC);
129-
}
130-
if ($contactdisclose != $contact->getWhoisHidePhone()) {
131-
$disclose->appendChild($disclPhone);
132-
}
133-
$disclFax = $this->createElement('contact:fax');
134-
if ($contactdisclose == 1) {
135-
$disclFax->setAttribute('type', eppContact::TYPE_LOC);
136-
}
137-
if ($contact->getWhoisHideFax() != $contactdisclose) {
138-
$disclose->appendChild($disclFax);
139-
}
140-
$disclEmail = $this->createElement('contact:email');
141-
if ($contactdisclose == 1) {
142-
$disclEmail->setAttribute('type', eppContact::TYPE_LOC);
143-
}
144-
if ($contact->getWhoisHideEmail() != $contactdisclose) {
145-
$disclose->appendChild($disclEmail);
146-
}
147-
$this->contactobject->appendChild($disclose);
148-
}
149-
}
150-
151-
152-
153-
154110
}

0 commit comments

Comments
 (0)