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); }
public function getContactIdForDomain(Registrar_Domain $domain) { $c = $domain->getContactRegistrar(); $customer = $this->_getCustomerDetails($domain); $customer_id = $customer['customerid']; $tld = $domain->getTld(); $contact = array('customer-id' => $customer_id, 'type' => 'Contact', 'email' => $c->getEmail(), 'name' => $c->getName(), 'company' => $c->getCompany(), 'address-line-1' => $c->getAddress1(), 'address-line-2' => $c->getAddress2(), 'city' => $c->getCity(), 'state' => $c->getState(), 'country' => $c->getCountry(), 'zipcode' => $c->getZip(), 'phone-cc' => $c->getTelCc(), 'phone' => $c->getTel()); if ($tld == '.uk') { $contact['type'] = 'UkContact'; } if ($tld == '.eu') { $contact['type'] = 'EuContact'; } if ($tld == '.cn') { $contact['type'] = 'CnContact'; } if ($tld == '.ca') { $contact['type'] = 'CaContact'; } if ($tld == '.de') { $contact['type'] = 'DeContact'; } if ($tld == '.es') { $contact['type'] = 'EsContact'; } if ($tld == '.ru') { $contact['type'] = 'RuContact'; } $id = $this->_makeRequest('contacts/add', $contact, 'POST'); return $id; }
/** * Checks whether privacy is enabled. * @param Registrar_Domain $domain * @return bool */ private function _isPrivacyEnabled(Registrar_Domain $domain) { $params = array('domain' => $domain->getName()); $result = $this->_process('/Domain/PrivateWhois/Status', $params); return $result['status'] == 'SUCCESS' && ($result['privatewhoisstatus'] == 'FULL' || $result['privatewhoisstatus'] == 'PARTIAL'); }
private function sendEmail(Registrar_Domain $domain, array $params) { $c = $params['content']; $c .= PHP_EOL; $c .= PHP_EOL; $c .= 'Domain should be configured as follows:'; $c .= PHP_EOL; $c .= PHP_EOL; $c .= $domain->__toString(); $log = $this->getLog(); if ($this->_testMode) { $log->alert($params['subject'] . PHP_EOL . PHP_EOL . $c); return true; } mail($this->config['email'], $params['subject'], $c); $log->info("Email sent: " . $params['subject']); return true; }
/** * @param Registrar_Domain $domain * @return bool * @throws Registrar_Exception * @see https://www.namesilo.com/api_reference.php#retrieveAuthCode */ public function getEpp(Registrar_Domain $domain) { $params = array('domain' => $domain->getName()); $result = $this->_request('retrieveAuthCode', $params); return 'EPP transfer code for the domain emailed to the administrative contact'; }
public function togglePrivacyProtection(Registrar_Domain $domain) { $params = array('domain' => $domain->getName()); $result = $this->_request('getDomainInfo', $params); $cmd = 'removePrivacy'; if ((string) $result->reply->private == 'No') { $cmd = 'addPrivacy'; } $this->_request($cmd, $params); return true; }
public function testregisterDomain() { $adapterMock = $this->getMockBuilder('Registrar_Adapter_Resellerclub')->disableOriginalConstructor()->setMethods(array('_makeRequest'))->getMock(); $registrarDomain = new Registrar_Domain(); $registrarDomain->setSld('example')->setTld('.com')->setContactRegistrar(new Registrar_Domain_Contact()); $requestResult = array('status' => 'Success'); $adapterMock->expects($this->atLeastOnce())->method('_makeRequest')->withConsecutive(array('domains/orderid'), array('domains/details'), array('customers/details'), array('contacts/search'), array('contacts/delete'), array('contacts/add'), array('domains/register'))->willReturnOnConsecutiveCalls(1, array('currentstatus' => ''), array('customerid' => 1), array('recsonpage' => 1, 'result' => array(array('entity.entityid' => 2))), array(), 2, $requestResult); $result = $adapterMock->registerDomain($registrarDomain); $this->assertInternalType('bool', $result); $this->assertTrue($result); }
public function deleteDomain(Registrar_Domain $domain) { $this->getLog()->debug('Removing domain: ' . $domain->getName()); return true; }
/** * * Toggles domain transfer lock * @param Registrar_Domain $domain * @param integer $lock * @return bool */ private function _toggleDomainLock(Registrar_Domain $domain, $lock = 0) { $params = array('command' => 'SetRegLock', 'TLD' => $domain->getTld(), 'SLD' => $domain->getSld(), 'UnlockRegistrar' => $lock); $result = $this->_makeRequest($params); if ((string) $result->RegistrarLock == 'ACTIVE') { return true; } return false; }
public function getContactIdForDomain(Registrar_Domain $domain) { $c = $domain->getContactRegistrar(); $customer = $this->_getCustomerDetails($domain); $customer_id = $customer['customer_id']; $tld = $domain->getTld(); $contact = array('customer_id' => $customer_id, 'email' => $c->getEmail(), 'name' => $c->getName(), 'company' => $c->getCompany(), 'address_line_1' => $c->getAddress1(), 'address_line_2' => $c->getAddress2(), 'city' => $c->getCity(), 'state' => $c->getState(), 'country' => $c->getCountry(), 'zipcode' => $c->getZip(), 'tel_cc_no' => $c->getTelCc(), 'tel_cc' => $c->getTel(), 'country_code' => 'id'); $id = $this->_makeRequest("contacts/{$customer_id}/contacts", $contact, 'POST'); return $id; }
public function unlock(Registrar_Domain $domain) { $this->getLog()->debug('Unlocking: ' . $domain->getName()); return true; }
/** * Cek domain sudah jadi belum * @return boolean */ private function _hasCompletedOrder(Registrar_Domain $domain) { $domain_name = str_replace(" ", "", strtolower($domain->getName())); $param_search = http_build_query(array('limit' => '100', 'page_no' => '1', 'domain_name' => $domain_name, 'exact_domain_name' => '1')); $result_search = $this->_makeRequest('domains?' . $param_search); if (!empty($result_search) and is_array($result_search)) { foreach ($result_search as $res) { if (trim(strtolower($res['domain_name'])) == $domain_name) { $domain_id = $res['domain_id']; try { $data = $this->_makeRequest('domains/' . $domain_id . '?fields=all'); return strtolower($data['order_status']) == 'live'; } catch (Registrar_Exception $e) { return false; } } } } return false; }
public function unlock(Registrar_Domain $domain) { $params = array('Command' => 'namecheap.domains.setRegistrarLock', 'DomainName' => $domain->getName(), 'LockAction' => 'unlock'); $respond = $this->_call($params); if ($respond === false) { return false; } $status = $respond->CommandResponse->DomainSetRegistrarLockResult->attributes(); if (strtolower($status['IsSuccess']) == 'true') { return true; } else { return false; } }