m2m Posted February 4, 2014 Share Posted February 4, 2014 Bonjour J'ai quelques problèmes après la mise en production de mon prestashop. Premier vrai problème : - j'utilise le module paybox en Url Http direct. - le crédit agricole a bien l'adresse http://www.votresite.com/modules/paybox/validation.php avec le nom du site bien sûr Le paiement s'effectue mais le client tombe sur une page blanche sans rien et la commande ne se valide pas dans le back office... voici le code de la page validation ... <?php include(dirname(__FILE__).'/../../config/config.inc.php');include(dirname(__FILE__).'/paybox.php'); $errors = '';$unauthorized_server = true;$pbk_ok = false;$sign_ok = false;$paybox = new Paybox();$url_http = $paybox->isUrlHttp(); //ip verification when using url httpif($url_http){ $authorized_ips = array('195.101.99.76','194.2.122.158','62.39.109.166','194.50.38.6'); foreach ($authorized_ips as $authorized_ip) { if ($_SERVER['REMOTE_ADDR'] == $authorized_ip) { $unauthorized_server = false; break; } } if($unauthorized_server) $errors.='Unauthorized server : '.$_SERVER['REMOTE_ADDR'];}//if we use url_http, it has to be un authorized server//if(($url_http AND !$unauthorized_server) OR (!$url_http)) //sign verification $fp = fopen('pubkey.pem', 'r'); $public_key = fread($fp, 8192); fclose($fp); if($url_http) $vars = $_POST; else $vars = $_GET; foreach ($vars as $key => $val) { if ($key == 'pbx_sign') $pbx_sign = $val; else $pbx_retour .= '&' . $key . '=' . $val; } $pbx_retour = substr($pbx_retour, 1); // echo $pbx_retour; $pbx_sign = base64_decode($pbx_sign); $ossl_public_key = openssl_pkey_get_public($public_key); if (openssl_verify($pbx_retour, $pbx_sign, $ossl_public_key) != 1) { $sign_ok = false; $errors.=$paybox->getError('sign_ko'); } else{ $sign_ok = true; } //transaction result $pbx_error = $vars['pbx_error']; switch($pbx_error) { case '00000': $pbx_ok = true; break; default: $errors.= $paybox->getError($pbx_error); break; } if(isset($vars['ref'])){ //ref is compose like id_cart;payment_date list($id,$payment_type,$payment_date) = split(';',$vars['ref'],3); if($pbx_ok AND $sign_ok AND empty($errors)) { $total = floatval(number_format($vars['pbx_amount'], 2, '.', ''))/100; switch($payment_type) { //Cart Payment case 'CP': $paybox->validateOrder($id, _PS_OS_PAYMENT_, $total, $paybox->displayName, 'PAYBOX : auto : '.$vars['pbx_auth'].' - trans : '.$vars['pbx_trans'].'<br />'); //redirect to confirmation if(!$url_http)// Tools::redirectLink(__PS_BASE_URI__.'history.php');header('Location: '.__PS_BASE_URI__.'history.php'); break; //Payment demand case 'PD': //$paybox->validatePaymentDemand($id,$total);// Tools::redirectLink(__PS_BASE_URI__);header('Location: '.__PS_BASE_URI__); break; default:// Tools::redirectLink(__PS_BASE_URI__);header('Location: '.__PS_BASE_URI__); break; } } else { //we don't validate order if there is a problem during payment //$paybox->validateOrder(intval($vars['ref']), _PS_OS_ERROR_, 0, $paybox->displayName, $errors.'<br />'); //redirect to confirmation if(!$url_http)// Tools::redirectLink(__PS_BASE_URI__.'order.php');header('Location: '.__PS_BASE_URI__.'order.php'); }} ?> Deuxième petit problème : Dans traduction des mails en français j'ai changé les styles mais les clients continuent de recevoir les mails roses. Merci d'avance Link to comment Share on other sites More sharing options...
customcode Baptiste Posted February 5, 2014 Share Posted February 5, 2014 (edited) Bonjour, Avez vous un message d'erreur ? Peut être un fichier error_log ou un fichier journal dans votre panel ? Avez vous essayé d'activer le mode debug de prestashop ? Dans config/defines.inc.php replacer define('_PS_MODE_DEV_', false); par define('_PS_MODE_DEV_', true); Dans le fichier index.php ajoutez ces lignes au debut : <?php error_reporting(0); $old_error_handler = set_error_handler("userErrorHandler"); function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) { $time=date("d M Y H:i:s"); // Get the error type from the error number $errortype = array (1 => "Error", 2 => "Warning", 4 => "Parsing Error", 8 => "Notice", 16 => "Core Error", 32 => "Core Warning", 64 => "Compile Error", 128 => "Compile Warning", 256 => "User Error", 512 => "User Warning", 1024 => "User Notice"); $errlevel=$errortype[$errno]; //Write error to log file (CSV format) $errfile=fopen("errors.csv","a"); fputs($errfile,"\"$time\",\"$filename: $linenum\",\"($errlevel) $errmsg\"\r\n"); fclose($errfile); if($errno!=2 && $errno!=8) { //Terminate script if fatal error die("A fatal error has occurred. Script execution has been aborted"); } } ?> Vous devriez avoir un fichier error.csv Edited February 5, 2014 by customcode Baptiste (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now