Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
namespace Metaregistrar\EPP;

class fee011EppCheckDomainRequest extends eppCheckDomainRequest {

const COMMAND_CREATE = 'create';
const COMMAND_RENEW = 'renew';
const COMMAND_TRANSFER = 'transfer';

function __construct($checkrequest, $command = 'create', $namespacesinroot=true) {
parent::__construct($checkrequest, $namespacesinroot);
// $command may be 'create', 'renew', 'transfer'
// $period is in years and may be 1 - 10
// $class is determined by the registry and can contain certain tiers of pricing
$this->addFee($checkrequest,$command);
$this->addSessionId();
}

private function addFee(eppDomain $domain, string $command, ?string $class=null, ?int $period = null, ?string $currency = null) {
if (!in_array($command,['create','renew','transfer'])) {
throw new eppException('Invalid command for fee-0.11 extension. Valid commands are create, renew, transfer');
}
if ($period) {
if (($period == 0) || ($period>10)) {
throw new eppException('Invalid period for fee-0.11 extension. Valid periods are 0-10');
}
}
$extension = $this->getExtension();
$check = $this->createElement('fee:check');
$check->setAttribute('xmlns:fee','urn:ietf:params:xml:ns:fee-0.11');
$check->appendChild($this->createElement('fee:command',$command));
if ($currency) {
$check->appendChild($this->createElement('fee:currency',$currency));
}
if ($class) {
$check->appendChild($this->createElement('fee:class',$class));
}
if ($period) {
$per = $this->createElement('fee:period',$period);
$per->setAttribute('unit','y');
$check->appendChild($per);
}
$extension->appendChild($check);
return;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace Metaregistrar\EPP;

class fee011EppCheckdomainResponse extends eppCheckDomainResponse {

public function getFees() {
$result = [];
$xpath = $this->xPath();
$result['available'] = $xpath->query('/epp:epp/epp:response/epp:extension/fee:chkData/*')->item(0)->getAttribute('avail');
$list = $xpath->query('/epp:epp/epp:response/epp:extension/fee:chkData/fee:cd/*');
foreach ($list as $node) {
/* @var \DOMElement $node */
switch ($node->tagName) {
case 'fee:command':
$result['command'] = $node->nodeValue;
break;
case 'fee:fee':
$result['price'] = $node->nodeValue;
break;
case 'fee:class':
$result['class'] = $node->nodeValue;
break;
case 'fee:period':
$result['period'] = $node->nodeValue;
$periodunit = $node->getAttribute('unit');
$result['periodunit'] = $periodunit;
break;
case 'fee:currency':
$result['currency'] = $node->nodeValue;
break;
case 'fee:object':
$result['domainname'] = $node->getElementsByTagName('name')->item(0)->nodeValue;
break;
};
}
return $result;
}


}
216 changes: 216 additions & 0 deletions Protocols/EPP/eppExtensions/fee-0.11/fee-0.11.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<?xml version="1.0" encoding="utf-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:fee="urn:ietf:params:xml:ns:fee-0.11"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
targetNamespace="urn:ietf:params:xml:ns:fee-0.11"
elementFormDefault="qualified">

<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" />
<import namespace="urn:ietf:params:xml:ns:domain-1.0" />

<annotation>
<documentation>Extensible Provisioning Protocol
v1.0 extension schema for fee
information.</documentation>
</annotation>

<!--
Child elements found in EPP commands and responses
-->
<element name="check" type="fee:checkType" />
<element name="chkData" type="fee:chkDataType" />
<element name="create" type="fee:transformCommandType" />
<element name="creData" type="fee:transformResultType" />
<element name="renew" type="fee:transformCommandType" />
<element name="renData" type="fee:transformResultType" />
<element name="transfer" type="fee:transformCommandType" />
<element name="trnData" type="fee:transferResultType" />
<element name="update" type="fee:transformCommandType" />
<element name="updData" type="fee:transformResultType" />
<element name="delData" type="fee:deleteDataType" />

<!--
client <check> command
-->
<complexType name="checkType">
<sequence>
<element name="command" type="fee:commandType" />
<element name="currency" type="fee:currencyType"
minOccurs="0" />
<element name="period" type="domain:periodType"
minOccurs="0" />
<element name="class" type="token"
minOccurs="0" />
</sequence>
</complexType>

<!--
server <check> result
-->
<complexType name="chkDataType">
<sequence>
<element name="cd" type="fee:objectCDType"
maxOccurs="unbounded" />
</sequence>
</complexType>

<complexType name="objectCDType">
<sequence>
<element name="object">
<complexType>
<sequence>
<any namespace="##other" processContents="lax"/>
</sequence>
</complexType>
</element>
<element name="command" type="fee:commandType" />
<element name="currency" type="fee:currencyType" />
<element name="period" type="domain:periodType"
minOccurs="0" maxOccurs="1" />
<element name="fee" type="fee:feeType"
minOccurs="0" maxOccurs="unbounded" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
<element name="class" type="token" minOccurs="0" />
<element name="reason" type="token" minOccurs="0" />
</sequence>
<attribute name="avail" type="boolean" default="1" />
</complexType>

<!--
general transform (create, renew, update, transfer) command
-->
<complexType name="transformCommandType">
<sequence>
<element name="currency" type="fee:currencyType"
minOccurs="0" />
<element name="fee" type="fee:feeType"
maxOccurs="unbounded" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>

<!--
general transform (create, renew, update) result
-->
<complexType name="transformResultType">
<sequence>
<element name="currency" type="fee:currencyType" />
<element name="fee" type="fee:feeType"
minOccurs="0" maxOccurs="unbounded" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
<element name="balance" type="fee:balanceType"
minOccurs="0" />
<element name="creditLimit" type="fee:creditLimitType"
minOccurs="0" />
</sequence>
</complexType>

<!--
transfer result
-->
<complexType name="transferResultType">
<sequence>
<element name="currency" type="fee:currencyType" />

<!-- only used op="query" responses -->
<element name="period" type="domain:periodType"
minOccurs="0" />

<element name="fee" type="fee:feeType"
maxOccurs="unbounded" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>

<!--
delete result
-->
<complexType name="deleteDataType">
<sequence>
<element name="currency" type="fee:currencyType" />
<element name="credit" type="fee:creditType"
minOccurs="0" maxOccurs="unbounded" />
<element name="balance" type="fee:balanceType"
minOccurs="0" />
<element name="creditLimit" type="fee:creditLimitType"
minOccurs="0" />
</sequence>
</complexType>

<!--
common types
-->
<simpleType name="currencyType">
<restriction base="string">
<pattern value="[A-Z]{3}" />
</restriction>
</simpleType>

<complexType name="commandType">
<simpleContent>
<extension base="fee:commandTypeValue">
<attribute name="phase" type="token" />
<attribute name="subphase" type="token" />
</extension>
</simpleContent>
</complexType>

<simpleType name="commandTypeValue">
<restriction base="token">
<minLength value="3"/>
<maxLength value="16"/>
</restriction>
</simpleType>

<simpleType name="nonNegativeDecimal">
<restriction base="decimal">
<minInclusive value="0" />
</restriction>
</simpleType>

<simpleType name="negativeDecimal">
<restriction base="decimal">
<maxInclusive value="0" />
</restriction>
</simpleType>

<complexType name="feeType">
<simpleContent>
<extension base="fee:nonNegativeDecimal">
<attribute name="description"/>
<attribute name="refundable" type="boolean" />
<attribute name="grace-period" type="duration" />
<attribute name="applied" default="immediate">
<simpleType>
<restriction base="token">
<enumeration value="immediate" />
<enumeration value="delayed" />
</restriction>
</simpleType>
</attribute>
</extension>
</simpleContent>
</complexType>

<complexType name="creditType">
<simpleContent>
<extension base="fee:negativeDecimal">
<attribute name="description"/>
</extension>
</simpleContent>
</complexType>

<simpleType name="balanceType">
<restriction base="decimal" />
</simpleType>

<simpleType name="creditLimitType">
<restriction base="decimal" />
</simpleType>

</schema>
10 changes: 10 additions & 0 deletions Protocols/EPP/eppExtensions/fee-0.11/includes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
$this->addExtension('fee-0.11','urn:ietf:params:xml:ns:fee-0.11');
#
# Load the fee-0.11 specific additions
# SOURCE: https://datatracker.ietf.org/doc/draft-ietf-regext-epp-fees/00/
#
include_once(dirname(__FILE__) . '/eppRequests/fee011EppCheckDomainRequest.php');
include_once(dirname(__FILE__) . '/eppResponses/fee011EppCheckDomainResponse.php');

$this->addCommandResponse('Metaregistrar\EPP\fee011EppCheckDomainRequest','Metaregistrar\EPP\fee011EppCheckDomainResponse');
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
namespace Metaregistrar\EPP;

/**
* Class furyEppException
*
* CIRA Fury 2.1 errors carry a registry-specific <fury:ciraCode> inside the
* standard EPP <result><extValue> block, e.g.:
*
* <result code="2303">
* <msg>Object does not exist</msg>
* <extValue>
* <value><fury:ciraCode>8010</fury:ciraCode></value>
* <reason>Domain name does not exist</reason>
* </extValue>
* </result>
*
* @package Metaregistrar\EPP
*/
class furyEppException extends eppException {

public function getCiraCode() {
return $this->getResponse()->queryPath('/epp:epp/epp:response/epp:result/epp:extValue/epp:value/fury:ciraCode');
}

public function getCiraReason() {
return $this->getResponse()->queryPath('/epp:epp/epp:response/epp:result/epp:extValue/epp:reason');
}
}
Loading