* needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2011 PrestaShop SA * @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 */ include '../../config/config.inc.php'; include '../../init.php'; include '../../header.php'; require_once _PS_MODULE_DIR_ . 'socolissimo/socolissimo.php'; $validReturn = array('PUDOFOID', 'CECIVILITY', 'CENAME', 'CEFIRSTNAME', 'CECOMPANYNAME', 'CEEMAIL', 'CEPHONENUMBER', 'DELIVERYMODE', 'CEADRESS1', 'CEADRESS2', 'CEADRESS3', 'CEADRESS4', 'CEZIPCODE', 'CEDOORCODE1', 'CEDOORCODE2', 'CEENTRYPHONE', 'DYPREPARATIONTIME', 'DYFORWARDINGCHARGES', 'ORDERID', 'SIGNATURE', 'ERRORCODE', 'TRPARAMPLUS', 'TRCLIENTNUMBER', 'PRID', 'PRNAME', 'PRCOMPLADRESS', 'PRADRESS1', 'PRADRESS2', 'PRZIPCODE', 'PRTOWN', 'CETOWN', 'TRADERCOMPANYNAME', 'CEDELIVERYINFORMATION', 'CEDOORCODE1', 'CEDOORCODE2'); //list of non-blocking error $nonBlockingError = array(133, 131, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501); $so = new Socolissimo(); $return = array(); foreach ($_POST as $key => $val) { if (in_array(strtoupper($key), $validReturn)) { $return[strtoupper($key)] = utf8_encode(urldecode(stripslashes($val))); } } if (isset($return['SIGNATURE']) and isset($return['CENAME']) and isset($return['DYPREPARATIONTIME']) and isset($return['DYFORWARDINGCHARGES']) and isset($return['TRCLIENTNUMBER']) and isset($return['ORDERID']) and isset($return['TRCLIENTNUMBER'])) { if (!isset($return['ERRORCODE']) or $return['ERRORCODE'] == NULL or in_array($return['ERRORCODE'], $nonBlockingError)) { if ($return['SIGNATURE'] === socolissimo::make_key($return['CENAME'], (double) $return['DYPREPARATIONTIME'], $return['DYFORWARDINGCHARGES'], $return['TRCLIENTNUMBER'], $return['ORDERID'])) { global $cookie; if (isset($cookie) or is_object($cookie)) { if (saveOrderShippingDetails((int) $cookie->id_cart, (int) $return['TRCLIENTNUMBER'], $return)) { global $cookie; $cart->id_carrier = (int) $_POST['TRPARAMPLUS']; if (!$cart->update()) {
public function __construct() { // Get the parent stuff with Backward Compatibility parent::__construct(); $this->errors_list = array(SCError::REQUIRED => array('001' => $this->l('FO id missing'), '002' => $this->l('Wrong FO id'), '003' => $this->l('Client access denied'), '004' => $this->l('Required fields missing'), '006' => $this->l('Missing signature'), '007' => $this->l('Wrong sign or number version'), '008' => $this->l('Wrong zip code'), '009' => $this->l('Wrong format of the Validation back url'), '010' => $this->l('Wrong format of the Failed back url'), '011' => $this->l('Invalid transaction number'), '012' => $this->l('Wrong format of the fees'), '015' => $this->l('App server unavailable'), '016' => $this->l('SGBD unavailable')), SCError::WARNING => array('501' => $this->l('Mail field too long, trunked'), '502' => $this->l('Phone field too long, trunked'), '503' => $this->l('Name field too long, trunked'), '504' => $this->l('First name field too long, trunked'), '505' => $this->l('Social reason field too long, trunked'), '506' => $this->l('Floor field too long, trunked'), '507' => $this->l('Hall field too long, trunked'), '508' => $this->l('Locality field too long'), '509' => $this->l('Number and wording access field too long, trunked'), '510' => $this->l('Town field too long, trunked'), '511' => $this->l('Intercom field too long, trunked'), '512' => $this->l('Further Information field too long, trunked'), '513' => $this->l('Door code field too long, trunked'), '514' => $this->l('Door code field too long, trunked'), '515' => $this->l('Customer number too long, trunked'), '516' => $this->l('Transaction order too long, trunked'), '517' => $this->l('ParamPlus field too long, trunked'), '131' => $this->l('Invalid civility, field ignored'), '132' => $this->l('Delay preparation is invalid, ignored'), '133' => $this->l('Invalid weight field, ignored'), '998' => $this->l('Invalid regenerated sign'), '999' => $this->l('Error occurred during shipping step.'))); }
<?php include_once '../../config/config.inc.php'; include_once '../../init.php'; include_once '../../modules/socolissimo/socolissimo.php'; if (!Tools::getValue('ajax')) { die(''); } $socolissimo = new Socolissimo(); global $cookie; $result = $socolissimo->getDeliveryInfos($cookie->id_cart, $cookie->id_customer); if (!$result) { die('{"result" : false}'); } else { die('{"result" : true}'); }
<?php include_once '../../config/config.inc.php'; include_once '../../init.php'; include_once '../../modules/socolissimo/socolissimo.php'; // To have context available and translation $socolissimo = new Socolissimo(); // Default answer values => key $result = array('answer' => true, 'msg' => ''); // Check Token if (Tools::getValue('token') != sha1('socolissimo' . _COOKIE_KEY_ . Context::getContext()->cart->id)) { $result['answer'] = false; $result['msg'] = $socolissimo->l('Invalid token'); } // If no problem with token but no delivery available if ($result['answer'] && !($result = $socolissimo->getDeliveryInfos(Context::getContext()->cart->id, Context::getContext()->customer->id))) { $result['answer'] = false; $result['msg'] = $socolissimo->l('No delivery information selected'); } header('Content-type: application/json'); echo json_encode($result); exit(0);
<?php include_once '../../config/config.inc.php'; include_once '../../init.php'; include_once '../../modules/socolissimo/socolissimo.php'; if (Tools::getValue('token') == sha1('socolissimo' . _COOKIE_KEY_ . Context::getContext()->cart->id)) { die('INVALID TOKEN'); } $socolissimo = new Socolissimo(); $result = $socolissimo->getDeliveryInfos(Context::getContext()->cart->id, Context::getContext()->customer->id); if (!$result) { die('{"result" : false}'); } else { die('{"result" : true}'); }