Exemple #1
0
 public function getDomainDetails(Registrar_Domain $domain)
 {
     $params = array('domain' => $domain->getName());
     $result = $this->_request('getDomainInfo', $params);
     $result = $result->reply;
     $params = array('contact_id' => (string) $result->contact_ids->registrant);
     $contact = $this->_request('contactList', $params);
     $contact = $contact->reply->contact;
     $c = new Registrar_Domain_Contact();
     $c->setFirstName((string) $contact->first_name)->setLastName((string) $contact->last_name)->setEmail((string) $contact->email)->setCompany((string) $contact->company)->setTel((string) $contact->phone)->setAddress1((string) $contact->address)->setAddress2((string) $contact->address2)->setCity((string) $contact->city)->setCountry((string) $contact->country)->setZip((string) $contact->zip);
     // Add nameservers
     $ns_list = array();
     foreach ($result->nameservers->nameserver as $ns) {
         $n = new Registrar_Domain_Nameserver();
         $n->setHost((string) $ns);
         $ns_list[] = $n;
     }
     $privacy = false;
     if ((string) $result->private == 'Yes') {
         $privacy = true;
     }
     $domain->setNameservers($ns_list);
     $domain->setExpirationTime(strtotime($result->expires));
     $domain->setRegistrationTime(strtotime($result->created));
     $domain->setPrivacyEnabled($privacy);
     //$domain->setEpp();
     $domain->setContactRegistrar($c);
     return $domain;
 }
 private function _getAllContacts($tld, $customer_id, \Registrar_Domain_Contact $client)
 {
     if ($tld[0] != ".") {
         $tld = "." . $tld;
         //$tld must start with a dot(.)
     }
     $company = $client->getCompany();
     if (!isset($company) || strlen(trim($company)) == 0) {
         $company = $client->getFirstName() . ' ' . $client->getLastName();
     }
     $contact = array('customer-id' => $customer_id, 'type' => 'Contact', 'email' => $client->getEmail(), 'name' => $client->getFirstName() . ' ' . $client->getLastName(), 'company' => $company, 'address-line-1' => $client->getAddress1(), 'city' => $client->getCity(), 'state' => $client->getState(), 'country' => $client->getCountry(), 'zipcode' => $client->getZip(), 'phone-cc' => $client->getTelCc(), 'phone' => substr($client->getTel(), 0, 12));
     //@see http://manage.resellerclub.com/kb/answer/790 for us contact details
     if ($tld == '.us') {
         $contact['attr-name1'] = 'purpose';
         $contact['attr-value1'] = 'P3';
         $contact['attr-name2'] = 'category';
         $contact['attr-value2'] = 'C12';
     }
     // create general contact id
     $reg_contact_id = $this->_getContact($contact, $customer_id, $contact['type']);
     if ($tld == '.nl') {
         $contact['type'] = 'NlContact';
         $contact['attr-name1'] = 'legalForm';
         $contact['attr-value1'] = 'PERSOON';
     }
     if ($tld == '.uk' || $tld == '.co.uk' || $tld == '.org.uk') {
         $contact['type'] = 'UkContact';
     }
     if ($tld == '.eu') {
         $contact['type'] = 'EuContact';
     }
     if ($tld == '.cn') {
         $contact['type'] = 'CnContact';
     }
     if ($tld == '.ca') {
         $contact['type'] = 'CaContact';
         $contact['attr-name1'] = 'CPR';
         $contact['attr-value1'] = 'LGR';
         $contact['attr-name2'] = 'AgreementVersion';
         $contact['attr-value2'] = $this->getCARegistrantAgreementVersion();
         $contact['attr-name3'] = 'AgreementValue';
         $contact['attr-value3'] = 'y';
     }
     if ($tld == '.de') {
         $contact['type'] = 'DeContact';
     }
     if ($tld == '.es') {
         if (strlen(trim($client->getDocumentNr())) == 0) {
             throw new Registrar_Exception('Valid contact Passport information is required while registering ES domain name');
         }
         //@see http://manage.directi.com/kb/answer/790
         $contact['type'] = 'EsContact';
         $contact['attr-name1'] = 'es_form_juridica';
         $contact['attr-value1'] = '1';
         $contact['attr-name2'] = 'es_tipo_identificacion';
         $contact['attr-value2'] = '0';
         $contact['attr-name3'] = 'es_identificacion';
         $contact['attr-value3'] = $client->getDocumentNr();
     }
     if ($tld == '.co' || substr($tld, -3) == '.co') {
         $contact['type'] = 'CoContact';
     }
     if ($tld == '.asia') {
         if (strlen(trim($client->getDocumentNr())) == 0) {
             throw new Registrar_Exception('Valid contact Passport information is required while registering ASIA domain name');
         }
         $contact['attr-name1'] = 'locality';
         $contact['attr-value1'] = 'TH';
         // {Two-lettered Country code}
         $contact['attr-name2'] = 'legalentitytype';
         $contact['attr-value2'] = 'naturalPerson';
         // {naturalPerson | corporation | cooperative | partnership | government | politicalParty | society | institution | other}
         $contact['attr-name3'] = 'otherlegalentitytype';
         $contact['attr-value3'] = 'naturalPerson';
         // {Mention legal entity type. Mandatory if legalentitytype chosen as 'other'}
         $contact['attr-name4'] = 'identform';
         $contact['attr-value4'] = 'passport';
         // {passport | certificate | legislation | societyRegistry | politicalPartyRegistry | other}
         $contact['attr-name5'] = 'otheridentform';
         $contact['attr-value5'] = 'passport';
         // {Mention Identity form. Mandatory if identform chosen as 'other'}
         $contact['attr-name6'] = 'identnumber';
         $contact['attr-value6'] = $client->getDocumentNr();
         // {Mention Identification Number}]
     }
     if ($tld == '.ru' || $tld == '.com.ru' || $tld == '.org.ru' || $tld == '.net.ru') {
         if (strlen(trim($client->getBirthday())) === 0 || strtotime($client->getBirthday()) === false) {
             throw new Registrar_Exception('Valid contact Birth Date is required while registering RU domain name');
         }
         if (strlen(trim($client->getDocumentNr())) === 0) {
             throw new Registrar_Exception('Valid contact Passport information is required while registering RU domain name');
         }
         if (str_word_count($contact['company']) < 2) {
             $contact['company'] .= ' Inc';
         }
         $contact['type'] = 'RuContact';
         $contact['attr-name1'] = 'contract-type';
         $contact['attr-value1'] = 'PRS';
         $contact['attr-name2'] = 'birth-date';
         $contact['attr-value2'] = date('d.m.Y', strtotime($client->getBirthday()));
         $contact['attr-name3'] = 'person-r';
         $contact['attr-value3'] = $client->getFirstName() . ' ' . $client->getLastName();
         $contact['attr-name4'] = 'address-r';
         $contact['attr-value4'] = $client->getAddress1();
         $contact['attr-name5'] = 'passport';
         $contact['attr-value5'] = $client->getDocumentNr();
     }
     if ($tld == '.ca') {
         $client->setIdnLanguageCode('fr');
     }
     if ($tld == '.de') {
         $client->setIdnLanguageCode('de');
     }
     if ($tld == '.es') {
         $client->setIdnLanguageCode('es');
     }
     if ($tld == '.eu') {
         $client->setIdnLanguageCode('latin');
     }
     $param_exists = TRUE;
     $attr_number = 1;
     while ($param_exists) {
         if (!array_key_exists("attr-name" . $attr_number, $contact)) {
             $contact['attr-name' . $attr_number] = 'idnLanguageCode';
             $contact['attr-value' . $attr_number] = strtolower($client->getIdnLanguageCode());
             $param_exists = FALSE;
         }
         $attr_number++;
     }
     $special_contact_id = null;
     if ($contact['type'] != 'Contact') {
         $special_contact_id = $this->_getContact($contact, $customer_id, $contact['type']);
     }
     // by default special contact is also admin, tech and billing contact, but not always
     $admin_contact_id = isset($special_contact_id) ? $special_contact_id : $reg_contact_id;
     $tech_contact_id = isset($special_contact_id) ? $special_contact_id : $reg_contact_id;
     $billing_contact_id = isset($special_contact_id) ? $special_contact_id : $reg_contact_id;
     // override some parameters
     if (in_array($tld, array('.uk', '.co.uk', '.org.uk', '.nz', '.ru', '.com.ru', '.org.ru', '.net.ru', '.eu'))) {
         $admin_contact_id = -1;
     }
     if (in_array($tld, array('.uk', '.co.uk', '.org.uk', '.nz', '.ru', '.com.ru', '.org.ru', '.net.ru', '.eu'))) {
         $tech_contact_id = -1;
     }
     if (in_array($tld, array('.uk', '.co.uk', '.org.uk', '.nz', '.ru', '.com.ru', '.org.ru', '.net.ru', '.eu', '.ca', '.nl'))) {
         $billing_contact_id = -1;
     }
     //general contact is special contact for these TLD'S
     if (in_array($tld, array('.de', '.nl', '.ru', '.es', '.uk', '.co.uk', '.org.uk', '.eu', '.com.ru', '.net.ru', '.org.ru', '.co'))) {
         $reg_contact_id = $special_contact_id;
     }
     return array($reg_contact_id, $admin_contact_id, $tech_contact_id, $billing_contact_id);
 }
Exemple #3
0
 protected function _getD(\Model_ServiceDomain $model)
 {
     $orderService = $this->di['mod_service']('order');
     $order = $orderService->getServiceOrder($model);
     $tldRegistrar = $this->di['db']->load('TldRegistrar', $model->tld_registrar_id);
     if ($order instanceof \Model_ClientOrder) {
         $adapter = $this->registrarGetRegistrarAdapter($tldRegistrar, $order);
     } else {
         $adapter = $this->registrarGetRegistrarAdapter($tldRegistrar);
     }
     $d = new \Registrar_Domain();
     $d->setLocked($model->locked);
     $d->setNs1($model->ns1);
     $d->setNs2($model->ns2);
     $d->setNs3($model->ns3);
     $d->setNs4($model->ns4);
     //merge info with current profile
     $client = $this->di['db']->load('Client', $model->client_id);
     $email = empty($model->contact_email) ? $client->email : $model->contact_email;
     $first_name = empty($model->contact_first_name) ? $client->first_name : $model->contact_first_name;
     $last_name = empty($model->contact_last_name) ? $client->last_name : $model->contact_last_name;
     $city = empty($model->contact_city) ? $client->city : $model->contact_city;
     $zip = empty($model->contact_postcode) ? $client->postcode : $model->contact_postcode;
     $country = empty($model->contact_country) ? $client->country : $model->contact_country;
     $state = empty($model->contact_state) ? $client->state : $model->contact_state;
     $phone = empty($model->contact_phone) ? $client->phone : $model->contact_phone;
     $phone_cc = empty($model->contact_phone_cc) ? $client->phone_cc : $model->contact_phone_cc;
     $company = empty($model->contact_company) ? $client->company : $model->contact_company;
     $address1 = empty($model->contact_address1) ? $client->address_1 : $model->contact_address1;
     $address2 = empty($model->contact_address2) ? $client->address_2 : $model->contact_address2;
     $birthday = !empty($client->birthday) ? $client->birthday : '';
     $company_number = !empty($client->company_number) ? $client->company_number : '';
     $contact = new \Registrar_Domain_Contact();
     $contact->setEmail($email)->setUsername($email)->setPassword($this->di['tools']->generatePassword(10, 3))->setFirstname($first_name)->setLastname($last_name)->setCity($city)->setZip($zip)->setCountry($country)->setState($state)->setTel($phone)->setTelCC($phone_cc)->setCompany($company)->setCompanyNumber($company_number)->setAddress1($address1)->setAddress2($address2)->setFax($phone)->setFaxCC($phone_cc)->setBirthday($birthday);
     $d->setContactRegistrar($contact);
     $d->setContactAdmin($contact);
     $d->setContactTech($contact);
     $d->setContactBilling($contact);
     $d->setTld($model->tld);
     $d->setSld($model->sld);
     $d->setRegistrationPeriod($model->period);
     $d->setEpp($model->transfer_code);
     if ($model->expires_at) {
         $d->setExpirationTime(strtotime($model->expires_at));
     }
     return array($d, $adapter);
 }
 /**
  * Creates domain object from received data array.
  * @param Registrar_Domain $domain
  * @return Registrar_Domain
  */
 private function _createDomainObj($result, Registrar_Domain $domain)
 {
     $type = 'contacts_registrant_';
     $tel = explode('.', $result[$type . 'phonenumber']);
     // domain specific
     if (array_key_exists($type . 'firstname', $result)) {
         $name = $result[$type . 'firstname'];
     }
     if (array_key_exists($type . 'lastname', $result)) {
         $name .= ' ' . $result[$type . 'lastname'];
     }
     if (!array_key_exists($type . 'organization', $result)) {
         $result[$type . 'organization'] = '';
     }
     if ($domain->getTld() == 'fr') {
         $name = $result[$type . 'dotfrcontactentityname'];
     }
     if ($domain->getTld() == 'it') {
         $result['transferauthinfo'] = '';
     }
     $c = new Registrar_Domain_Contact();
     $c->setName($name)->setEmail($result[$type . 'email'])->setCompany($result[$type . 'organization'])->setTel($tel[1])->setTelCc($tel[0])->setAddress1($result[$type . 'street'])->setAddress2($result[$type . 'street2'])->setAddress3($result[$type . 'street3'])->setCity($result[$type . 'city'])->setCountry($result[$type . 'country'])->setZip($result[$type . 'postalcode']);
     if (isset($result['nameserver_0'])) {
         $domain->setNs1($result['nameserver_0']);
     }
     if (isset($result['nameserver_1'])) {
         $domain->setNs2($result['nameserver_1']);
     }
     if (isset($result['nameserver_2'])) {
         $domain->setNs3($result['nameserver_2']);
     }
     if (isset($result['nameserver_3'])) {
         $domain->setNs4($result['nameserver_3']);
     }
     $privacy = 0;
     if (array_key_exists('privatewhois', $result)) {
         $privacy = $result['privatewhois'] == 'FULL' || $result['privatewhois'] == 'PARTIAL';
     }
     $domain->setExpirationTime(strtotime($result['expirationdate']));
     $domain->setPrivacyEnabled($privacy);
     $domain->setEpp($result['transferauthinfo']);
     $domain->setContactRegistrar($c);
     return $domain;
 }
 public function getDomainDetails(Registrar_Domain $domain)
 {
     $params = array('command' => 'GetWhoisContact', 'SLD' => $domain->getSld(), 'TLD' => $domain->getTld());
     $result = $this->_makeRequest($params);
     if (isset($result->RRPCode) && $result->RRPCode != 200) {
         throw new Registrar_Exception(sprintf('EnomApiError: "%s"', implode(', ', $result->errors)), 100);
     }
     $rrp = $result->GetWhoisContacts->{'rrp-info'};
     $domain->setRegistrationTime(strtotime((string) $rrp->{'updated-date'}));
     $domain->setExpirationTime(strtotime((string) $rrp->{'registration-expiration-date'}));
     $domain->setEpp('ENOM');
     //nameservers
     $params = array('command' => 'GetDomainInfo', 'TLD' => $domain->getTld(), 'SLD' => $domain->getSld());
     $result = $this->_makeRequest($params);
     if (isset($result->GetDomainInfo->services->entry) && !empty($result->GetDomainInfo->services->entry)) {
         foreach ($services = $result->GetDomainInfo->services->entry as $service) {
             if (isset($service->service) && (int) $service->service == 1012) {
                 $ns = $service->configuration->dns;
             } elseif (isset($service->service) && (int) $service->service == 1120 && isset($service->configuration)) {
                 $domain->setPrivacyEnabled(true);
             }
         }
         $ns_list = array();
         foreach ($ns as $s) {
             $s = (string) $s;
             $n = new Registrar_Domain_Nameserver();
             $ns_list[] = $n->setHost($s);
         }
         $domain->setNameservers($ns_list);
     }
     //contacts
     $params = array('command' => 'getcontacts', 'TLD' => $domain->getTld(), 'SLD' => $domain->getSld());
     $result = $this->_makeRequest($params);
     $wc = $result->GetContacts->Registrant;
     $t = $this->_separateTelephone($wc->RegistrantPhone);
     $telcc = isset($t['code']) ? $t['code'] : '';
     $tel = isset($t['tel']) ? $t['tel'] : str_replace(array(' ', '.', '(', ')', '-'), '', $wc->Phone);
     $c = new Registrar_Domain_Contact();
     $c->setName((string) $wc->RegistrantFirstName . ' ' . (string) $wc->RegistrantLastName)->setFirstName((string) $wc->RegistrantFirstName)->setLastName((string) $wc->RegistrantLastName)->setEmail((string) $wc->RegistrantEmailAddress)->setCompany((string) $wc->RegistrantOrganizationName)->setTel($tel)->setTelCc($telcc)->setAddress1((string) $wc->RegistrantAddress1)->setCity((string) $wc->RegistrantCity)->setCountry((string) $wc->RegistrantCountry)->setState((string) $wc->RegistrantStateProvince)->setZip((string) $wc->RegistrantPostalCode)->setId(00);
     if (isset($wc->RegistrantAddress2)) {
         $c->setAddress2((string) $wc->RegistrantAddress2);
     }
     $domain->setContactRegistrar($c);
     return $domain;
 }
 /**
  * Cek detail domain dan simpan
  * @return boolean
  */
 public function getDomainDetails(Registrar_Domain $d)
 {
     $domain_id = $this->_getDomainOrderId($d);
     $data = $this->_makeRequest('domains/' . $domain_id . '?fields=all');
     $d->setRegistrationTime(strtotime($data['creation_time']));
     $d->setExpirationTime(strtotime($data['end_time']));
     $d->setEpp($this->getEpp($d));
     $d->setPrivacyEnabled($data['privacy_protection_enabled'] == 'true');
     /* Contact details */
     $wc = $data['adm_contact'];
     $c = new Registrar_Domain_Contact();
     $c->setId($wc['contact_id'])->setName($wc['name'])->setEmail($wc['email'])->setCompany($wc['company'])->setTel($wc['tel_no'])->setTelCc($wc['tel_cc_no'])->setAddress1($wc['address_line_1'])->setCity($wc['city'])->setCountry($wc['country_code'])->setState($wc['state'])->setZip($wc['zipcode']);
     if (isset($wc['address_line_2'])) {
         $c->setAddress2($wc['address_line_2']);
     }
     if (isset($wc['address_line_3'])) {
         $c->setAddress3($wc['address_line_3']);
     }
     $d->setContactRegistrar($c);
     if (isset($data['ns1'])) {
         $d->setNs1($data['ns1']);
     }
     if (isset($data['ns2'])) {
         $d->setNs2($data['ns2']);
     }
     if (isset($data['ns3'])) {
         $d->setNs3($data['ns3']);
     }
     if (isset($data['ns4'])) {
         $d->setNs4($data['ns4']);
     }
     return $d;
 }