public static function order_Discloseinfo($data = []) { $result = ['content' => '', 'errors' => [], 'status' => false]; $fields = ['registrant', 'hide_person', 'hide_email', 'hide_phone']; $validated = parent::validate($fields, $data); if (!empty($validated)) { $result['errors'] = $validated; return $result; } $response = parent::send_request('order/discloseinfo', $data); $result['content'] = parent::parse_response($response); if ($result['content']['success'] == true) { $result['status'] = true; } return $result; }
public static function contact_Register($data = []) { $result = ['content' => '', 'errors' => [], 'status' => false]; $fields = ['contact_type', 'name', 'name_ru', 'passport', 'birth_date', 'address_ru', 'paddr', 'phone', 'email', 'fax', 'firstname', 'lastname', 'address1', 'city', 'postalcode', 'country', 'state_province']; //by default we register domains for private users, not organizations or others if (!isset($data['contact_type']) || empty($data['contact_type'])) { $data['contact_type'] = 'person'; } $validates = parent::validate($fields, $data); if (!empty($validated)) { $result['errors'] = $validated; return $result; } $response = parent::send_request('contact/register', $data); $result['content'] = parent::parse_response($response); if ($result['content']['success'] == true) { $result['status'] = true; } else { $result['status'] = false; $result['errors'][] = $result['content']['message']; } return $result; }
public function test__checkValidateMethodWrongArguments() { $result = Domenus::validate(['domain', 'flag'], ['foo' => 'bar', 'baz' => 'bar1']); $this->assertEquals($result[0], 'Required field [domain] is empty.'); $this->assertEquals($result[1], 'Required field [flag] is empty.'); }
/** * Register domain * @param Array $data for registering domain * @return Mixed orderId */ public static function domain_Register($data = []) { $result = ['content' => '', 'errors' => [], 'status' => false]; $fields = ['domain', 'nserver', 'someextattrib']; if (isset($data['domain'])) { $data['domain'] = idn_to_ascii($data['domain']); } $ns_servers = Domenus::get_ns_servers(); // substituting default NS servers from configs if (empty($data['nserver'])) { $data['nserver'] = $ns_servers; } $validated = parent::validate($fields, $data); if (!empty($validated)) { $result['errors'] = $validated; return $result; } $response = parent::send_request('domain/register', $data); $result['content'] = parent::parse_response($response); if ($result['content']['success'] == true) { $result['status'] = true; } else { $result['errors'][] = self::get_status_code($result['content']['status']); $result['status'] = false; } return $result; }