This commit is contained in:
rGaillard
2011-07-06 10:10:43 +00:00
parent 31d94236ac
commit d1a13007b9
4695 changed files with 0 additions and 339293 deletions
-128
View File
@@ -1,128 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class PrestashopStats
{
/**
* @var array of urls to use for using method
*/
private static $arr_ps_stats_url;
/**
* @var string url of the shop
*/
private static $site_url;
/**
* Constructor save all necessaries infos to make transaction with tracker page.
* @param string $site_url to identify the shop
*/
public function __construct($site_url)
{
if (self::$arr_ps_stats_url === NULL)
{
self::$arr_ps_stats_url = array();
self::$arr_ps_stats_url['actSubscription'] = 'http://www.prestashop.com/modules/tracker_twenga.php?act_subscription=1';
self::$arr_ps_stats_url['validateSubscription'] = 'http://www.prestashop.com/modules/tracker_twenga.php?validate_subscription=1';
self::$arr_ps_stats_url['cancelOrder'] = 'http://www.prestashop.com/modules/tracker_twenga.php?cancel_order=1';
self::$arr_ps_stats_url['validateOrder'] = 'http://www.prestashop.com/modules/tracker_twenga.php?validate_order=1';
self::$site_url = $site_url;
}
}
/**
* Build url for curl use with good params and good encode.
* @param string $url url which defined the method to use for the tracker.
* @param array $params params to passed for the tracker.
*/
private static function buildUrlToQuery($url, array $params = array())
{
$params['url'] = self::$site_url;
$params['module'] = 'twenga';
if(Configuration::get('PS_TWENGA_KEY') !== false && Configuration::get('PS_TWENGA_KEY') !== '') $params['key'] = Configuration::get('PS_TWENGA_KEY');
$str_params = http_build_query($params);
$str_url = $url.(($str_params !== '') ? '&'.$str_params : '');
return $str_url;
}
/**
* Use cURL to connect with the tracker.
* @param string $query_string
* @throws Exception if error occurred.
* @return array with the statut code and the response return from curl connection.
*/
private static function executeQuery($query_string)
{
$defaultParams = array(
CURLOPT_HEADER => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLINFO_HEADER_OUT => TRUE,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
);
$session = curl_init($query_string);
curl_setopt_array($session, $defaultParams);
$response = curl_exec($session);
$response = explode("\r\n\r\n", $response);
$header = $response[0];
$response = $response[1];
$status_code = (int)curl_getinfo($session, CURLINFO_HTTP_CODE);
if ($status_code === 0)
throw new Exception('CURL Error: '.curl_error($session));
curl_close($session);
return array('status_code' => $status_code, 'response' => $response);
}
public function actSubscription ()
{
$str = self::buildUrlToQuery(self::$arr_ps_stats_url[__FUNCTION__]);
$return = $this->executeQuery($str);
if(trim($return['response']) !== '' && Validate::isMd5($return['response']))
Configuration::updateValue('PS_TWENGA_KEY', $return['response']);
}
public function validateSubscription ()
{
$str = self::buildUrlToQuery(self::$arr_ps_stats_url[__FUNCTION__]);
$this->executeQuery($str);
}
public function cancelOrder ()
{
$str = self::buildUrlToQuery(self::$arr_ps_stats_url[__FUNCTION__]);
$this->executeQuery($str);
}
public function validateOrder ($amount_ht, $amount_ttc)
{
$params = array('order_amount_ttc' => (float)$amount_ttc, 'order_amount_ht' => (float)$amount_ht);
$str = self::buildUrlToQuery(self::$arr_ps_stats_url[__FUNCTION__], $params);
$this->executeQuery($str);
}
}
-45
View File
@@ -1,45 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
class TwengaFieldsAddFeed extends TwengaFields
{
public function __construct()
{
if(!is_array($this->fields) && empty($this->fields))
{
$this->fields['key'] = array(32, array('is_string', 'isCleanHtml'), true);
$this->fields['PARTNER_AUTH_KEY'] = array(56, array('is_string', 'isCleanHtml'), true);
$this->fields['feed_url'] = array(255, array('is_string', 'isCleanHtml'), true);
}
parent::__construct();
}
public function __destruct()
{
}
}
-329
View File
@@ -1,329 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* This class works with the Twenga class to control params
* used for Twenga API method.
*
* This class allow to :
* - set fields with validators, the length of value, if field is required,
* - check each fields if they saved according to params (see above),
* - compare an array of values to check if required fields are set.
* - use the twenga API method and throw exceptions if error or exceptions occurred.
* - Transform the xml response into PHP values.
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
abstract class TwengaFields
{
/**
* This var must be filled by inherited constructor.
*
* Each item must look like :
* item[(string)'name-of-the-field'] = array(#param1, #param2, #param3);
* #param1 : (int) length of the field 0 for no restrictions
* #param2 : (array) possibles validators. A validator could be a
* - basic php function,
* - Validate class method,
* - Subclass method
* #param3 : [optionnal](boolean) if is required or not.
* @var array which saved possible fields with their specification
* @see TwengaFields::checkFields() AND TwengaFields::checkFieldAttributs()
*/
protected $fields;
/**
* @var string Need to save the class name for used with validators
* @see TwengaFields::isValidate();
*/
protected $className;
/**
* @var array which save each required fields
* @see TwengaFields::checkFields() for know how it's filled
*/
protected $requiredFields;
/**
* @var boolean
*/
protected $noRequiredFields = false;
/**
* @var array Each item is value for field which are defined by subclass.
* Key of the item must be the name of the field.
*/
protected $params;
/**
* Constructor control each fields filled by subclass.
* /!\ must be used by subclass after filled TwengaFields::$fields.
* @see TwengaFields::checkFields()
* @throws TwengaFieldsException throwing by TwengaFields::checkFields()
*/
public function __construct()
{
$this->className = get_class($this);
try {
$this->checkFields();
} catch (TwengaFieldsException $e) {
throw $e;
}
}
/**
* Check fields attributs.
* @throws TwengaFieldsException if TwengaFields::$fields was not filled.
* @throws TwengaFieldsException throwing by TwengaFields::checkFieldAttributs()
*/
private function checkFields()
{
if (!is_array($this->fields))
throw new TwengaFieldsException('Some fields must be set');
// if $noRequiredFields is set to false, means that we don't need to check fields.
if(!is_array($this->requiredFields) AND $this->noRequiredFields === false)
{
$this->requiredFields = array();
foreach ($this->fields as $name=>$attributs)
{
try {
$this->checkFieldAttributs($name, $attributs);
} catch (TwengaFieldsException $e) {
throw $e;
}
}
if(empty($this->requiredFields))
$this->noRequiredFields = true;
}
}
/**
* Check attributs validity and in case of field is required,
* save it in (array)TwengaFields::$requiredFields.
* @param string $name of the field
* @param array field attributs
* @throws TwengaFieldsException if an attribut of a field is not set correctly
* (much more debugging rather than production).
*/
private function checkFieldAttributs ($name, array $field_attributs)
{
// attribut at key 0 is the length of the required value
if(!Validate::isInt($field_attributs[0]))
throw new TwengaFieldsException(Tools::displayError('To add a field, you have to set a maximum length for checking the value. Error occurred for the value').' : '.$name);
// attribut at key 1 is an array list of the validator
if(!is_array($field_attributs[1]))
throw new TwengaFieldsException(Tools::displayError('To add a field, you have to set validators for checking value. Error occurred for the value').' : '.$name);
// Check if validators setted are valid.
foreach ($field_attributs[1] as $validator)
{
if(!function_exists($validator) && !method_exists('Validate', $validator) && !method_exists($this->className, $validator))
throw new TwengaFieldsException (Tools::displayError('The Validator').' '.$validator.' '.Tools::displayError('does\'nt exist'));
}
// attribut at key 2 means that this fields is required or not
if(isset($field_attributs[2]) AND Validate::isBool($field_attributs[2]))
$this->requiredFields[$name] = false;
}
/**
* Get a field by his name and return his atribut to check his validity.
* @param string $name
* @throws TwengaFieldsException if a TwengaFields::$field is an array,
* @throws TwengaFieldsException if the choosen field is not set.
* @return array field attributs
*/
public function getField($name)
{
if (!is_array($this->fields))
throw new TwengaFieldsException(Tools::displayError('To get a field you have to saved some fields !'));
if(!key_exists($name, $this->fields))
throw new TwengaFieldsException(Tools::displayError('The field').' <b>'.$name.'</b> '.Tools::displayError('doesn\'t exist.'));
return $this->fields[$name];
}
/**
* Check the value of one field by his name
* @param string $key is field name to check.
* @param string $value is field value.
* @return string empty if it's ok, otherwise a string of errors.
*/
private function isValidate($key, $value)
{
$fieldValidate = $this->getField($key);
$str_return = '';
// check the length
if(strlen((string)$value) > $fieldValidate[0] AND $fieldValidate[0] !== 0)
return Tools::displayError('Wrong length of the value. Must be set between 1 and ').$fieldValidate[0].'<br />'."\n";
// check each validators.
foreach ($fieldValidate[1] as $validator)
{
$user_function = function_exists($validator) ? $validator : '';
$user_function = method_exists('Validate', $validator) ? array('Validate', $validator) : $user_function;
$user_function = method_exists($this->className, $validator) ? array($this->className, $validator) : $user_function;
try {
$bool = call_user_func($user_function, $value);
if(!$bool)
$str_return .= Tools::displayError('Value don\'t respect the validator : ').'<b>'.$validator.'</b><br />'."\n";;
} catch (TwengaFieldsException $e) {
$str_return .= $e->getMessage();
}
}
return $str_return;
}
/**
* Compare an array of values to each required fields.
*
* The method doesn't work if they are no required fields.
*
* No return value for this method, if compared array key
* and TwengaFields::$requiredFields key match,
* the TwengaFields::$requiredFields value become true.
*
* In this way if false value is found in TwengaFields::$requiredFields array,
* it means that compared array is not filled enough.
* @see TwengaFields::requiredFieldsAreSet() is the one using TwengaFields::compareFields().
*/
private function compareFields()
{
if(is_array($this->requiredFields) AND !empty($this->requiredFields))
{
$arr_compare = array_intersect_key($this->requiredFields, $this->params);
foreach ($this->requiredFields as $key=>&$value)
$value = key_exists($key, $arr_compare);
}
}
/**
* Check if each required fields are set
* see TwengaFields::compareFields().
* Else the method throw an error message.
* @return boolean if it's ok
* @throws TwengaFieldsException in case of a required field missing.
*/
private function requiredFieldsAreSet()
{
if(is_array($this->requiredFields) AND !empty($this->requiredFields))
{
$fields_not_set = array_keys($this->requiredFields, false);
if(!empty($fields_not_set))
throw new TwengaFieldsException (Tools::displayError('Some fields must be set').' : <b>'.implode(', ', $fields_not_set).'</b>');
}
return true;
}
/**
* Set values params
* @param array $params
* @return TwengaFields current instance for chainability
*/
public function setParams(array $params)
{
if(empty($params))
throw new TwengaFieldsException(Tools::displayError('Params must be filled'));
$this->params = $params;
return $this;
}
/**
* Check params validity (length, validators, is required)
* for each TwengaFields::$params value.
* @see TwengaFields::compareFields() and TwengaFields::requiredFieldsAreSet()
* to know required fields checking method.
* @see TwengaFields::isValidate() to know the checking behaviour (length and Validators).
* @throws TwengaFieldsException if TwengaFields::$params not set before.
* @throws TwengaFieldsException with list of not validated values.
* Using TwengaFields::isValidate() method to work.
* @throws TwengaFieldsException occurred while compared
* TwengaFields::$params and TwengaFields::$fields
* * to check if required fields are filled.
*/
public function checkParams()
{
if(!is_array($this->params) || empty($this->params))
throw new TwengaFieldsException(Tools::displayError('Params must be setted before check it'));
try {
$this->compareFields();
$this->requiredFieldsAreSet();
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_message = '';
foreach ($this->params as $key=>$value)
{
$validate = $this->isValidate($key, $value);
if($validate !== '')
$str_message .= Tools::displayError('The field').' <b>'.$key.'</b> '.Tools::displayError('is a wrong value, see details :').'<br />'."\n<em>".$validate.'</em>';
}
if($str_message !== '')
throw new TwengaFieldsException($str_message);
}
/**
* @return array TwengaFields::$params
*/
public function getParams()
{
return $this->params;
}
/**
* Get translation for a given module text
*
* @param string $string String to translate
* @return string Translation
*/
public function l($string, $specific = false)
{
global $_MODULES, $_MODULE, $cookie;
$id_lang = (!isset($cookie) OR !is_object($cookie)) ? (int)(Configuration::get('PS_LANG_DEFAULT')) : (int)($cookie->id_lang);
$file = _PS_MODULE_DIR_.$this->name.'/'.Language::getIsoById($id_lang).'.php';
if (Tools::file_exists_cache($file) AND include_once($file))
$_MODULES = !empty($_MODULES) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
if (!is_array($_MODULES))
return (str_replace('"', '&quot;', $string));
$source = Tools::strtolower($specific ? $specific : get_class($this));
$string2 = str_replace('\'', '\\\'', $string);
$currentKey = '<{'.$this->name.'}'._THEME_NAME_.'>'.$source.'_'.md5($string2);
$defaultKey = '<{'.$this->name.'}prestashop>'.$source.'_'.md5($string2);
if (key_exists($currentKey, $_MODULES))
$ret = stripslashes($_MODULES[$currentKey]);
elseif (key_exists($defaultKey, $_MODULES))
$ret = stripslashes($_MODULES[$defaultKey]);
else
$ret = $string;
return str_replace('"', '&quot;', $ret);
}
}
class TwengaFieldsException extends Exception {}
@@ -1,59 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsGetSubscriptionLink extends TwengaFields
{
public function __construct()
{
if(!is_array($this->fields) AND empty($this->fields))
{
$this->fields['PARTNER_AUTH_KEY'] = array(56, array('is_string', 'isCleanHtml'), true);
$this->fields['site_url'] = array(200, array('is_string', 'isUrl'), true);
$this->fields['feed_url'] = array(200, array('is_string', 'isUrl'), true);
$this->fields['country'] = array(2, array('is_string', 'isCountryName'), true);
$this->fields['site_id'] = array(32, array('is_string', 'isCleanHtml'));
$this->fields['site_name'] = array(100, array('is_string', 'isCleanHtml'));
$this->fields['firstname'] = array(100, array('is_string', 'isCleanHtml'));
$this->fields['lastname'] = array(100, array('is_string', 'isCleanHtml'));
$this->fields['civility'] = array(40, array('is_string', 'isCleanHtml'));
$this->fields['position'] = array(100, array('is_string', 'isCleanHtml'));
$this->fields['email'] = array(100, array('is_string', 'isEmail'));
$this->fields['phone'] = array(30, array('is_string', 'isPhoneNumber'));
$this->fields['mobile'] = array(30, array('is_string', 'isPhoneNumber'));
$this->fields['organisation_name'] = array(100, array('is_string', 'isCleanHtml'));
$this->fields['legaltype'] = array(30, array('is_string', 'isCleanHtml'));
$this->fields['address'] = array(100, array('is_string', 'isCleanHtml'));
$this->fields['postal_code'] = array(10, array('is_string', 'isCleanHtml'));
$this->fields['city'] = array(30, array('is_string', 'isCityName'));
}
parent::__construct();
}
}
@@ -1,88 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsGetTrackingScript extends TwengaFields
{
public function __construct()
{
if(!is_array($this->fields) AND empty($this->fields))
{
// required
$this->fields['PARTNER_AUTH_KEY'] = array(56, array('is_string', 'isCleanHtml'), true);
$this->fields['key'] = array(32, array('is_string','isCleanHtml'), true);
$this->fields['total_ht'] = array(0, array('isFloat'), true);
$this->fields['order_id'] = array(40, array('isInt'));
$this->fields['user_id'] = array(40, array('isInt'));
$this->fields['cli_email'] = array(100, array('isEmail'));
$this->fields['basket_id'] = array(40, array('isInt'));
// optionnals
$this->fields['currency'] = array(40, array('is_string','isCleanHtml'));
$this->fields['total_ttc'] = array(0, array('isFloat'));
$this->fields['shipping'] = array(0, array('isFloat'));
$this->fields['tax'] = array(0, array('isFloat'));
$this->fields['tva'] = array(0, array('isFloat'));
$this->fields['cli_firstname'] = array(0, array('is_string','isCleanHtml'));
$this->fields['cli_lastname'] = array(0, array('is_string','isCleanHtml'));
$this->fields['cli_city'] = array(0, array('is_string','isCleanHtml'));
$this->fields['cli_state'] = array(0, array('is_string','isCleanHtml'));
$this->fields['cli_country'] = array(0, array('is_string','isCleanHtml'));
$this->fields['cli_segment'] = array(0, array('is_string','isCleanHtml'));
$this->fields['payement_method'] = array(0, array('is_string','isCleanHtml'));
// Array of items
$this->fields['items'] = array(0, array('is_array', 'isItemsOrder'));
}
parent::__construct();
}
public static function isItemsOrder (array $value)
{
$str_error = Tools::displayError('For the items');
foreach ($value as $key=>$item)
{
$str_error .= ' '.$key.' ';
$str_error .= isset($item['name']) ? $item['name'].' ' : '';
$str_error .= ' :';
if(isset($item['total_ht']) && !Validate::isFloat($item['total_ht']))
throw new TwengaFieldsException($str_error.Tools::displayError('The total HT must be a float value.'));
if(isset($item['quantity']) && !Validate::isInt($item['quantity']))
throw new TwengaFieldsException($str_error.Tools::displayError('The quantity must be a integer value.'));
if(isset($item['sku']) && !is_string($item['sku']) && strlen($item['sku']) > 40)
throw new TwengaFieldsException($str_error.Tools::displayError('The sku must be a string with length less than 40 chars.'));
if(isset($item['name']) && !is_string($item['name']))
throw new TwengaFieldsException($str_error.Tools::displayError('The name must be a string with length less than 100 chars.'));
if(isset($item['category_name']) && !is_string($item['category_name']))
throw new TwengaFieldsException($str_error.Tools::displayError('The category name must be a string with length less than 100 chars.'));
}
return true;
}
}
@@ -1,32 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsOrderCancel extends TwengaFieldsOrderValidate
{}
@@ -1,33 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsOrderExist extends TwengaFieldsOrderValidate
{}
@@ -1,47 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsOrderValidate extends TwengaFields
{
public function __construct()
{
if(!is_array($this->fields) AND empty($this->fields))
{
$this->fields['key'] = array(32, array('is_string','isCleanHtml'), true);
$this->fields['PARTNER_AUTH_KEY'] = array(56, array('is_string', 'isCleanHtml'), true);
$this->fields['order_id'] = array(40, array('isInt'));
$this->fields['user_id'] = array(40, array('isInt'));
$this->fields['cli_email'] = array(100, array('isEmail'));
$this->fields['basket_id'] = array(40, array('isInt'));
}
parent::__construct();
}
}
@@ -1,33 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsSiteActivate extends TwengaFieldsSiteExist
{}
@@ -1,43 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaFieldsSiteExist extends TwengaFields
{
public function __construct()
{
if(!is_array($this->fields) AND empty($this->fields))
{
$this->fields['key'] = array(32, array('is_string', 'isCleanHtml'), true);
$this->fields['PARTNER_AUTH_KEY'] = array(56, array('is_string', 'isCleanHtml'), true);
}
parent::__construct();
}
}
-577
View File
@@ -1,577 +0,0 @@
<?php
/**
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA : 6 rue lacepede, 75005 PARIS
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
**/
/**
* This Class allow to use Twenga API.
* See details for more infos.
*
* @author Nans Pellicari - Prestashop
* @version 1.3
*/
class TwengaObj
{
/**
* path to load each needed files
* @var string
*/
public static $base_dir;
/**
* Set the object which use the translation method for the specific module.
* @var AbsTrustedShops
*/
private static $translation_object;
/**
* @var string for authentication on Twenga API
*/
private static $user_name;
/**
* @var string for authentication on Twenga API
*/
private static $password;
/**
* This partner_id is the same for each prestashop/twenga module.
* You don't have to change it.
*/
const PARTNER_AUTH_KEY = 'NTM3YTU1MTJjNTZhODg3OWI2Y2FhNDgyZjU4Njc0ZWU5NDMyNjgxNA==';
/**
* @var array is build in constructor, save all url method of twenga API
*/
private static $arr_api_url;
/**
* @var string is the twenga hashkey, use to identify the merchant.
* this value is saved in the configuration table in database.
* @see TwengaObj::saveMerchantLogin()
* @see TwengaObj::__constructor()
*/
public static $hashkey;
public function getUserName()
{
return self::$user_name;
}
public function setUserName($user_name)
{
if($user_name !== '' && is_string($user_name))
{
self::$user_name = $user_name;
return true;
}
else
return false;
}
public function getPassword()
{
return self::$password;
}
public function setPassword($password)
{
if($password !== '' && Validate::isCleanHtml($password) && is_string($password) && strlen($password) <= 32)
{
self::$password = $password;
return true;
}
else
return false;
}
public function getHashkey()
{
return self::$hashkey;
}
/**
* Set the hashkey
* @param string $hashkey
* @return boolean true if it's a valid key false otherwise.
*/
public function setHashkey($hashkey)
{
if($hashkey !== '' && Validate::isCleanHtml($hashkey) && is_string($hashkey) && strlen($hashkey) <= 32)
{
self::$hashkey = $hashkey;
return true;
}
else
return false;
}
public static function deleteMerchantLogin()
{
Configuration::deleteByName('TWENGA_USER_NAME');
self::$user_name = null;
Configuration::deleteByName('TWENGA_PASSWORD');
self::$password = null;
Configuration::deleteByName('TWENGA_HASHKEY');
self::$hashkey = null;
return true;
}
/**
* Save the Login access and hashkey in database
* Use TwengaObj::siteExist() method to check the hashkey validity and login
*/
public function saveMerchantLogin()
{
if(self::$user_name !== NULL
&& self::$password !== NULL
&& self::$hashkey !== NULL)
{
$site_exist = false;
try {
$site_exist = $this->siteExist();
} catch (Exception $e) {
self::deleteMerchantLogin();
throw $e;
}
if (!$site_exist)
{
self::deleteMerchantLogin();
return false;
}
else
{
Configuration::updateValue('TWENGA_USER_NAME', self::$user_name);
Configuration::updateValue('TWENGA_PASSWORD', self::$password);
Configuration::updateValue('TWENGA_HASHKEY', self::$hashkey);
return true;
}
} else {
return false;
}
}
public function getArrApiUrl ()
{
return self::$arr_api_url;
}
/**
* 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(self::$base_dir.'/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');
}
}
/**
* Build correct URl for cURL, using array of params
* @param string $url
* @param array $params
*/
private static function buildUrlToQuery($url, array $params)
{
$str_params = http_build_query($params);
$str_url = $url.(($str_params !== '') ? '?'.$str_params : '');
return $str_url;
}
/**
* Execute cURL to access of the Twenga API.
* @param string $query
* @param array $params
* @param boolean $authentication
* @throws TwengaException in case of cURL error.
* @return array with status code and response of the cURL request.
*/
private static function executeQuery($query, array $params = array(), $authentication = true)
{
$defaultParams = array(
CURLOPT_HEADER => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLINFO_HEADER_OUT => TRUE,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
);
if($authentication)
$defaultParams[CURLOPT_USERPWD] = md5(self::$user_name).':'.md5(self::$password);
$session = curl_init($query);
$arr_opt = $defaultParams + $params;
curl_setopt_array($session, $arr_opt);
$response = curl_exec($session);
$response = explode("\r\n\r\n", $response);
$header = $response[0];
$response = $response[1];
$status_code = (int)curl_getinfo($session, CURLINFO_HTTP_CODE);
if ($status_code === 0)
throw new TwengaException('CURL Error: '.curl_error($session));
curl_close($session);
return array('status_code' => $status_code, 'response' => $response);
}
/**
* @param string $method_name use to instanciate the good TwengaFields subclass.
* @param array $params to check
* @throws TwengaException if the object instanciate by the method name to check $params is a TwengaFields subclass.
* @throws TwengaFieldsException thrown by the TwengaFields::checkParams() method.
*/
public static function checkParams($method_name, array $params)
{
$classname = 'TwengaFields'.ucfirst($method_name);
if(class_exists($classname))
{
$fields = new $classname();
if(!$fields instanceof TwengaFields)
throw new TwengaException(self::$translation_object->l('Object for validate fields must be an instance of TwengaFields class', basename(__FILE__, '.php')));
try {
$fields->setParams($params)->checkParams();
} catch (TwengaFieldsException $e) {
throw $e;
}
}
}
/**
* @param array $params
* @throws TwengaFieldsException
* @throws TwengaException
*/
public function getSubscriptionLink(array $params = array())
{
require_once realpath(self::$base_dir.'/TwengaFieldsGetSubscriptionLink.php');
// $params['site_id'] = self::$site_id;
$params['PARTNER_AUTH_KEY'] = self::PARTNER_AUTH_KEY;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params, array(), false);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return (array)$obj_xml;
}
public function addFeed($params = array())
{
require_once realpath(self::$base_dir.'/TwengaAddFeed.php');
$params['key'] = self::$hashkey;
$params['PARTNER_AUTH_KEY'] = self::PARTNER_AUTH_KEY;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return ((string)$obj_xml->message === 'true') ? true : false;
}
/**
* @param array $params
* @throws TwengaFieldsException
* @throws TwengaException
*/
public function siteExist(array $params = array())
{
require_once realpath(self::$base_dir.'/TwengaFieldsSiteExist.php');
$params['key'] = self::$hashkey;
$params['PARTNER_AUTH_KEY'] = self::PARTNER_AUTH_KEY;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return ((string)$obj_xml->message === 'true') ? true : false;
}
/**
* @param array $params
* @throws TwengaFieldsException
* @throws TwengaException
*/
public function siteActivate(array $params = array())
{
require_once realpath(self::$base_dir.'/TwengaFieldsSiteExist.php');
require_once realpath(self::$base_dir.'/TwengaFieldsSiteActivate.php');
$params['key'] = self::$hashkey;
$params['PARTNER_AUTH_KEY'] = self::PARTNER_AUTH_KEY;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return ((string)$obj_xml->message === 'true') ? true : false;
}
/**
* @param array $params
* @throws TwengaFieldsException
* @throws TwengaException
*/
public function getTrackingScript(array $params = array())
{
require_once realpath(self::$base_dir.'/TwengaFieldsGetTrackingScript.php');
$params['key'] = self::$hashkey;
$params['PARTNER_AUTH_KEY'] = self::PARTNER_AUTH_KEY;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return (string)$obj_xml->message;
}
/**
* @param array $params
* @throws TwengaFieldsException
* @throws TwengaException
*/
public function orderExist(array $params = array())
{
require_once realpath(self::$base_dir.'/TwengaFieldsOrderValidate.php');
require_once realpath(self::$base_dir.'/TwengaFieldsOrderExist.php');
$params['key'] = self::$hashkey;
$params['PARTNER_AUTH_KEY'] = self::PARTNER_AUTH_KEY;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return ((string)$obj_xml->message === 'true') ? true : false;
}
/**
* @param array $params
* @throws TwengaFieldsException
* @throws TwengaException
*/
public function orderValidate(array $params = array())
{
require_once realpath(self::$base_dir.'/TwengaFieldsOrderValidate.php');
$params['key'] = self::$hashkey;
$params['PARTNER_AUTH_KEY'] = self::PARTNER_AUTH_KEY;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return ((string)$obj_xml->message === 'true') ? true : false;
}
/**
* @param array $params
* @throws TwengaFieldsException
* @throws TwengaException
*/
public function orderCancel(array $params = array())
{
require_once realpath(self::$base_dir.'/TwengaFieldsOrderValidate.php');
require_once realpath(self::$base_dir.'/TwengaFieldsOrderCancel.php');
$params['key'] = self::$hashkey;
try {
self::checkParams(__FUNCTION__, $params);
} catch (TwengaFieldsException $e) {
throw $e;
}
$str_params = self::buildUrlToQuery(self::$arr_api_url[__FUNCTION__],$params);
try {
$response = self::executeQuery($str_params);
self::checkStatusCode($response['status_code']);
$obj_xml = self::parseXml($response['response']);
} catch (TwengaException $e) {
throw $e;
} catch (Exception $e) {
throw new TwengaException(self::$translation_object->l($e->getMessage(),basename(__FILE__, '.php')), $e->getCode());
}
return ((string)$obj_xml->message === 'true') ? true : false;
}
/**
* @param string $resource to parse
* @throws TwengaException
*/
public static function parseXml($resource)
{
if ($resource != '')
{
libxml_use_internal_errors(true);
$xml = simplexml_load_string($resource);
if (libxml_get_errors())
throw new TwengaException(self::$translation_object->l('HTTP XML response is not parsable : ', basename(__FILE__, '.php')).'<br />'.var_export(libxml_get_errors(), true));
if($xml->getName() === 'error')
throw new TwengaException(self::$translation_object->l((string)$xml->message,basename(__FILE__, '.php')), (int)$xml->code);
return $xml;
}
else
throw new TwengaException(self::$translation_object->l('HTTP response is empty'));
}
/**
* @param int $status_code
* @throws TwengaException message depends on the error code
*/
protected static function checkStatusCode($status_code)
{
switch($status_code)
{
case 200:case 201:break;
default: throw new TwengaException('', (int)$status_code);
}
}
static public function setTranslationObject(Module $object)
{
self::$translation_object = $object;
}
}
class TwengaException extends Exception
{
/**
* Set the object which use the translation method for the specific module.
* @var AbsTrustedShops
*/
private static $translation_object;
static public function setTranslationObject(Module $object)
{
self::$translation_object = $object;
}
public function __construct($message, $code = 0)
{
if($code !== 0)
{
$error_label = self::$translation_object->l('This call to Twenga Web Services failed and returned an HTTP status of %d. That means:', basename(__FILE__, '.php'))."\n";
$error_label = sprintf($error_label, $code);
if($message === '' || empty($message) || $message === NULL)
{
switch ($code)
{
case 11: $message .= self::$translation_object->l('The function you tried to access does not exist', basename(__FILE__, '.php'));break;
case 12: $message .= self::$translation_object->l('A required field is empty', basename(__FILE__, '.php'));break;
case 13: $message .= self::$translation_object->l('The type of the parameter that has been sent is different from parameter expected type', basename(__FILE__, '.php'));break;
case 21: $message .= self::$translation_object->l('Hash key is not valid', basename(__FILE__, '.php'));break;
case 24: $message .= self::$translation_object->l('Hash key is required', basename(__FILE__, '.php'));break;
case 31: $message .= self::$translation_object->l('No order found. Please check parameters you sent', basename(__FILE__, '.php'));break;
case 401: $message .= self::$translation_object->l('Authentication is required.', basename(__FILE__, '.php'));break;
case 403: $message .= self::$translation_object->l('Authentication failed.', basename(__FILE__, '.php'));break;
case 404: $message .= self::$translation_object->l('Invalid url.', basename(__FILE__, '.php'));break;
case 500: $message .= self::$translation_object->l('The server encountered an internal server error', basename(__FILE__, '.php'));break;
case 503: $message .= self::$translation_object->l('The server is unavailable for the moment', basename(__FILE__, '.php'));break;
default: $message .= self::$translation_object->l('This call to PrestaShop Web Services returned an unexpected HTTP status of:', basename(__FILE__, '.php')).$code;
}
}
$message = self::$translation_object->l('Error #', basename(__FILE__, '.php')).$code." : \n".$error_label.$message.'';
}
parent::__construct($message, $code);
}
}