示例#1
0
 /**
  * Constructor get all necessary infos for the API.
  * - urls for API methods
  * - the hashkey, login & password for authentication
  * Else method check 
  */
 public function __construct()
 {
     require_once realpath(dirname(__FILE__) . '/TwengaFields.php');
     if (self::$arr_api_url === NULL) {
         self::$arr_api_url = array();
         self::$arr_api_url['getSubscriptionLink'] = 'http://rts.twenga.com/api/Site/GetSubscriptionLink';
         self::$arr_api_url['siteExist'] = 'http://rts.twenga.com/api/Site/Exist';
         self::$arr_api_url['siteActivate'] = 'http://rts.twenga.com/api/Site/Activate';
         self::$arr_api_url['getTrackingScript'] = 'http://rts.twenga.com/api/Site/GetTrackingScript';
         self::$arr_api_url['orderExist'] = 'http://rts.twenga.com/api/Order/Exist';
         self::$arr_api_url['orderValidate'] = 'http://rts.twenga.com/api/Order/Validate';
         self::$arr_api_url['orderCancel'] = 'http://rts.twenga.com/api/Order/Cancel';
         self::$arr_api_url['addFeed'] = 'https://rts.twenga.com/api/Site/AddFeed';
         if (self::PARTNER_AUTH_KEY === NULL) {
             throw new TwengaException(self::$translation_object->l('To activate the Twenga plugin, "PARTNER_AUTH_KEY" contant must be set. Default installation of Prestashop contains this value.', basename(__FILE__, '.php')));
         }
         if (Configuration::get('TWENGA_HASHKEY') !== false && self::$hashkey === NULL) {
             self::$hashkey = Configuration::get('TWENGA_HASHKEY');
         }
         if (Configuration::get('TWENGA_USER_NAME') !== false && self::$user_name === NULL) {
             self::$user_name = Configuration::get('TWENGA_USER_NAME');
         }
         if (Configuration::get('TWENGA_PASSWORD') !== false && self::$password === NULL) {
             self::$password = Configuration::get('TWENGA_PASSWORD');
         }
     }
 }