public function getSettingsHTML($params = array())
 {
     $options = array();
     foreach (uspsServices::getServices('Domestic') as $service) {
         $options[] = array('value' => $service['id'], 'title' => $service['name']);
     }
     $params['options']['services_domestic'] = $options;
     $options = array();
     foreach (uspsServices::getServices('International') as $service) {
         $options[] = array('value' => $service['id'], 'title' => $service['name']);
     }
     $params['options']['services_international'] = $options;
     return parent::getSettingsHTML($params);
 }
 protected function parseResponse($response)
 {
     // fix unclosed br tags
     $response = preg_replace("/<br\\s*?>/i", '', $response);
     $errors = array();
     $rates = array();
     try {
         $xml = new SimpleXMLElement($response);
     } catch (Exception $ex) {
         throw new waException($this->plugin->_w("Xml isn't well-formed"));
     }
     switch ($xml->getName()) {
         case 'RateV4Response':
             $rates = $this->parseRateV4Response($xml, $errors);
             break;
         case 'IntlRateV2Response':
             $rates = $this->parseIntlRateResponse($xml, $errors);
             break;
         case 'Error':
             throw new waException((string) $xml->Description, (int) $xml->Number);
             break;
     }
     $services = uspsServices::getServices();
     foreach ($errors as $error) {
         if (isset($services[$error['id']])) {
             $error['comment'] = $services[$error['id']]['name'] . ': ' . $error['name'];
         }
         $rates[$error['id']] = $error;
     }
     foreach ($rates as &$rate) {
         $rate['est_delivery'] = isset($rate['est_delivery']) ? $rate['est_delivery'] : '';
         $rate['currency'] = 'USD';
     }
     unset($rate);
     return $rates;
 }