Skip to content

Commit fc8fc23

Browse files
committed
Added support for Arnes .SI (Slovenia)
1 parent ec18109 commit fc8fc23

File tree

5 files changed

+144
-0
lines changed

5 files changed

+144
-0
lines changed

Protocols/EPP/eppData/eppContactPostalInfo.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class eppContactPostalInfo {
1717
private $countrycode;
1818
private $type;
1919

20+
const POSTAL_TYPE_LOC = 'loc';
21+
const POSTAL_TYPE_INT = 'int';
22+
2023

2124
/**
2225
*
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
namespace Metaregistrar\EPP;
3+
4+
5+
class siEppContactPostalInfo extends eppContactPostalInfo
6+
{
7+
const ARNES_CONTACT_TYPE_PERSON = 'person';
8+
const ARNES_CONTACT_TYPE_ORG = 'org';
9+
10+
private $contactType;
11+
private $contactID;
12+
/**
13+
*
14+
* @param string $name
15+
* @param string $city
16+
* @param string $countrycode
17+
* @param string $organisationName
18+
* @param string $street
19+
* @param string $province
20+
* @param string $zipcode
21+
* @param string $type POSTAL_TYPE_LOC or POSTAL_TYPE_INT
22+
*/
23+
public function __construct(
24+
$name = null,
25+
$city = null,
26+
$countrycode = null,
27+
$organisationName = null,
28+
$street = null,
29+
$province = null,
30+
$zipcode = null,
31+
$type = self::POSTAL_TYPE_INT
32+
) {
33+
parent::__construct($name, $city, $countrycode, $organisationName, $street, $province, $zipcode, $type);
34+
$this->contactType = self::ARNES_CONTACT_TYPE_PERSON;
35+
}
36+
/**
37+
*
38+
* @param string $type person or org
39+
*/
40+
public function setContactType($type)
41+
{
42+
$type = strtolower($type);
43+
if (($type != self::ARNES_CONTACT_TYPE_PERSON) && ($type!=self::ARNES_CONTACT_TYPE_ORG)) {
44+
throw new eppException('Person type can only be '.self::ARNES_CONTACT_TYPE_PERSON.' or '.self::ARNES_CONTACT_TYPE_ORG);
45+
}
46+
$this->contactType = $type;
47+
}
48+
public function getContactType()
49+
{
50+
return $this->contactType;
51+
}
52+
public function setContactID($id)
53+
{
54+
$this->contactID = $id;
55+
}
56+
public function getContactID()
57+
{
58+
return $this->contactID;
59+
}
60+
public function getIDType()
61+
{
62+
switch ($this->getContactType()) {
63+
case self::ARNES_CONTACT_TYPE_ORG:
64+
return "maticna";
65+
case self::ARNES_CONTACT_TYPE_PERSON:
66+
default:
67+
return "EMSO";
68+
}
69+
}
70+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
namespace Metaregistrar\EPP;
3+
4+
class siEppCreateContactRequest extends eppCreateContactRequest
5+
{
6+
public function __construct($createinfo)
7+
{
8+
parent::__construct($createinfo);
9+
if ($createinfo instanceof eppContact) {
10+
$this->addExtension('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
11+
$this->addExtension('xmlns:dnssi', 'http://www.arnes.si/xml/epp/dnssi-1.2');
12+
$this->addDnssiExtension($createinfo);
13+
}
14+
$this->addSessionId();
15+
}
16+
private function addDnssiExtension(eppContact $contact)
17+
{
18+
$postalInfo = $contact->getPostalInfo(0);
19+
/* @var $postalInfo \Metaregistrar\EPP\siEppContactPostalInfo */
20+
if ($postalInfo) {
21+
$dnssiext = $this->createElement('dnssi:ext');
22+
$create = $this->createElement('dnssi:create');
23+
$contact = $this->createElement('dnssi:contact');
24+
$typeAttribute = $this->createAttribute('type');
25+
$typeAttribute->value = $postalInfo->getContactType();
26+
$contact->appendChild($typeAttribute);
27+
$create->appendChild($contact);
28+
/* Tega ni vec v novem*/
29+
/*if($postalInfo->getContactID()) {
30+
$id = $this->createElement('dnssi:'.$postalInfo->getIDType(), $postalInfo->getContactID());
31+
$create->appendChild($id);
32+
}*/
33+
$dnssiext->appendChild($create);
34+
$this->getExtension()->appendChild($dnssiext);
35+
}
36+
}
37+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
namespace Metaregistrar\EPP;
3+
4+
5+
class siEppCreateDomainRequest extends eppCreateDomainRequest
6+
{
7+
public function __construct($createinfo)
8+
{
9+
parent::__construct($createinfo);
10+
if ($createinfo instanceof eppDomain) {
11+
$this->createPw($createinfo);
12+
}
13+
}
14+
public function createPw(eppDomain $createinfo)
15+
{
16+
// Create PW tag even if there is no pw
17+
if (!strlen($createinfo->getAuthorisationCode())) {
18+
$authinfo = $this->createElement('domain:authInfo');
19+
$authinfo->appendChild($this->createElement('domain:pw', ""));
20+
$this->domainobject->appendChild($authinfo);
21+
}
22+
}
23+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$this->addExtension("dnssi", "http://www.arnes.si/xml/epp/dnssi-1.2");
3+
#
4+
# For use with the SI connection
5+
#
6+
include_once(dirname(__FILE__) . '/eppData/siEppContactPostalInfo.php');
7+
include_once(dirname(__FILE__) . '/eppRequests/siEppCreateContactRequest.php');
8+
include_once(dirname(__FILE__) . '/eppRequests/siEppCreateDomainRequest.php');
9+
10+
$this->addCommandResponse('Metaregistrar\EPP\siEppCreateDomainRequest', 'Metaregistrar\EPP\eppCreateDomainResponse');
11+
$this->addCommandResponse('Metaregistrar\EPP\siEppCreateContactRequest', 'Metaregistrar\EPP\eppCreateContactResponse');

0 commit comments

Comments
 (0)