Merge branch 'ticket-payboxAgreement' into develop

This commit is contained in:
Marion Muszynski 2016-09-08 14:37:05 +02:00
commit 5386bfe970
2 changed files with 62 additions and 60 deletions

View File

@ -22,7 +22,10 @@ if ($id_paybox_card) {
if(empty($paybox_card) || (int)$paybox_card['id_customer']!=(int)$cart->id_customer) {
Tools::redirect('order.php?step=3&cgv=1&paybox_error=1');
}
} else {
Tools::redirect('order.php?step=3&cgv=1&paybox_error=1');
}
include(dirname(__FILE__).'/../../header.php');
if(Configuration::get('PBX_DEMO_MODE') == 0) {
@ -30,7 +33,7 @@ if(Configuration::get('PBX_DEMO_MODE') == 0) {
} else {
//$curl = curl_init('https://ppps.paybox.com/PPPS.php');
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
@ -41,11 +44,11 @@ $pbx_id = trim(Configuration::get('PBX_ID'));
$num_question = Configuration::get('NUM_QUESTION_PAYBOX') + 1;
Configuration::updateValue('NUM_QUESTION_PAYBOX', $num_question);
$montant == (int)sprintf('%010d', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100);
$devise = 978;
$numbers = urldecode($paybox_card['handle']);
$dateval = $paybox_card['date'];
$customer = new Customer((int)$cart->id_customer);
$montant = (int)sprintf('%010d', number_format(Tools::convertPrice($cart->getOrderTotal(), null, false), 2, '.', '') * 100);
$devise = 978;
$numbers = urldecode($paybox_card['handle']);
$dateval = $paybox_card['date'];
$customer = new Customer((int)$cart->id_customer);
$refabonne = md5($customer->email);
$postfields = array(
@ -65,9 +68,10 @@ $postfields = array(
/*'CVV' => Configuration::get('PBX_DEMO_MODE') == 0 ?'123':$cvv,*/
'DATEQ' => date('dmYHis')
);
$trame = http_build_query($postfields, '', '&');
mail('marion@antadis.com', '[BBB] Paiement reponse globale', $trame);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($curl, CURLOPT_POSTFIELDS, $trame);
@ -78,7 +82,7 @@ curl_close($curl);
$data = explode('&', $response);
$code_reponse = explode('CODEREPONSE=', $data[6]);
mail('marion@antadis.com', 'Paiement reponse globale', http_build_query($response,'',', '));
mail('marion@antadis.com', '[BBB] Paiement reponse globale', $data);
// payment success
if (Configuration::get('PBX_DEMO_MODE') == 0) {
@ -89,7 +93,7 @@ if (Configuration::get('PBX_DEMO_MODE') == 0) {
if ($code_reponse[1] == "00000" || $code_reponse[0] == "00000") {
return true;
} else {
mail('marion@antadis.com', 'Soucis paiement reponse globale', json_encode($response));
mail('marion@antadis.com', '[BBB] Soucis paiement reponse globale', json_encode($response));
return false;
}
}

View File

@ -9,91 +9,89 @@ $module = new Paybox();
$controller->preProcess();
if (!$cookie->isLogged())
Tools::redirect('authentication.php');
Tools::redirect('authentication.php');
include(dirname(__FILE__).'/../../header.php');
$customer = new Customer((int)$cart->id_customer);
if (!Validate::isLoadedObject($customer))
die(Tools::displayError());
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'));
$save_paybox = Tools::getValue('save_paybox', false);
$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';
$save_paybox = Tools::getValue('save_paybox', false);
if($save_paybox) {
$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;k:K';
$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;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;k:K';
$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;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';
$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_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;
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_REFABONNE=".md5($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";
}
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";
}
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));
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));
echo str_replace($info_useless,'', shell_exec('/home/www/bebeboutik.com/cgi/www/modulev2.cgi '. $params));
}
include(dirname(__FILE__).'/../../footer.php');