Exemplo n.º 1
0
 /**
  * 
  * @param integer $domainId
  * @param string $type
  */
 private function createNic($domainId, $type = 'owner')
 {
     $soap = $this->Connect();
     if (!empty($this->session)) {
         $tld = Domains::getDomainTld($domainId);
         // get the domain profile
         $profile = DomainsProfiles::getProfileByDomainId($domainId, $type);
         if ($profile) {
             // Set generic variables for parameters
             $profile['countrycode'] = strtolower(Countries::getCodebyId($profile['country_id']));
             $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($profile['birthdate']);
             $profile['password'] = Shineisp_Commons_Utilities::GenerateRandomString();
             $profile['fullname'] = $profile['firstname'] . " " . $profile['lastname'];
             $profile['legalform'] = strtolower($profile['Legalforms']['name']);
             $profile['corporationtype'] = strtolower($profile['CompanyTypes']['name']);
             $profile['legalnumber'] = null;
             $profile['language'] = "en";
             $profile['isowner'] = $type == "owner" ? true : false;
             if ($tld == "it") {
                 // Create a nicHandle for the Italian domain tld
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['gender'];
                 // Gender
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
                 // Country Code
                 $params[] = $profile['language'];
                 // Language
                 $params[] = $profile['isowner'];
                 // isOwner
                 $params[] = $profile['legalform'];
                 // Legalform
                 $params[] = $profile['company'];
                 // Organisation
                 $params[] = $profile['fullname'];
                 // Legal name
                 $params[] = $profile['legalnumber'];
                 // Legal Number
                 $params[] = $profile['vat'];
                 // VAT or IVA
                 $params[] = $profile['birthdate'];
                 // Birthday
                 $params[] = $profile['birthplace'];
                 // Birthcity
                 $params[] = $profile['taxpayernumber'];
                 // Contact fiscal code or company vat
                 $params[] = $profile['vat'];
                 // Company National Identification Number
                 $params[] = $profile['corporationtype'];
                 $nicHandle = call_user_func_array(array($soap, 'nicCreateIT'), $params);
                 Shineisp_Commons_Utilities::log('Calling profile nicCreateIT with these params: ' . json_encode($params), "registrar.ovh.log");
             } else {
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
                 // Country Code
                 $params[] = $profile['language'];
                 // Language
                 $params[] = $profile['isowner'];
                 // isOwner
                 $params[] = $profile['legalform'];
                 // Legalform
                 $params[] = $profile['company'];
                 // Organisation
                 $params[] = $profile['fullname'];
                 // Legal name
                 $params[] = $profile['legalnumber'];
                 // Legal Number
                 $params[] = $profile['vat'];
                 // VAT or IVA
                 $nicHandle = call_user_func_array(array($soap, 'nicCreate'), $params);
                 Shineisp_Commons_Utilities::log('Calling profile nicCreate with these params: ' . json_encode($params), "registrar.ovh.log");
             }
             if (!empty($nicHandle)) {
                 CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle, $type, $profile['profile_id']);
                 // Save the nic-Handle in the database
             }
         } else {
             // If the client has not create any profile, the main client information will be set in all domain tld field [admin, tech, owner, billing]
             // Get the domain information
             $domain = Domains::find($domainId);
             // Create the OVH nic-Handle
             $nicHandle = $this->createNicHandlebyCustomer($domain[0]['customer_id'], $domainId);
             // Save the nic-Handle in the database
             CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle);
         }
         return $nicHandle;
     }
     return false;
 }