metaregistrar / php-epp-client

Object-oriented PHP EPP Client
https://www.metaregistrar.com/docs/
MIT License
214 stars 160 forks source link

iis contact id format #25

Closed kg00 closed 8 years ago

kg00 commented 8 years ago

Adding a contact doesn't work for iis. Gives Error 2004. The iis registry (.se) has the following requirements for the contact id:

Maximum length is 16 characters Starts with at least two letters a-z,A-Z Followed by 4 digits 0-9 Followed by a dash “-“ Followed by 1 to 9 digits 0-9 Recommended format is: First 6 characters of contact:org/ or contact:name/ 2 digit year, 2 digit month And a index number after the dash E. g. NORDEA0808-00001

How/where can this be added?

//kg00

metaregistrar commented 8 years ago

Have you used the class iisEppCreateContactRequest instead of the regular eppCreateContactRequest?

IIS have some special contact requirements, like the organisation number and vat number that must be added.

I will try to recreate your problem using our own IIS epp connection.

kg00 commented 8 years ago

Yes, we use iisEppCreateContactRequest The problem is not the orgno or the vatno. It is the format of the contact id. Created a simple function to create a correct format (although not using contact:org or contact:name but insted random first 6). This works, but I do not know how to add it. For now I have just added it in generateContactId in eppContact.php "hard-coded" in order to test and it works fine.

`// Create contactid with 6 random letters, year (yy) month (mm) - and number of seconds since midnight (if less than 10000, add 0 before to have 5 numbers)

private function create_contact_id_iis() {
    $charset = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
    $contact_id = substr(str_shuffle($charset), 0, 6) . date("ym") . "-" . str_pad((time() - strtotime("today")), 5, '0', STR_PAD_LEFT);
    return $contact_id;
}`
kg00 commented 8 years ago

A comment about the iis recommended format: If you go for the recommended format with the contact id starting with "First 6 characters of contact:org/ or contact:name/ " you have to be aware that there might be non-ascii characters in contact:org and contact:name. Those will not be accepted as part of the contact id. We have solved this by replacing those non-ascii with "z" Also situations where contact:org or contact:name is less than 6 characters has to be considered. We have added "x" to those to get 6 characters.

metaregistrar commented 8 years ago

I have added your contact generating function to iisEppCreateContactRequest.php, this overwrites the standard contact:id with the generated one. Please check if this works for you. The EPP output i get looks fine

<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns:iis="urn:se:iis:xml:epp:iis-1.2">
  <command>
    <create>
       <contact:create>
        <contact:id>owsfri1603-35846</contact:id>

....

kg00 commented 8 years ago

Works fine. Thank you.

metaregistrar commented 8 years ago

Last update: i have made contact:id creation more fancy by using the name/organization of the contact and applying your comment to remove spaces, non-ascii and padding to 6 chars.