-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added authInfo-1.1, domain-ext-2.1 and fee-0.9 extensions to EPP
- Loading branch information
1 parent
97b2f93
commit ce495d1
Showing
11 changed files
with
288 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Protocols/EPP/eppExtensions/authInfo-1.1/eppRequests/euridEppInfoDomainRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
namespace Metaregistrar\EPP; | ||
/* | ||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> | ||
<command> | ||
<info> | ||
<domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> | ||
<domain:name>domain-0007.eu</domain:name> | ||
</domain:info> | ||
</info> | ||
<extension> | ||
<authInfo:info xmlns:authInfo="http://www.eurid.eu/xml/epp/authInfo-1.0"> | ||
<authInfo:request/> | ||
</authInfo:info> | ||
</extension> | ||
</command> | ||
</epp> | ||
*/ | ||
class euridEppInfoDomainRequest extends eppInfoDomainRequest { | ||
function __construct($infodomain, $hosts = null) { | ||
parent::__construct($infodomain, $hosts); | ||
$this->addEURIDExtension(); | ||
$this->addSessionId(); | ||
} | ||
|
||
|
||
public function addEURIDExtension() { | ||
$authext = $this->createElement('authInfo:info'); | ||
$authext->setAttribute('xmlns:authInfo', 'http://www.eurid.eu/xml/epp/authInfo-1.1'); | ||
$authext->appendChild($this->createElement('authInfo:request')); | ||
$this->getExtension()->appendChild($authext); | ||
} | ||
|
||
} |
93 changes: 93 additions & 0 deletions
93
Protocols/EPP/eppExtensions/authInfo-1.1/eppResponses/euridEppInfoDomainResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
namespace Metaregistrar\EPP; | ||
|
||
class euridEppInfoDomainResponse extends eppInfoDomainResponse { | ||
function __construct() { | ||
parent::__construct(); | ||
} | ||
|
||
|
||
/** | ||
* Return EURid specific contact type 'onsite', which is not EPP standard | ||
* | ||
* @return array eppContactHandles | ||
*/ | ||
public function getDomainContacts() { | ||
$xpath = $this->xPath(); | ||
$cont = null; | ||
$result = $xpath->query('/epp:epp/epp:response/epp:resData/domain:infData/domain:contact'); | ||
foreach ($result as $contact) { | ||
/* @var $contact \DOMElement */ | ||
$contacttype = $contact->getAttribute('type'); | ||
if ($contacttype) { | ||
$cont[] = new eppContactHandle($contact->nodeValue, $contacttype); | ||
} | ||
} | ||
$result = $xpath->query('/epp:epp/epp:response/epp:extension/domain-ext:infData/domain-ext:contact'); | ||
foreach ($result as $contact) { | ||
/* @var $contact \DOMElement */ | ||
$contacttype = $contact->getAttribute('type'); | ||
if ($contacttype) { | ||
// EURID specific | ||
if ($contacttype == 'onsite') { | ||
$contacttype = 'admin'; | ||
} | ||
$cont[] = new eppContactHandle($contact->nodeValue, $contacttype); | ||
} | ||
} | ||
return $cont; | ||
} | ||
|
||
/** | ||
* Get the date until the auth code is valie | ||
* @return null|string | ||
*/ | ||
public function getAuthorisationCodeValidDate() { | ||
$xpath = $this->xPath(); | ||
$result = $xpath->query('/epp:epp/epp:response/epp:extension/authInfo:infData/authInfo:validUntil'); | ||
if ($result->length > 0) { | ||
return $result->item(0)->nodeValue; | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* | ||
* @return boolean | ||
*/ | ||
public function getQuarantined() { | ||
$xpath = $this->xPath(); | ||
$result = $xpath->query('/epp:epp/epp:response/epp:extension/eurid:ext/eurid:infData/eurid:domain/eurid:quarantined'); | ||
if ($result->length > 0) { | ||
if ($result->item(0)->nodeValue == 'true') { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* | ||
* @return boolean | ||
*/ | ||
public function getOnHold() { | ||
$xpath = $this->xPath(); | ||
$result = $xpath->query('/epp:epp/epp:response/epp:extension/eurid:ext/eurid:infData/eurid:domain/eurid:onhold'); | ||
if ($result->length > 0) { | ||
if ($result->item(0)->nodeValue == 'true') { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} else { | ||
return null; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
$this->addExtension('authInfo', 'http://www.eurid.eu/xml/epp/authInfo-1.1'); | ||
# | ||
# For use with the EURID connection | ||
# | ||
include_once(dirname(__FILE__) . '/eppRequests/euridEppInfoDomainRequest.php'); | ||
include_once(dirname(__FILE__) . '/eppResponses/euridEppInfoDomainResponse.php'); | ||
$this->addCommandResponse('Metaregistrar\EPP\euridEppInfoDomainRequest', 'Metaregistrar\EPP\euridEppInfoDomainResponse'); |
53 changes: 53 additions & 0 deletions
53
Protocols/EPP/eppExtensions/domain-ext-2.1/eppRequests/euridEppTransferDomainRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
namespace Metaregistrar\EPP; | ||
|
||
/* | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> | ||
<command> | ||
<transfer op="request"> | ||
<domain:transfer xmlns:domain='urn:ietf:params:xml:ns:domain-1.0'> | ||
<domain:name>some-domain-name</domain:name> | ||
<domain:authInfo> | ||
<domain:pw>XXXX-2N5J-L7AU-MV2L</domain:pw> | ||
</domain:authInfo> | ||
</domain:transfer> | ||
</transfer> | ||
<extension> | ||
<domain-ext:transfer xmlns:domain='urn:ietf:params:xml:ns:domain-1.0' xmlns:domain-ext='http://www.eurid.eu/xml/epp/domain-ext-2.1'> | ||
<domain-ext:request> | ||
<domain-ext:contact type='billing'>c10</domain-ext:contact> | ||
<domain-ext:contact type='tech'>c159</domain-ext:contact> | ||
</domain-ext:request> | ||
</domain-ext:transfer> | ||
</extension> | ||
</command> | ||
</epp> | ||
*/ | ||
|
||
|
||
class euridEppTransferDomainRequest extends eppTransferRequest { | ||
function __construct($operation, eppDomain $domain) { | ||
parent::__construct($operation,$domain); | ||
$this->addContacts($domain); | ||
parent::addSessionId(); | ||
|
||
} | ||
|
||
private function addContacts(eppDomain $domain) { | ||
$transfer = $this->createElement('domain-ext:transfer'); | ||
$this->setNamespace('xmlns:domain','urn:ietf:params:xml:ns:domain-1.0',$transfer); | ||
$this->setNamespace('xmlns:domain-ext','http://www.eurid.eu/xml/epp/domain-ext-2.1',$transfer); | ||
$request = $this->createElement('domain-ext:request'); | ||
foreach ($domain->getContacts() as $contact) { | ||
/* @var $contact \Metaregistrar\EPP\eppContactHandle */ | ||
$c = $this->createElement('domain-ext:contact',$contact->getContactHandle()); | ||
$c->setAttribute('type',$contact->getContactType()); | ||
$request->appendChild($c); | ||
} | ||
$transfer->appendChild($request); | ||
$this->getExtension()->appendChild($transfer); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
$this->addExtension('domain-ext', 'http://www.eurid.eu/xml/epp/domain-ext-2.1'); | ||
|
||
include_once(dirname(__FILE__) . '/eppRequests/euridEppTransferDomainRequest.php'); | ||
|
||
$this->addCommandResponse('Metaregistrar\EPP\euridEppTransferDomainRequest', 'Metaregistrar\EPP\eppTransferResponse'); |
32 changes: 32 additions & 0 deletions
32
Protocols/EPP/eppExtensions/fee-0.9/eppRequests/feeEppCheckDomainRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
namespace Metaregistrar\EPP; | ||
|
||
class feeEppCheckDomainRequest extends eppCheckDomainRequest { | ||
function __construct($checkrequest, $namespacesinroot) { | ||
parent::__construct($checkrequest, $namespacesinroot); | ||
$this->addFee(null,null); | ||
$this->addSessionId(); | ||
} | ||
|
||
private function addFee(eppDomain $domain, $command, $phase=null, $period = null) { | ||
$extension = $this->getExtension(); | ||
$check = $this->createElement('fee:check'); | ||
$check->setAttribute('xmlns:fee','urn:ietf:params:xml:ns:fee-0.9'); | ||
$fee = $this->createElement('fee:object'); | ||
$fee->setAttribute('objURI','urn:ietf:params:xml:ns:domain-1.0'); | ||
$objid = $this->createElement('fee:objID',$domain->getDomainname()); | ||
$objid->setAttribute('element','name'); | ||
$fee->appendChild($objid); | ||
$command = $this->createElement('fee:command',$command); | ||
if ($phase) { | ||
$command->setAttribute('phase',$phase); | ||
$fee->appendChild($phase); | ||
} | ||
if ($period) { | ||
$per = $this->createElement('fee:period',$period); | ||
$per->setAttribute('unit','y'); | ||
} | ||
$extension->appendChild($check); | ||
return; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Protocols/EPP/eppExtensions/fee-0.9/eppResponses/feeEppCheckDomainResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
namespace Metaregistrar\EPP; | ||
|
||
class feeEppCheckdomainResponse extends eppCheckDomainResponse { | ||
function __construct() { | ||
parent::__construct(); | ||
} | ||
|
||
public function getFees() { | ||
$xpath = $this->xPath(); | ||
$result = $xpath->query('/epp:epp/epp:response/epp:extension/fee:chkData/fee:cd/*'); | ||
if ($result->length > 0) { | ||
if ($result->item(0)->nodeValue == 'true') { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
# | ||
# Load the fee-0.9 specific additions | ||
# SOURCE: https://tools.ietf.org/html/draft-brown-epp-fees-06 | ||
# | ||
include_once(dirname(__FILE__) . '/eppRequests/feeEppCheckDomainRequest.php'); | ||
include_once(dirname(__FILE__) . '/eppResponses/feeEppCheckDomainResponse.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters