/** * Validate the API configuration by making a test address validation * request and ensuring the response that is returned is valid. * @return self */ public function validateapiAction() { $request = $this->getRequest(); $configMap = Mage::getModel('eb2ccore/config'); $hostname = $this->_validatorHelper->getParamOrFallbackValue($request, self::HOSTNAME_PARAM, self::HOSTNAME_USE_DEFAULT_PARAM, $configMap->getPathForKey('api_hostname')); $storeId = $this->_validatorHelper->getParamOrFallbackValue($request, self::STORE_ID_PARAM, self::STORE_ID_USE_DEFAULT_PARAM, $configMap->getPathForKey('store_id')); $apiKey = $this->_validatorHelper->getEncryptedParamOrFallbackValue($request, self::API_KEY_PARAM, self::API_KEY_USE_DEFAULT_PARAM, Mage::getSingleton('eb2ccore/config')->getPathForKey('api_key')); $this->getResponse()->setHeader('Content-Type', 'text/json')->setBody(json_encode(Mage::helper('eb2ccore/validator')->testApiConnection($storeId, $apiKey, $hostname))); return $this; }
/** * Test connecting to the AMQP server * @return self */ public function validateamqpAction() { $request = $this->getRequest(); $configMap = Mage::getModel('ebayenterprise_amqp/config'); $hostname = $this->_validatorHelper->getParamOrFallbackValue($request, self::HOSTNAME_PARAM, self::HOSTNAME_USE_DEFAULT_PARAM, $configMap->getPathForKey('hostname')); $username = $this->_validatorHelper->getParamOrFallbackValue($request, self::USERNAME_PARAM, self::USERNAME_USE_DEFAULT_PARAM, $configMap->getPathForKey('username')); $password = $this->_validatorHelper->getEncryptedParamOrFallbackValue($request, self::PASSWORD_PARAM, self::PASSWORD_USE_DEFAULT_PARAM, $configMap->getPathForKey('password')); $validator = $this->_getAmqpApiValidator($this->_getSourceStore()); $this->getResponse()->setHeader('Content-Type', 'text/json')->setBody(json_encode($validator->testConnection($hostname, $username, $password))); return $this; }