Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
- Fixed clTRID in RawXml.php example
- Updated support for .hk
  • Loading branch information
getpinga committed Jun 14, 2024
1 parent 77553af commit 52b2205
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 22 deletions.
5 changes: 3 additions & 2 deletions examples/RawXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Tembo EPP client test file
*
* Written in 2023 by Taras Kondratyuk (https://getpinga.com)
* Written in 2024 by Taras Kondratyuk (https://getpinga.com)
* Based on xpanel/epp-bundle written in 2019 by Lilian Rudenco ([email protected])
*
* @license MIT
Expand All @@ -15,6 +15,7 @@
try
{
$epp = connectEpp('generic');
$clTRID = str_replace('.', '', round(microtime(1), 3));

$params = array(
'xml' => '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Expand All @@ -28,7 +29,7 @@
<domain:name>example.net</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
<clTRID>'.$clTRID.'</clTRID>
</command>
</epp>
');
Expand Down
98 changes: 78 additions & 20 deletions src/Registries/HkEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,6 @@ public function contactCreate($params = array())
$to[] = htmlspecialchars($params['companyname']);
$from[] = '/{{ street1 }}/';
$to[] = htmlspecialchars($params['address1']);
$from[] = '/{{ street2 }}/';
$to[] = htmlspecialchars($params['address2']);
$from[] = '/{{ street3 }}/';
$street3 = (isset($params['address3']) ? $params['address3'] : '');
$to[] = htmlspecialchars($street3);
$from[] = '/{{ city }}/';
$to[] = htmlspecialchars($params['city']);
$from[] = '/{{ state }}/';
Expand All @@ -855,10 +850,28 @@ public function contactCreate($params = array())
$to[] = htmlspecialchars($params['country']);
$from[] = '/{{ phonenumber }}/';
$to[] = htmlspecialchars($params['fullphonenumber']);
$from[] = '/{{ fax }}/';
$to[] = htmlspecialchars($params['fax']);
$from[] = '/{{ email }}/';
$to[] = htmlspecialchars($params['email']);
$from[] = '/{{ authInfo }}/';
$to[] = htmlspecialchars($params['authInfoPw']);
$from[] = '/{{ surname }}/';
$to[] = htmlspecialchars($params['surname']);
$from[] = '/{{ cttype }}/';
$to[] = htmlspecialchars($params['cttype']);
$from[] = '/{{ type_e }}/';
$to[] = htmlspecialchars($params['type_e']);
$from[] = '/{{ docType }}/';
$to[] = htmlspecialchars($params['docType']);
$from[] = '/{{ docNum }}/';
$to[] = htmlspecialchars($params['docNum']);
$from[] = '/{{ docCC }}/';
$to[] = htmlspecialchars($params['docCC']);
$from[] = '/{{ industry }}/';
$to[] = htmlspecialchars($params['industry']);
$from[] = '/{{ mobile }}/';
$to[] = htmlspecialchars($params['mobile']);
$from[] = '/{{ clTRID }}/';
$microtime = str_replace('.', '', round(microtime(1), 3));
$to[] = htmlspecialchars($this->prefix . '-contact-create-' . $microtime);
Expand All @@ -872,28 +885,40 @@ public function contactCreate($params = array())
<create>
<contact:create
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>{{ id }}</contact:id>
<contact:postalInfo type="{{ type }}">
<contact:name>{{ name }}</contact:name>
<contact:org>{{ org }}</contact:org>
<contact:addr>
<contact:street>{{ street1 }}</contact:street>
<contact:street>{{ street2 }}</contact:street>
<contact:street>{{ street3 }}</contact:street>
<contact:city>{{ city }}</contact:city>
<contact:sp>{{ state }}</contact:sp>
<contact:pc>{{ postcode }}</contact:pc>
<contact:cc>{{ country }}</contact:cc>
</contact:addr>
</contact:postalInfo>
<contact:voice>{{ phonenumber }}</contact:voice>
<contact:fax></contact:fax>
<contact:fax>{{ fax }}</contact:fax>
<contact:email>{{ email }}</contact:email>
<contact:authInfo>
<contact:pw>{{ authInfo }}</contact:pw>
</contact:authInfo>
</contact:create>
</create>
<extension>
<ext:extension xmlns:ext="urn:ietf:params:xml:ns:ext-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:ext-1.0 ext-1.0.xsd">
<surname>{{ surname }}</surname>
<cttype>{{ cttype }}</cttype>
<type>{{ type_e }}</type>
<chineseOrg/>
<docType>{{ docType }}</docType>
<docNum>{{ docNum }}</docNum>
<docOriginCC>{{ docCC }}</docOriginCC>
<under18>1</under18>
<industryType>{{ industry }}</industryType>
<otherDoc/>
<mbNumber>{{ mobile }}</mbNumber>
</ext:extension>
</extension>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>');
Expand Down Expand Up @@ -959,6 +984,16 @@ public function contactUpdate($params = array())
$to[] = htmlspecialchars($params['fullphonenumber']);
$from[] = '/{{ email }}/';
$to[] = htmlspecialchars($params['email']);
$from[] = '/{{ docType }}/';
$to[] = htmlspecialchars($params['docType']);
$from[] = '/{{ docNum }}/';
$to[] = htmlspecialchars($params['docNum']);
$from[] = '/{{ docCC }}/';
$to[] = htmlspecialchars($params['docCC']);
$from[] = '/{{ industry }}/';
$to[] = htmlspecialchars($params['industry']);
$from[] = '/{{ mobile }}/';
$to[] = htmlspecialchars($params['mobile']);
$from[] = '/{{ clTRID }}/';
$microtime = str_replace('.', '', round(microtime(1), 3));
$to[] = htmlspecialchars($this->prefix . '-contact-update-' . $microtime);
Expand Down Expand Up @@ -992,6 +1027,19 @@ public function contactUpdate($params = array())
</contact:chg>
</contact:update>
</update>
<extension>
<ext:extension xmlns:ext="urn:ietf:params:xml:ns:ext-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:ext-1.0 ext-1.0.xsd">
<surname/>
<chineseOrg/>
<docType>{{ docType }}</docType>
<docNum>{{ docNum }}</docNum>
<docOriginCC>{{ docCC }}</docOriginCC>
<under18>1</under18>
<industryType>{{ industry }}</industryType>
<otherDoc/>
<mbNumber>{{ mobile }}</mbNumber>
</ext:extension>
</extension>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>');
Expand Down Expand Up @@ -1235,7 +1283,7 @@ public function domainInfo($params = array())
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>{{ domainname }}</domain:name>
<domain:name hosts="all">{{ domainname }}</domain:name>
</domain:info>
</info>
<clTRID>{{ clTRID }}</clTRID>
Expand Down Expand Up @@ -1814,6 +1862,11 @@ public function domainTransfer($params = array())
</domain:authInfo>
</domain:transfer>
</transfer>
<extension>
<ext:extension xmlns:ext="urn:ietf:params:xml:ns:ext-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:ext-1.0 ext-1.0.xsd">
<BundleDomainName/>
</ext:extension>
</extension>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>');
Expand Down Expand Up @@ -1949,8 +2002,6 @@ public function domainCreate($params = array())
}
$from[] = '/{{ contacts }}/';
$to[] = $text;
$from[] = '/{{ authInfoPw }}/';
$to[] = htmlspecialchars($params['authInfoPw']);
$from[] = '/{{ clTRID }}/';
$clTRID = str_replace('.', '', round(microtime(1), 3));
$to[] = htmlspecialchars($this->prefix . '-domain-create-' . $clTRID);
Expand All @@ -1972,16 +2023,16 @@ public function domainCreate($params = array())
<domain:registrant>{{ registrant }}</domain:registrant>
{{ contacts }}
<domain:promotion/>
<domain:authInfo>
<domain:pw/>
</domain:authInfo>
</domain:create>
</create>
<extension>
<ext:extension xmlns:ext="urn:ietf:params:xml:ns:ext-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:ext-1.0 ext-1.0.xsd">
<cttype>O</cttype>
</ext:extension>
</extension>
<extension>
<ext:extension xmlns:ext="urn:ietf:params:xml:ns:ext-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:ext-1.0 ext-1.0.xsd">
<cttype>O</cttype>
<ResellerInformation/>
<FreeBundle/>
<NewBundleDomainName/>
</ext:extension>
</extension>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>');
Expand Down Expand Up @@ -2226,6 +2277,13 @@ public function domainRenew($params = array())
<domain:period unit="y">{{ regperiod }}</domain:period>
</domain:renew>
</renew>
<extension>
<ext:extension xmlns:ext="urn:ietf:params:xml:ns:ext-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:ext-1.0 ext-1.0.xsd">
<BundleDomainName/>
<FreeBundle/>
<NewBundleDomainName/>
</ext:extension>
</extension>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>');
Expand Down

0 comments on commit 52b2205

Please sign in to comment.