fix testPaxbox
This commit is contained in:
parent
9d27f87e45
commit
fff250224a
@ -101,22 +101,19 @@ class Fraud extends Module {
|
|||||||
public function testPaybox($id_order, $ip_country)
|
public function testPaybox($id_order, $ip_country)
|
||||||
{
|
{
|
||||||
$order = new Order($id_order);
|
$order = new Order($id_order);
|
||||||
$authorized = array('ESP','DEU','ITA','NLD','SWE','GBR','PRT','CHE','LUX','POL','AUT','BEL');
|
$authorized = array('FRA','ESP','DEU','ITA','NLD','SWE','GBR','PRT','CHE','LUX','POL','AUT','BEL');
|
||||||
|
|
||||||
$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] Fraud test', $id_order.' '.$ip_country); // dev
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!in_array($ip_country, $authorized)) {
|
if(!in_array($ip_country, $authorized)) {
|
||||||
$total_score = 110;
|
$total_score = 110;
|
||||||
$fraud_report = array();
|
$fraud_report = array();
|
||||||
$fraud_report[] = 'Pays de paiement hors EU (+110)';
|
$fraud_report[] = 'Pays de paiement hors EU (+110)';
|
||||||
|
|
||||||
|
$order_reputation = FraudCore::getReputationOrder((int)$id_order);
|
||||||
|
if($order_reputation) {
|
||||||
|
$fraud_report = array_merge($fraud_report, json_decode($order_reputation['report']));
|
||||||
|
$total_score += (int)$order_reputation['score'];
|
||||||
|
}
|
||||||
|
|
||||||
Db::getInstance()->ExecuteS('
|
Db::getInstance()->ExecuteS('
|
||||||
INSERT INTO `'._DB_PREFIX_.'order_reputation`
|
INSERT INTO `'._DB_PREFIX_.'order_reputation`
|
||||||
VALUES (
|
VALUES (
|
||||||
@ -125,6 +122,10 @@ class Fraud extends Module {
|
|||||||
'.((int) $total_score < 100? 1: 0).',
|
'.((int) $total_score < 100? 1: 0).',
|
||||||
"'.pSQL(json_encode($fraud_report)).'"
|
"'.pSQL(json_encode($fraud_report)).'"
|
||||||
)
|
)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`score` = '.(int) $total_score.',
|
||||||
|
`report` = "'.pSQL(json_encode($fraud_report)).'",
|
||||||
|
`pass` = '.((int) $total_score < 100? 1: 0).'
|
||||||
');
|
');
|
||||||
$this->_changeStatutFraud($order->id);
|
$this->_changeStatutFraud($order->id);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ class FraudCore {
|
|||||||
|
|
||||||
if ($already_suspect || $already_fraud) {
|
if ($already_suspect || $already_fraud) {
|
||||||
$this->fraud_score += 200;
|
$this->fraud_score += 200;
|
||||||
$this->fraud_report[] = 'Compte avec des commandes en suspicion de fraude, fraude non détectée ou commandes frauduleuses (+200)';
|
$this->fraud_report[] = 'Compte avec des commandes en fraude non détectée ou commandes frauduleuses (+200)';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adding from 23/02/2016
|
// Adding from 23/02/2016
|
||||||
@ -277,7 +277,7 @@ class FraudCore {
|
|||||||
|
|
||||||
if ($already_suspect_by_names || $already_fraud_by_names) {
|
if ($already_suspect_by_names || $already_fraud_by_names) {
|
||||||
$this->fraud_score += 200;
|
$this->fraud_score += 200;
|
||||||
$this->fraud_report[] = 'Existance d\'autres comptes de mêmes noms avec des commandes en suspicion de fraude, fraude non détectée ou commandes frauduleuses (+200)';
|
$this->fraud_report[] = 'Existance d\'autres comptes de mêmes noms avec des commandes en fraude non détectée ou commandes frauduleuses (+200)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,11 +125,27 @@ $response = curl_exec($curl);
|
|||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
|
|
||||||
$data = explode('&', $response);
|
$data = explode('&', $response);
|
||||||
$num_trans = explode('NUMTRANS=', $data[0]);
|
foreach ($data as $d) {
|
||||||
$num_appel = explode('NUMAPPEL=', $data[1]);
|
$d = explode('=', $d);
|
||||||
$autorisation = explode('AUTORISATION=', $data[5]);
|
if($d[0] == 'NUMTRANS') {
|
||||||
$code_reponse = explode('CODEREPONSE=', $data[6]);
|
$num_trans = $d[1];
|
||||||
$commentaire = explode('COMMENTAIRE=', $data[7]);
|
} elseif($d[0] == 'NUMAPPEL') {
|
||||||
|
$num_appel = $d[1];
|
||||||
|
} elseif($d[0] == 'AUTORISATION') {
|
||||||
|
$autorisation = $d[1];
|
||||||
|
} elseif($d[0] == 'CODEREPONSE') {
|
||||||
|
$code_reponse = $d[1];
|
||||||
|
} elseif($d[0] == 'COMMENTAIRE') {
|
||||||
|
$commentaire = $d[1];
|
||||||
|
} elseif($d[0] == 'PAYS') {
|
||||||
|
$pays = $d[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// $num_trans = explode('NUMTRANS=', $data[0]);
|
||||||
|
// $num_appel = explode('NUMAPPEL=', $data[1]);
|
||||||
|
// $autorisation = explode('AUTORISATION=', $data[5]);
|
||||||
|
// $code_reponse = explode('CODEREPONSE=', $data[6]);
|
||||||
|
// $commentaire = explode('COMMENTAIRE=', $data[7]);
|
||||||
|
|
||||||
$data[7] = utf8_encode($data[7]);
|
$data[7] = utf8_encode($data[7]);
|
||||||
|
|
||||||
@ -144,13 +160,14 @@ $test_mode = (int)Configuration::get('PBX_DEMO_MODE');
|
|||||||
$values = array(
|
$values = array(
|
||||||
'm' => (int) $montant,
|
'm' => (int) $montant,
|
||||||
'r' => (int) $cart->id,
|
'r' => (int) $cart->id,
|
||||||
't' => (int) $num_appel[1],
|
't' => (int) $num_appel,
|
||||||
'p' => $autorisation[1],
|
'p' => $autorisation,
|
||||||
'c' => $paybox_card['payment_type'],
|
'c' => $paybox_card['payment_type'],
|
||||||
'a' => 'CARTE',
|
'a' => 'CARTE',
|
||||||
's' => (int) $num_trans[1],
|
's' => (int) $num_trans,
|
||||||
'e' => $code_reponse[1],
|
'e' => $code_reponse,
|
||||||
'd' => $paybox_card['date'],
|
'd' => $paybox_card['date'],
|
||||||
|
'i' => isset($pays)?$pays:null,
|
||||||
'saved' => 1
|
'saved' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -303,7 +320,7 @@ switch ($code_reponse[1])
|
|||||||
}
|
}
|
||||||
|
|
||||||
$error .= 'PayBox version: '.$paybox->version."\n".'<br> POST '.print_r($postfields, true)."\n".'<br>GET '.print_r($data, true)."\n";
|
$error .= 'PayBox version: '.$paybox->version."\n".'<br> POST '.print_r($postfields, true)."\n".'<br>GET '.print_r($data, true)."\n";
|
||||||
$paybox->validateOrder((int)$cart->id, $statut, $total_paid, $paybox->displayName, $error, array(), NULL, false, $customer->secure_key);
|
$paybox->validateOrder((int)$cart->id, $statut, $total_paid, $paybox->displayName, $error, array(), NULL, false, $customer->secure_key, $values);
|
||||||
|
|
||||||
// save info paiement BDD
|
// save info paiement BDD
|
||||||
$paybox->saveInformationPaiement($values);
|
$paybox->saveInformationPaiement($values);
|
||||||
|
@ -291,20 +291,12 @@ class Paybox extends PaymentModule
|
|||||||
|
|
||||||
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown', $message = null, $transaction = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, $values = array())
|
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown', $message = null, $transaction = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, $values = array())
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->active)
|
if ($this->active)
|
||||||
{
|
{
|
||||||
parent::validateOrder((int)$id_cart, (int)$id_order_state, (float)$amount_paid, $payment_method, $message, $transaction, $currency_special, $dont_touch_amount, $secure_key);
|
parent::validateOrder((int)$id_cart, (int)$id_order_state, (float)$amount_paid, $payment_method, $message, $transaction, $currency_special, $dont_touch_amount, $secure_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$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] Paybox validate order', http_build_query($values,'',', ')); // dev
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($values) && isset($values['i'])) {
|
if(!empty($values) && isset($values['i'])) {
|
||||||
if (!class_exists('Fraud')) {
|
if (!class_exists('Fraud')) {
|
||||||
include_once _MODULE_DIR_.'fraud/fraud.php';
|
include_once _MODULE_DIR_.'fraud/fraud.php';
|
||||||
@ -320,15 +312,6 @@ class Paybox extends PaymentModule
|
|||||||
**/
|
**/
|
||||||
public function saveInformationPaiement($values,$direct_plus=false) {
|
public function saveInformationPaiement($values,$direct_plus=false) {
|
||||||
|
|
||||||
$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] Reponse paybox - Transaction value', http_build_query($values,'',', ')); // dev
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($values['u'])
|
if(isset($values['u'])
|
||||||
|| !empty($values['u'])
|
|| !empty($values['u'])
|
||||||
&& !$direct_plus
|
&& !$direct_plus
|
||||||
@ -372,14 +355,6 @@ class Paybox extends PaymentModule
|
|||||||
* @param array $values Tableau de retour Paybox
|
* @param array $values Tableau de retour Paybox
|
||||||
**/
|
**/
|
||||||
public function saveInformationCB($values,$id_customer) {
|
public function saveInformationCB($values,$id_customer) {
|
||||||
$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] Reponse paybox - Transaction value + Save CB', http_build_query($values,'',', ')); // dev
|
|
||||||
}
|
|
||||||
$handle = explode(' ',$values['u']);
|
$handle = explode(' ',$values['u']);
|
||||||
$date = substr($values["d"], -2).substr($values["d"], 0, 2);
|
$date = substr($values["d"], -2).substr($values["d"], 0, 2);
|
||||||
$payment = str_replace("_", " ",$values["c"]);
|
$payment = str_replace("_", " ",$values["c"]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user