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
81 changes: 81 additions & 0 deletions Protocols/EPP/eppExtensions/it-extcon-1.0/eppData/itEppContact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
namespace Metaregistrar\EPP;
/**
* The Contact Info Object
*
* This will hold the complete contact info a registry can receive and give you
*
*/

class itEppContact extends eppContact {

private $entityTypes = [
1, // Italian and foreign natural persons
2, // Companies/one man companie
3, // Freelance workers/professionals
4, // Non-profit organizations
5, // Public organizations
6, // Other subjects
7, // Foreigners who match 2-6
];

private $consentForPublishing;
private $registrantEntityType;
private $registrantNationalityCode;
private $registrantRegCode;

public function __construct($postalInfo = null, $email = null, $voice = null, $fax = null, $password = null, $status = null, $consentForPublishing = null, $entityType = null, $nationalityCode = null, $regCode = null) {
parent::__construct($postalInfo, $email, $voice, $fax, $password, $status);

$this->setConsentForPublishing($consentForPublishing);
$this->setRegistrant($entityType, $nationalityCode, $regCode);
}

public function setConsentForPublishing($consent = false)
{
$this->consentForPublishing = $consent ? 1 : 0;
}

public function getConsentForPublishing()
{
return $this->consentForPublishing;
}

public function setRegistrantEntityType($entityType)
{
if (!in_array($entityType, $this->entityTypes)) {
throw new eppException(sprintf('The entity type: \'%s\' is invalid', $entityType));
}
$this->registrantEntityType = $entityType;
}

public function setRegistrantNationalityCode($nationalityCode)
{
if (!empty($nationalityCode)) {
$this->registrantNationalityCode = $nationalityCode;
}
}

public function setRegistrantRegCode($regCode)
{
if (!empty($regCode)) {
$this->registrantRegCode = $regCode;
}
}

public function setRegistrant($entityType, $nationalityCode, $regCode)
{
$this->setRegistrantEntityType($entityType);
$this->setRegistrantNationalityCode($nationalityCode);
$this->setRegistrantRegCode($regCode);
}

public function getRegistrant()
{
return [
'entityType' => $this->registrantEntityType,
'nationalityCode' => $this->registrantNationalityCode,
'regCode' => $this->registrantRegCode
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
namespace Metaregistrar\EPP;
/*
<extension>
<extcon:create xmlns:extcon="http://www.nic.it/ITNIC-EPP/extcon-1.0" xsi:schemaLocation="http://www.nic.it/ITNIC-EPP/extcon-1.0 extcon-1.0.xsd">
<extcon:consentForPublishing>true</extcon:consentForPublishing>
<extcon:registrant>
<extcon:nationalityCode>IT</extcon:nationalityCode>
<extcon:entityType>1</extcon:entityType>
<extcon:regCode>BSSRCR78D03G674P</extcon:regCode>
</extcon:registrant>
</extcon:create>
</extension>
*/

class itEppCreateContactRequest extends eppCreateContactRequest {

/**
* itEppCreateContactRequest constructor.
* @param eppContact|null $createInfo
* @param string $contacttype
* @param string $language
* @throws eppException
*/
function __construct(itEppContact $createInfo) {
parent::__construct($createInfo);
$this->addContactExtension($createInfo);
$this->addSessionId();
}

/**
* @param object eppContact
*/
public function addContactExtension(itEppContact $createInfo) {
$this->addExtension('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$this->addExtension('xsi:schemaLocation', 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd');

$this->contactobject->setAttribute('xmlns:contact', 'urn:ietf:params:xml:ns:contact-1.0');
$this->contactobject->setAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd');

$create = $this->createElement('extcon:create');
$create->setAttribute('xmlns:extcon', 'http://www.nic.it/ITNIC-EPP/extcon-1.0');
$create->setAttribute('xsi:schemaLocation', 'http://www.nic.it/ITNIC-EPP/extcon-1.0 extcon-1.0.xsd');

$create->appendChild($this->createElement('extcon:consentForPublishing', $createInfo->getConsentForPublishing()));

$registrant = $createInfo->getRegistrant();
$registrantElement = $this->createElement('extcon:registrant');
$registrantElement->appendChild($this->createElement('extcon:nationalityCode', $registrant['nationalityCode']));
$registrantElement->appendChild($this->createElement('extcon:entityType', $registrant['entityType']));
$registrantElement->appendChild($this->createElement('extcon:regCode', $registrant['regCode']));
$create->appendChild($registrantElement);

$this->getExtension()->appendChild($create);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
namespace Metaregistrar\EPP;

class itEppInfoContactResponse extends eppInfoContactResponse {

/**
*
* @return eppContact
*/
public function getContact()
{
$postalinfo = $this->getContactPostalInfo();

$contact = new itEppContact($postalinfo, $this->getContactEmail(), $this->getContactVoice(), $this->getContactFax(), null, null, $this->getConsentForPublishing(), $this->getRegistrantEntityType(), $this->getRegistrantNationalityCode(), $this->getRegistrantRegCode());
return $contact;
}

public function isRegistrant()
{
return $this->queryPath('/epp:epp/epp:response/epp:extension/extcon:infData/extcon:registrant') ? true : false;
}

public function getConsentForPublishing()
{
return (bool) $this->queryPath('/epp:epp/epp:response/epp:extension/extcon:infData/extcon:consentForPublishing');
}

public function getRegistrantEntityType()
{
return (int) $this->queryPath('/epp:epp/epp:response/epp:extension/extcon:infData/extcon:registrant/extcon:entityType');
}

public function getRegistrantNationalityCode()
{
return $this->queryPath('/epp:epp/epp:response/epp:extension/extcon:infData/extcon:registrant/extcon:nationalityCode');
}

public function getRegistrantRegCode()
{
return $this->queryPath('/epp:epp/epp:response/epp:extension/extcon:infData/extcon:registrant/extcon:regCode');
}

public function getRegistrant()
{
$registrant['nationalityCode'] = $this->getRegistrantNationalityCode();
$registrant['entityType'] = $this->getRegistrantEntityType();
$registrant['regCode'] = $this->getRegistrantRegCode();

return $registrant;
}
}
9 changes: 9 additions & 0 deletions Protocols/EPP/eppExtensions/it-extcon-1.0/includes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
$this->addExtension('extcon-1.0', 'http://www.nic.it/ITNIC-EPP/extcon-1.0');

include_once(dirname(__FILE__) . '/eppData/itEppContact.php');
include_once(dirname(__FILE__) . '/eppRequests/itEppCreateContactRequest.php');
include_once(dirname(__FILE__) . '/eppResponses/itEppInfoContactResponse.php');

$this->addCommandResponse('Metaregistrar\EPP\itEppCreateContactRequest', 'Metaregistrar\EPP\eppCreateContactResponse');
$this->addCommandResponse('Metaregistrar\EPP\eppInfoContactRequest', 'Metaregistrar\EPP\itEppInfoContactResponse');
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
namespace Metaregistrar\EPP;

class itEppLoginResponse extends eppResponse {
function __construct() {
parent::__construct();
}

function __destruct() {
parent::__destruct();
}

/**
* Return the available credit in euros
* @return float
*/
public function getCredit()
{
return (float) $this->queryPath('/epp:epp/epp:response/epp:extension/extepp:creditMsgData/extepp:credit');
}
}
6 changes: 6 additions & 0 deletions Protocols/EPP/eppExtensions/it-extepp-2.0/includes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
$this->addExtension('extepp-2.0', 'http://www.nic.it/ITNIC-EPP/extepp-2.0');

include_once(dirname(__FILE__) . '/eppResponses/itEppLoginResponse.php');

$this->addCommandResponse('Metaregistrar\EPP\eppLoginRequest', 'Metaregistrar\EPP\itEppLoginResponse');