private function getCustomFieldId($name)
 {
     $apikey = $this->config->get('getresponse_apikey');
     $get_response = new GetResponseApiV3($apikey);
     if (empty($this->custom_fields)) {
         $this->custom_fields = $get_response->getCustomFields();
     }
     if (!empty($get_response)) {
         foreach ($this->custom_fields as $custom) {
             if ($custom->name === $name) {
                 return $custom->customFieldId;
             }
         }
     }
     $newCustom = array('name' => $name, 'type' => 'text', 'hidden' => false, 'values' => array());
     $result = $get_response->setCustomField($newCustom);
     if (!empty($this->custom_fields)) {
         $this->custom_fields[] = $result;
     }
     return $result->customFieldId;
 }
 /**
  * @param $apikey
  * @return bool
  */
 private function checkApiKey($apikey)
 {
     if (empty($apikey)) {
         return false;
     } elseif ($this->config->get('getresponse_apikey') == $apikey) {
         return true;
     }
     $get_response = new GetResponseApiV3($apikey);
     $campaigns = $get_response->getCampaigns();
     return !(isset($campaigns->httpStatus) && $campaigns->httpStatus != 200);
 }