Jump to content

Registrar module response on success and error


nordkappnett

Recommended Posts

Hello,

We have a custom made registrar module that does not handle the response from the EPP correctly.

If we renew a domain, we are sending a scheme and gets this response:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
  <response>
    <result code="1000">
      <msg>Command completed successfully</msg>
    </result>
    <extension>
      <conditions xmlns="http://www.norid.no/xsd/no-ext-result-1.0" xsi:schemaLocation="http://www.norid.no/xsd/no-ext-result-1.0 no-ext-result-1.0.xsd">
        <condition code="EC001024" severity="info">
          <msg>Command completed</msg>
          <details>Domain [xxxxxxx.no] has been renewed.</details>
        </condition>
      </conditions>
    </extension>
    <trID>
      <clTRID>NO-1638355816</clTRID>
      <svTRID>20211201115016414204-sgbnip-reg787-NORID</svTRID>
    </trID>
  </response>
</epp>

 

If the module fails we get something like this where the result code is something different than 1000:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
  <response>
    <result code="2105">
      <msg>Object is not eligible for renewal</msg>
    </result>
    <extension>
      <conditions xmlns="http://www.norid.no/xsd/no-ext-result-1.0" xsi:schemaLocation="http://www.norid.no/xsd/no-ext-result-1.0 no-ext-result-1.0.xsd">
        <condition code="EC001025" severity="info">
          <msg>Command failed</msg>
          <details>Failed to renew domain [xxxxxxx.no].</details>
        </condition>
        <condition code="EC002003" severity="error">
          <msg>Domain is not renewable</msg>
          <details>Domain [xxxxxxx.no] is not renewable before [2022-08-27].</details>
        </condition>
      </conditions>
    </extension>
    <trID>
      <clTRID>NO-1638357009</clTRID>
      <svTRID>20211201121009491920-2rth67-reg787-NORID</svTRID>
    </trID>
  </response>
</epp>

 

Here is the code in the module when sending a renew domain function:

function norid_RenewDomain($params) {

    $apiuser = $params['APIUsername'];
    $apipass = $params['APIPassword'];
    $sld = $params['sld_punycode'];
    $tld = $params['tld_punycode'];
    $domain = $sld . '.' . $tld;

    try {
        $api = new ApiClient($apiuser, $apipass, $params['APIServer']);
        $getdomaininfo = $api->call('domainGetExpiredate', ['domain' => $domain]);
        $expirationDate = Carbon::parse(strval($getdomaininfo->resData->domain_infData->domain_exDate))->format('Y-m-d');
        $response = $api->call('domainRenew', ['domain' => $domain, 'expdate' => $expirationDate]);
    }

    catch (\Exception $e) {
        return array(
            'error' => $e->getMessage(),
        );
    }

    $api->logout();
    return ['success' => true];
}

 

 

So my big question is how to handle this response? I am not a developer myself,  so any suggestions will be highly appreciated  🙂

Thanks,

Haavard D.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated