preProcess(); if (!$cookie->isLogged()) Tools::redirect('authentication.php'); include(dirname(__FILE__).'/../../header.php'); $customer = new Customer((int)$cart->id_customer); if (!Validate::isLoadedObject($customer)) die(Tools::displayError()); $ps_url = ((Configuration::get('PS_SSL_ENABLED') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == '443')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].__PS_BASE_URI__; $pbx_site = trim(Configuration::get('PBX_SITE')); $pbx_rang = trim(Configuration::get('PBX_RANG')); $pbx_id = trim(Configuration::get('PBX_ID')); $pbx_total = (int)sprintf('%f', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100); $pbx_devise = 978; // euro $pbx_ipn = $ps_url.'modules/'.$module->name.'/validation.php'; $pbx_link = $ps_url.'modules/'.$module->name.'/paiement.php'; $pbx_3ds = 'N'; $save_paybox = Tools::getValue('save_paybox', false); $refabonne = $customer->email; if($save_paybox) { $count_cards = Db::getInstance()->getValue(' SELECT COUNT(`id_paybox_card`) FROM `'._DB_PREFIX_.'paybox_customer_agreement` WHERE `id_customer` = '.(int)$cart->id_customer.' '); if ($count_cards) { $refabonne = $customer->email.((int)$count_cards+1); } $pbx_retour = 'm:M;r:R;t:T;a:A;b:B;p:P;c:C;s:S;y:Y;e:E;n:N;j:J;d:D;u:U;i:I;k:K'; } else { $pbx_retour = 'm:M;r:R;t:T;a:A;b:B;p:P;c:C;s:S;y:Y;e:E;n:N;j:J;d:D;i:I;k:K'; } if (version_compare(_PS_VERSION_, '1.5', '>')) { $pbx_confurl = $ps_url.'index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$module->id.'&key='.$customer->secure_key; $pbx_cancelurl = $ps_url.'index.php?controller=order&step=3'; } else { $pbx_confurl = $ps_url.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$module->id.'&key='.$customer->secure_key; $pbx_cancelurl = $ps_url.'order.php?step=3'; } $language = new Language((int)$cart->id_lang); switch ($language->iso_code) { case 'fr': $pbx_langue = 'FRA'; break; case 'es': $pbx_langue = 'ESP'; break; case 'de': $pbx_langue = 'DEU'; break; case 'it': $pbx_langue = 'ITA'; break; case 'nl': $pbx_langue = 'NLD'; break; case 'sv': $pbx_langue = 'SWE'; break; case 'en-us': default: $pbx_langue = 'GBR'; break; } unset($language); $params = "PBX_MODE=4 PBX_SITE=".$pbx_site." PBX_RANG=".$pbx_rang." PBX_TOTAL=".$pbx_total." PBX_DEVISE=".$pbx_devise." PBX_CMD=".(int)$cart->id." PBX_PORTEUR=".$customer->email." PBX_REFABONNE=".$refabonne." PBX_3DS='".$pbx_3ds."' PBX_RETOUR='".$pbx_retour."' PBX_IDENTIFIANT=".$pbx_id." PBX_EFFECTUE='".$pbx_confurl."' PBX_ANNULE='".$pbx_cancelurl."' PBX_LANGUE='".$pbx_langue."' PBX_REFUSE='".$pbx_confurl."' PBX_REPONDRE_A='".$pbx_ipn."'"; if( Configuration::get('PBX_DEMO_MODE') == 0 ) { if (_PS_MOBILE_) { $params .= " PBX_PAYBOX=https://preprod-tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi PBX_BACKUP1=https://preprod-tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi"; } else { $params .= " PBX_PAYBOX=https://preprod-tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi PBX_BACKUP1=https://preprod-tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi"; } } else { if (_PS_MOBILE_) { $params .= " PBX_PAYBOX=https://tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi PBX_BACKUP1=https://tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi"; } } $authorized_ip = array( '88.163.22.99', '90.63.178.63', '217.64.63.215' ); if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) { mail('marion@antadis.com', '[BBB] Envoi paybox', $params); } $info_useless = array('Content-type: text/html', 'Cache-Control: no-cache, no-store' , 'Pragma: no-cache'); if( Configuration::get('PBX_DEMO_MODE') == 0 ) { echo str_replace($info_useless,'', shell_exec('/home/www/bb.pp.antadis.net/www/cgi-bin/modulev2.cgi '. $params)); } else { echo str_replace($info_useless,'', shell_exec('/home/www/bebeboutik.com/cgi/www/modulev2.cgi '. $params)); } include(dirname(__FILE__).'/../../footer.php');