bebeboutik/modules/paybox/paiement.php
2016-02-23 17:33:01 +01:00

95 lines
3.2 KiB
PHP
Executable File

<?php
require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
require_once(dirname(__FILE__).'/paybox.php');
global $cart, $smarty;
$module = new Paybox();
$controller->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 = '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_retour = 'm:M;r:R;t:T;a:A;b:B;p:P;c:C;s:S;y:Y;e:E;d:D;k:K';
$pbx_total = (int)sprintf('%f', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100);
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';
}
$pbx_ipn = $ps_url.'modules/'.$module->name.'/validation.php';
$pbx_link = $ps_url.'modules/'.$module->name.'/paiement.php';
$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);
$pbx_devise = 978; // euro
$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_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";
}
}
$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('/srv/http/bbb_git/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');