-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathverisignEppRestoreDomainRequest.php
48 lines (47 loc) · 2.56 KB
/
verisignEppRestoreDomainRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace Metaregistrar\EPP;
class verisignEppRestoreDomainRequest extends eppUpdateDomainRequest {
use verisignEppExtension;
const TYPE_REQUEST = 'request';
const TYPE_REPORT = 'report';
/**
* verisignEppRestoreDomainRequest constructor.
*
* @param string $op
* @param string $domain
* @param string $expire 赎回前的到期时间
* @param string $reason 赎回原因
* @throws eppException
*/
public function __construct(string $op, eppDomain $domain, ?string $expire=null, ?string $reason=null){
if (!in_array($op, [self::TYPE_REQUEST,self::TYPE_REPORT])){
throw new eppException('The op attribute is invalid,only request or report is allow.');
}
parent::__construct($domain, null, null, $domain);
//add namestore extension
$this->addNamestore($domain);
//add rgp extension
$rgp = $this->createElement('rgp:update');
$restore = $this->createElement('rgp:restore');
$restore->setAttribute('op', $op);
if ($op == self::TYPE_REPORT){
$report = $this->createElement('rgp:report');
if (empty($expire)){
throw new eppException('Missing required parameters, registrant or date.');
}
$gmtExpireDate = gmdate('Y-m-d\TH:i:s.Z\Z', strtotime($expire));
$gmtToday = gmdate('Y-m-d\TH:i:s.Z\Z');
$report->appendChild($this->createElement('rgp:preData', $gmtExpireDate));
$report->appendChild($this->createElement('rgp:postData', $gmtToday));
$report->appendChild($this->createElement('rgp:delTime', $gmtExpireDate));
$report->appendChild($this->createElement('rgp:resTime', $gmtToday));
$report->appendChild($this->createElement('rgp:resReason', empty($reason)?'Registrant error.':$reason));
$report->appendChild($this->createElement('rgp:statement', 'This registrar has not restored the Registered Name in order to assume the rights to use or sell the Registered Name for itself or for any third party.'));
$report->appendChild($this->createElement('rgp:statement', 'The information in this report is true to best of this registrar’s knowledge, and this registrar acknowledges that intentionally supplying false information in this report shall constitute an incurable material breach of the Registry-Registrar Agreement.'));
$restore->appendChild($report);
}
$rgp->appendChild($restore);
$this->getExtension()->appendChild($rgp);
$this->addSessionId();
}
}