private function PackContact(Contact $Contact, $as_type)
 {
     $std_fields = array("FirstName", "LastName", "\r\n\t\t\t\tOrganizationName", "JobTitle", "Address1", "Address2", "City", "StateProvinceChoice", "StateProvince", "PostalCode", "Country", "EmailAddress", "Phone", "Fax");
     $prefix = $this->contact_type_prefix_map[$as_type];
     $data = array();
     foreach ($Contact->GetRegistryFormattedFieldList() as $fname => $fvalue) {
         $k = in_array($fname, $std_fields) ? "{$prefix}{$fname}" : $fname;
         $data[$k] = $fvalue;
     }
     return $data;
 }
		/**
		 * Update contact
		 * @access public
		 * @param string $contact_id Contact registry ID
		 * @param array $contact Contact info.  See XML:config/contacts
		 * @return bool True on success of false on failure
		 */
		public function UpdateContact(Contact $contact)
		{
			$discloses_feature = count($contact->GetConfig()->disclose->children()) > 0;
			
			// First update contact info and disclose@flag=0
			$params = $contact->GetRegistryFormattedFieldList();
			foreach ($params as $k => &$v)
				$v = $this->EscapeXML($v);
			$params['id'] = $contact->CLID;
			$params["pw"] = $this->EscapeXML($contact->AuthCode);
			if ($discloses_feature) 
				$params['disclose'] = $this->GetDiscloseXML($contact->GetDiscloseList(), 0);
				
			$this->BeforeRequest("contact-update", $params, __METHOD__, $contact);
			$response = $this->Request("contact-update", $params);
			
			if ($discloses_feature && $response->Succeed)
			{
				$disclose = $this->GetDiscloseXML($contact->GetDiscloseList(), 1);
				if ($disclose)
				{
					// Update contact disclose@flag=1
					$params = array(
						"id" => $contact->CLID, 
						"disclose" => $disclose 
					);
					$this->BeforeRequest("contact-update-disclose", $params, __METHOD__, $contact);
					$response = $this->Request("contact-update-disclose", $params);
					
				}
			}

			$status = ($response->Succeed) ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;			
			return new UpdateContactResponse($status, $response->ErrMsg, $response->Code);
		}		
 /**
  * This method request registry to update contact
  * 
  * @param Contact $contact
  * @return UpdateContactResponse
  */
 public function UpdateContact(Contact $contact)
 {
     $params = array('id' => $contact->CLID);
     $params = array_merge($params, $contact->GetRegistryFormattedFieldList());
     foreach ($params as &$param) {
         if (!is_array($param)) {
             $param = $this->EscapeXML($param);
         }
     }
     $params['disclose_add'] = $this->GetDisclosesXML($contact->GetDiscloseList());
     // TODO add disclose rem
     $params['disclose_rem'] = '';
     if ($this->IsRegistrant($contact)) {
         $response = $this->Request("contact-update-holder", $params);
     } else {
         $response = $this->Request("contact-update", $params);
     }
     $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     $ret = new UpdateContactResponse($status, $response->ErrMsg, $response->Code);
     $ret->Result = $status != REGISTRY_RESPONSE_STATUS::FAILED;
     return $ret;
 }
 /**
  * This method request registry to update contact
  * 
  * @param Contact $contact
  * @return UpdateContactResponse
  */
 public function UpdateContact(Contact $contact)
 {
     $fields = $contact->GetRegistryFormattedFieldList();
     $params = array('CONTACTID' => $contact->CLID, 'FNAME' => $fields['firstname'], 'LNAME' => $fields['lastname'], 'ORGANIZATION' => $fields["org"], 'EMAIL' => $fields["email"], 'ADDRESS1' => $fields["street1"], 'ADDRESS2' => $fields["street2"], 'CITY' => $fields["city"], 'PROVINCE' => $fields['sp'], 'POSTAL CODE' => $fields["pc"], 'COUNTRY' => $fields["cc"], 'PHONE' => $fields["voice"]);
     $Resp = $this->Request('EDIT CONTACT', $params);
     $status = $Resp->Succeed && $Resp->Data['CONTACTID'] ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     $Ret = new UpdateContactResponse($status, $Resp->ErrMsg);
     $Ret->Result = $Ret->Succeed();
     return $Ret;
 }
 /**
  * Update contact
  * @access public
  * @param string $contact_id Contact registry ID
  * @param array $contact Contact info.  See XML:config/contacts
  * @return bool True on success of false on failure
  */
 public function UpdateContact(Contact $contact)
 {
     $params = $contact->GetRegistryFormattedFieldList();
     $params["contact"] = $contact->CLID;
     $response = $this->Request("ModifyContact", $params);
     $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     return new UpdateContactResponse($status, $response->ErrMsg, $response->Code);
 }
 /**
  * Update contact
  * @access public
  * @param string $contact_id Contact registry ID
  * @param array $contact Contact info.  See XML:config/contacts
  * @return bool True on success of false on failure
  */
 public function UpdateContact(Contact $contact)
 {
     $params = $contact->GetRegistryFormattedFieldList();
     foreach ($params as &$param) {
         if (!is_array($param)) {
             $param = $this->EscapeXML($param);
         }
     }
     $params['id'] = $contact->CLID;
     $params["pw"] = $contact->AuthCode;
     $params["discloses"] = $this->GetDiscloseXML($contact->GetDiscloseList(), 1);
     $response = $this->Request("contact-update", $params);
     $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     return new UpdateContactResponse($status, $response->ErrMsg, $response->Code);
 }
 private function MapContactToPerson(Contact $contact)
 {
     $fields = $contact->GetRegistryFormattedFieldList();
     $type_fkey = $this->Db->GetOne("\r\n\t\t\t\tSELECT type_key \r\n\t\t\t\tFROM whois_type \r\n\t\t\t\tWHERE UPPER(whois_type.`type`) = UPPER(?)", array($contact->GroupName));
     //throw new Exception($contact->GroupName);
     //throw new Exception("type key: " . $type_fkey);
     $country_fkey = $this->Db->GetOne("\r\n\t\t\t\tSELECT country_key \r\n\t\t\t\tFROM whois_country \r\n\t\t\t\tWHERE short = ?", array($fields['cc']));
     return array('type_fkey' => $type_fkey, 'name' => $fields['name'], 'country_fkey' => $country_fkey, 'city' => $fields['city'], 'pcode' => $fields['pc'], 'address' => $fields['street'], 'phone' => $fields['voice'], 'fax' => $fields['fax'], 'email' => $fields['email']);
 }
 /**
  * This method request registry to update contact
  * 
  * @param Contact $contact
  * @return UpdateContactResponse
  */
 public function UpdateContact(Contact $contact)
 {
     $params = $contact->GetRegistryFormattedFieldList();
     $map = array(CONTACT_TYPE::ADMIN => 1, CONTACT_TYPE::TECH => 2, CONTACT_TYPE::BILLING => 3, CONTACT_TYPE::REGISTRANT => 4);
     $params['contacttype'] = $map[$contact->ExtraData['type']];
     $params['domainname'] = "{$contact->ExtraData['domainname']}.{$this->Extension}";
     $params['type'] = $this->GetDomainType();
     $params['pw'] = $contact->AuthCode;
     $response = $this->Request('contact-update', $params);
     $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     $ret = new UpdateContactResponse($status, $response->ErrMsg, $response->Code);
     $ret->Result = $status != REGISTRY_RESPONSE_STATUS::FAILED;
     return $ret;
 }