From e8beebd4ee596ce2e11e806b620be5ee739d0da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CReshad?= <“reshad@versio.nl”> Date: Fri, 8 Sep 2017 16:27:36 +0200 Subject: [PATCH] update new version --- README.md | 34 +- versio/class_versio_api.php | 78 ---- versio/logo.gif | Bin 1932 -> 0 bytes versio/versio.php | 836 ------------------------------------ 4 files changed, 32 insertions(+), 916 deletions(-) delete mode 100755 versio/class_versio_api.php delete mode 100755 versio/logo.gif delete mode 100755 versio/versio.php diff --git a/README.md b/README.md index 97a124e..751fda7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Versio-WHMCS -1. Add the ‘registrars’ directory, together with its contents to the ‘modules’ directory in the WHMCS root +1. Upload the files in the WHMCS root directory 2. Log in to WHMCS as Admin 3. Go to Setup -> Products/Services -> Domain Registrars 4. Activate the Versio module by clicking ‘Activate’ @@ -11,7 +11,37 @@ 7. Save the settings. 8. The Versio WHMCS module is now ready for use. -Check if the WHMCS domain cron is added. +Check if the WHMCS domain cron is added. For details see: https://docs.whmcs.com/Crons#Domain_Sync_Cron +If you find anything that’s not working as it should, please contact our helpdesk. + +# WHMCS SSL module + +1. Log in to WHMCS as Admin +2. Go to Settings -> Modules -> Versio Product addon +3. Activate the Versio module by clicking ‘Activate’ +4. Click ‘Configure’ +5. Enter the details that are required +-- Set TestMode off to use the production mode. +-- Permissions select Full Administrator. + +6. Save the settings. +7. Go to Modules -> Versio Product addon +8. Choose ‘Synchronize SSL products with Versio’ to load all Versio SSL products +9. Add a product. Go to Settings -> Products -> Product +10. Add a category. Example: SSL Certificates +11. Choose: Add a new product +-- Product type: product +-- Category: SSL Certificates +-- Name: the SSL certificate productname you want to sell. +-- Press add. + +12. In the Tab choose for external connections +-- Select module: Versio Product addons +-- Select the SSL product. + +13. Set other options like price etc. in the other tabs and save. + ( follow step 12/14 for all certificates ) + If you find anything that’s not working as it should, please contact our helpdesk. \ No newline at end of file diff --git a/versio/class_versio_api.php b/versio/class_versio_api.php deleted file mode 100755 index aaee3b7..0000000 --- a/versio/class_versio_api.php +++ /dev/null @@ -1,78 +0,0 @@ -loginusername = $username; - $this->loginpassword = $password; - } - - function setApi_debug() - { - $this->debug = true; - } - - function setApi_testmodus($testmodus) - { - if ($testmodus == 'true') { - $this->endpoint = 'https://www.versio.nl/testapi/v1'; - }else{ - $this->endpoint = 'https://www.versio.nl/api/v1'; - } - } - - function setApi_output($outputresult) - { - $this->output = $outputresult; - } - - function request($requesttype, $request, $data=array()) - { - $url = $this->endpoint.$request; - $ch = curl_init(); - curl_setopt($ch, CURLOPT_USERPWD, $this->loginusername . ":" . $this->loginpassword); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $requesttype); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec($ch); - $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - - $debugdata = array('requesttype' => $requesttype, 'url' => $url, 'postdata' => $data, 'result' => $result, 'httpcode' => $httpcode); - - logModuleCall('versio', 'API CALL', 'Request', $debugdata); - - if($this->debug) { - var_dump($debugdata); - } - - $codes = array('200', '201', '202', '400', '401', '404'); - - if($this->output == 'json') { - $result = json_decode($result, 1); - $result['httpcode'] = $httpcode; - - if (in_array($httpcode, $codes)) { - return json_encode($result); - }else{ - $error = array(); - $error['error']['message'] = 'Request failed'; - return json_encode($error); - } - - } else { - - $result = json_decode($result, 1); - $result['httpcode'] = $httpcode; - - if (in_array($httpcode, $codes)) { - return $result; - }else{ - $error = array(); - $error['error']['message'] = 'Request failed'; - return $error; - } - } - } -} \ No newline at end of file diff --git a/versio/logo.gif b/versio/logo.gif deleted file mode 100755 index 4ad4bd3f5c334ca8edad9b195e31adbcd8715b87..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1932 zcmXYwc~F)|62==5k)SIY5szSqc)um;fe%NnkRV8cYETz(TMH zECx%1C13;C2sVMuU~90&^)?8C5D0^45Z3_^5P=XFLAz>b02+t}p}}ZqGz1l(LR5r` zQE60yCZLIE5}J&rMpMuNv=A*qi_y|(3EF@*qD^Qs+8S*^0Te_b6h_e~E*-A1k$?!8 zK)Ym-0c0QcZICut z8(JHp6=;Q8kyfmg)=IPq+C*)VHd&imo1!hy7HW&M#oE%^5^aOFQQM?#*0$ERXaOy# zg|x61twr7h!R3YviA$HO=!${?VxSl#28*G^5K$lsMUf~LrA3LDASQ}QVzQW8Oc4vj zLa|6J7E6mIVuRQyHi^w*Yq8%na|O-iwhOsy?*BIbf9_q|do69<0A9h6H&<`|1hf}; z;q}ghL#5TL+rK^duQi8upK|&HepE7{a?hC!-7)>An#$SHsl~yAF1DZYcKPPsp6l}$ z1)g=J4oU2i8G|%&oBO=8`rEi`ojk)9HrG74JF9p^TJWIyXHj!6m!?g59OYj6usTM$ zP3lwhUB=XsHYb*6CpKNGdpBxF@6VE+&HA=9t@dvBhk@ziQxZF!t+|j@dbQ&8TmOEP z?lZn_f0z!P-da~t9URfYI~E%pNr(DA?fFy27a3Q&8)+$zN5&L1oOE9u>Jc(5>H4ZM z`MvAQess&o-4+<%-1y|H>Vqk5Gp0_MR{Ef^wd;WSVSdiptCsBWTN66MbJI=b?%h!3 z52t=<-R35}*EOFzoEJ8D$k6gh_ubz)>h;5=MTJ*4R(CwIr)7F}@ZvSM9@Y7#hXvn@ z`{W)Nf9}%9S??XR7LXp1X6rJ!*PDtJj^I+4n=9{}{O-IHW$)bKW+ z9$fg%IBQfu{w4o*^`x@9-`;a0Kl{BjZ%!@hbnoks`l4AMb^FGd_h@jpJquczZXOHh zGS;dp@AjKrt$O&R#7*m#&|_EZl{4g? zS7Ss;2oGNLseevp)P<1p;L}@LWY)8!JV!xL;^ybQzOUMU^L19$2ImWoitW`E%Vxj3 z=ARe6YX23V)b-WzrzIn14D?ZMdz}lCee06^PdA>SrDGN>91^r<>FSE?+nYX44T_?U zYZJ3(o~$i#pYL%#XiRF-fMYY9c@+!x4u6@Mu)ZjIMqJOz8wE$w&y6ZMvClatt?A0; zQ-e-8HusJQca)a-B^>|ogXXxxdCtEdd76(wRgt|;?kr9|o*Vlx?%aVMXZnBUm0R$8 zx0R&iKcl~U) zglorqx@>%S3kJ@4Qs* 'Versio REST API Module for WHMCS', - 'APIVersion' => '1.0', - ); -} - -function versio_getConfigArray() -{ - return array( - 'Username' => array( - 'Type' => 'text', - 'Size' => '25', - 'Default' => '1024', - 'Description' => 'Enter your username', - ), - 'Password' => array( - 'Type' => 'password', - 'Size' => '25', - 'Default' => '', - 'Description' => 'Enter your password', - ), - 'TestMode' => array( - 'Type' => 'dropdown', - 'Options' => array( - 'true' => 'On', - 'false' => 'Off', - ), - 'Description' => 'Choose one', - ) - ); -} - - -function versio_RegisterDomain($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - // registrant information - $contactDetails = array(); - $contactDetails['company'] = $params["companyname"]; - $contactDetails['firstname'] = $params["firstname"]; - $contactDetails['surname'] = $params["lastname"]; - $contactDetails['email'] = $params["email"]; - $contactDetails['phone'] = $params["phonenumber"]; - $contactDetails['street'] = preg_replace('/^[0-9]+$/', '', $params["address1"]); - $contactDetails['number'] = preg_replace('/\D/', '', $params["address1"]); - $contactDetails['zipcode'] = $params["postcode"]; - $contactDetails['city'] = $params["city"]; - $contactDetails['country'] = $params["countrycode"]; - - $response = $versio->request('POST', '/contacts', $contactDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - die(); - } - - $contactid = $response['contact_id']; - - //domain - - $sld = $params['sld']; - $tld = $params['tld']; - - $domainDetails = array(); - $domainDetails['years'] = $params['regperiod']; - $domainDetails['contact_id'] = $contactid; - $domainDetails['auto_renew'] = true; - - if(!$params['ns1'] == null) - { - $ns[] = array('ns' => $params['ns1'], 'nsip' => ''); - } - - if(!$params['ns2'] == null) - { - $ns[] = array('ns' => $params['ns2'], 'nsip' => ''); - } - - if(!$params['ns3'] == null) - { - $ns[] = array('ns' => $params['ns3'], 'nsip' => ''); - } - - if(!$params['ns4'] == null) - { - $ns[] = array('ns' => $params['ns4'], 'nsip' => ''); - } - - if(!$params['ns5'] == null) - { - $ns[] = array('ns' => $params['ns5'], 'nsip' => ''); - } - - $domainDetails['ns'] = $ns; - - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld, $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array('success' => true); - } -} - - -function versio_TransferDomain($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - // registrant information - $contactDetails = array(); - $contactDetails['company'] = $params["companyname"]; - $contactDetails['firstname'] = $params["firstname"]; - $contactDetails['surname'] = $params["lastname"]; - $contactDetails['email'] = $params["email"]; - $contactDetails['phone'] = $params["phonenumber"]; - $contactDetails['street'] = preg_replace('/^[0-9]+$/', '', $params["address1"]); - $contactDetails['number'] = preg_replace('/\D/', '', $params["address1"]); - $contactDetails['zipcode'] = $params["postcode"]; - $contactDetails['city'] = $params["city"]; - $contactDetails['country'] = $params["countrycode"]; - - $response = $versio->request('POST', '/contacts', $contactDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - die(); - } - - $contactid = $response['contact_id']; - - //domain - - $sld = $params['sld']; - $tld = $params['tld']; - - $domainDetails = array(); - $domainDetails['years'] = $params['regperiod']; - $domainDetails['contact_id'] = $contactid; - $domainDetails['auto_renew'] = true; - $domainDetails['auth_code'] = $params['eppcode']; - - if(!$params['ns1'] == null) - { - $ns[] = array('ns' => $params['ns1'], 'nsip' => ''); - } - - if(!$params['ns2'] == null) - { - $ns[] = array('ns' => $params['ns2'], 'nsip' => ''); - } - - if(!$params['ns3'] == null) - { - $ns[] = array('ns' => $params['ns3'], 'nsip' => ''); - } - - if(!$params['ns4'] == null) - { - $ns[] = array('ns' => $params['ns4'], 'nsip' => ''); - } - - if(!$params['ns5'] == null) - { - $ns[] = array('ns' => $params['ns5'], 'nsip' => ''); - } - - $domainDetails['ns'] = $ns; - - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld.'/transfer', $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array('success' => true); - } -} - -function versio_RenewDomain($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $domainDetails = array(); - $domainDetails['years'] = $params['regperiod']; - - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld.'/renew', $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array('success' => true); - } -} - - -function versio_GetNameservers($params) -{ -// user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - - $response = $versio->request('GET', '/domains/'.$sld.'.'.$tld); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array( - 'dnsmanagement' => $response['domainInfo']['dns_management'], - 'success' => true, - 'ns1' => $response['domainInfo'][ns][0][ns], - 'ns2' => $response['domainInfo'][ns][1][ns], - 'ns3' => $response['domainInfo'][ns][2][ns], - 'ns4' => $response['domainInfo'][ns][3][ns], - 'ns5' => $response['domainInfo'][ns][4][ns]); - } -} - -function versio_SaveNameservers($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $domainDetails = array(); - $ns = array(); - - if(!$params['ns1'] == null) - { - $ns[] = array('ns' => $params['ns1'], 'nsip' => ''); - } - - if(!$params['ns2'] == null) - { - $ns[] = array('ns' => $params['ns2'], 'nsip' => ''); - } - - if(!$params['ns3'] == null) - { - $ns[] = array('ns' => $params['ns3'], 'nsip' => ''); - } - - if(!$params['ns4'] == null) - { - $ns[] = array('ns' => $params['ns4'], 'nsip' => ''); - } - - if(!$params['ns5'] == null) - { - $ns[] = array('ns' => $params['ns5'], 'nsip' => ''); - } - - if(($params['ns1'] == 'nszero1.axc.nl' || $params['ns2'] == 'nszero2.axc.nl') || ($params['ns1'] == 'nszero1.axc.eu' || $params['ns2'] == 'nszero2.axc.eu')) - { - $domainDetails['dns_management'] = true; - }else{ - //$domainDetails['dns_management'] = false; - $domainDetails['ns'] = $ns; - } - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld.'/update', $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array('success' => true); - } -} - -function versio_GetContactDetails($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $response = $versio->request('GET', '/domains/'.$sld.'.'.$tld); - - if($response['error']) - { - return array('error' => $response['error']['message']); - die(); - } - - $registrant_id = $response['domainInfo']['registrant_id']; - - if(!$registrant_id) - { - return array('error' => 'No contact information available'); - die(); - } - - - $response = $versio->request('GET', '/contacts/'.$registrant_id); - - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - - return array( - 'Registrant' => array( - 'First Name' => $response['contactInfo']['firstname'], - 'Last Name' => $response['contactInfo']['surname'], - 'Company Name' => $response['contactInfo']['company'], - 'Email Address' => $response['contactInfo']['email'], - 'Address 1' => $response['contactInfo']['street'].' '.$response['contactInfo']['number'], - 'City' => $response['contactInfo']['city'], - 'Postcode' => $response['contactInfo']['zipcode'], - 'Country' => $response['contactInfo']['country'], - 'Phone Number' => $response['contactInfo']['phone']) ); - } -} - -function versio_SaveContactDetails($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - // registrant information - - $contactDetails = array(); - $contactDetails['company'] = $params['contactdetails']['Registrant']['Company Name']; - $contactDetails['firstname'] = $params['contactdetails']['Registrant']['First Name']; - $contactDetails['surname'] = $params['contactdetails']['Registrant']['Last Name']; - $contactDetails['email'] = $params['contactdetails']['Registrant']['Email Address']; - $contactDetails['phone'] = $params['contactdetails']['Registrant']['Phone Number']; - $contactDetails['street'] = preg_replace('/[0-9]+/', '', $params['contactdetails']['Registrant']['Address 1']); - $contactDetails['number'] = preg_replace('/\D/', '', $params['contactdetails']['Registrant']['Address 1']); - $contactDetails['zipcode'] = $params['contactdetails']['Registrant']['Postcode']; - $contactDetails['city'] = $params['contactdetails']['Registrant']['City']; - $contactDetails['country'] = $params['contactdetails']['Registrant']['Country']; - - $response = $versio->request('POST', '/contacts', $contactDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - die(); - } - - $domainDetails = array(); - $domainDetails['registrant_id'] = $response['contact_id']; - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld.'/update', $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array('success' => true); - } -} - -function versio_GetRegistrarLock($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $response = $versio->request('GET', '/domains/'.$sld.'.'.$tld); - - if($response['error']) - { - return array('error' => $response['error']['message']); - die(); - } - - return ($response['domainInfo']['lock'] == 'true') ? 'locked' : 'unlocked'; -} - -function versio_SaveRegistrarLock($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $domainDetails = array(); - $domainDetails['lock'] = ($params['lockenabled'] == 'locked') ? true : false; - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld.'/update', $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array('success' => true); - } -} - -function versio_GetDNS($params) -{ -// user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - - $response = $versio->request('GET', '/domains/'.$sld.'.'.$tld.'?show_dns_records=true'); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - - $hostRecords = array(); - - $records = count($response['domainInfo']['dns_records']); - - $i = 0; - - do { - - - $hostRecords[] = array("hostname" => $response['domainInfo']['dns_records'][$i]['name'], // eg. www - "type" => $response['domainInfo']['dns_records'][$i]['type'], // eg. A - "address" => $response['domainInfo']['dns_records'][$i]['value'], // eg. 10.0.0.1 - "priority" => $response['domainInfo']['dns_records'][$i]['prio'], // eg. 10 (N/A for non-MX records) - ); - - $i++; - - } while ($i < $records); - - //redirections - - $redirections = count($response['domainInfo']['dns_redirections']); - - $i = 0; - - do { - - if(!$redirections == 0) - { - $hostRecords[] = array("hostname" => $response['domainInfo']['dns_redirections'][$i]['from'], // eg. domain.nl - "type" => 'URL', // eg. A - "address" => $response['domainInfo']['dns_redirections'][$i]['destination'], // eg. http://www.google.nl - ); - } - - $i++; - - } while ($i < $redirections); - - - return $hostRecords; - - } -} - -function versio_SaveDNS($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $domainDetails = array(); - $dnsRecords = array(); - $redirect = array(); - - foreach($params['dnsrecords'] as $dnsrecord) - { - if($dnsrecord['type'] == 'MXE') - { - return array('error' => 'Record type MXE is not supported'); - die(); - } elseif($dnsrecord['type'] == 'FRAME') { - return array('error' => 'Record type FRAME is not supported'); - die(); - }else{ - - if(!$dnsrecord['hostname'] == NULL) - { - - if($dnsrecord['priority'] = 'N\/A') - { - $dnsrecord['priority'] = '0'; - } - - if($dnsrecord['type'] == 'URL') { - $redirect[] = array("from" => $dnsrecord['hostname'], "destination" => $dnsrecord['address']); - }else{ - $dnsRecords[] = array('type' => $dnsrecord['type'], 'name' => $dnsrecord['hostname'], 'value' => $dnsrecord['address'], 'prio' => $dnsrecord['priority'], 'ttl' => '3600'); - } - } - } - } - - $domainDetails['dns_records'] = $dnsRecords; - $domainDetails['dns_redirections'] = $redirect; - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld.'/update', $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array('success' => true); - } - -} - -function versio_IDProtectToggle($params) -{ - return 'Not implemented'; -} - -function versio_GetEPPCode($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $response = $versio->request('GET', '/domains/'.$sld.'.'.$tld.'?show_epp_code=true'); - - - if($response['error']) - { - return array('error' => $response['error']['message']); - die(); - } - - if($tld == 'be') - { - return array( - 'eppcode' => 'EPP code will be sent by email', - ); - - }else{ - return array( - 'eppcode' => $response['domainInfo']['epp_code'], - ); - } - -} - -function versio_ReleaseDomain($params) -{ - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $domainDetails = array(); - $domainDetails['tag'] = $params['transfertag']; - - $response = $versio->request('POST', '/domains/'.$sld.'.'.$tld.'/update/nominettag', $domainDetails); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - $status = $response['domainInfo']['status']; - - switch ($status) { - case "TRANSFERRED_OUT": - return array('success' => 'success'); - break; - case "WAITING_FOR_HANDSHAKE": - return array('success' => 'success'); - break; - default: - return array('error' => 'failed'); - } - } - -} - -function versio_RequestDelete($params) -{ -// user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $response = $versio->request('DELETE', '/domains/'.$sld.'.'.$tld); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - return array( - 'success' => 'success'); - } - -} - -function versio_Sync($params) -{ - // user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $response = $versio->request('GET', '/domains/'.$sld.'.'.$tld); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - - $status = $response['domainInfo']['status']; - $dns_management = $response['domainInfo']['dns_management']; - - switch ($status) { - case "OK": - return array('dnsmanagement' => $dns_management, 'expirydate' => response['domainInfo']['expire-date'], 'active' => true); - break; - case "PENDING": - return array('active' => false); - break; - case "INACTIVE": - return array('expired' => true); - break; - case "PENDING_TRANSFER": - return array('active' => false); - break; - default: - $returnstatus = array('active' => true); - return array('dnsmanagement' => $dns_management, 'expirydate' => response['domainInfo']['expire-date'], 'active' => true); -} - - } -} - -function versio_TransferSync($params) -{ -// user defined configuration values - $username = $params['Username']; - $password = $params['Password']; - $testmode = $params['TestMode']; - - $versio = new Versio_API(); - $versio->setApi_login($username, $password); - - $versio->setApi_testmodus($testmode); - - //domain - $sld = $params['sld']; - $tld = $params['tld']; - - $response = $versio->request('GET', '/domains/'.$sld.'.'.$tld); - - if($response['error']) - { - return array('error' => $response['error']['message']); - }else{ - - $status = $response['domainInfo']['status']; - - switch ($status) { - case "OK": - return array('completed' => true, 'expirydate' => $response['domainInfo']['expire-date']); - break; - case "PENDING": - return array(); - break; - case "INACTIVE": - return array(); - break; - case "PENDING_TRANSFER": - return array(); - break; - default: - return array(); - } - } -} \ No newline at end of file