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)
|
||||
{
|
||||
$order = new Order($id_order);
|
||||
$authorized = array('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
|
||||
}
|
||||
$authorized = array('FRA','ESP','DEU','ITA','NLD','SWE','GBR','PRT','CHE','LUX','POL','AUT','BEL');
|
||||
|
||||
if(!in_array($ip_country, $authorized)) {
|
||||
$total_score = 110;
|
||||
$fraud_report = array();
|
||||
$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('
|
||||
INSERT INTO `'._DB_PREFIX_.'order_reputation`
|
||||
VALUES (
|
||||
@ -125,6 +122,10 @@ class Fraud extends Module {
|
||||
'.((int) $total_score < 100? 1: 0).',
|
||||
"'.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);
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ class FraudCore {
|
||||
|
||||
if ($already_suspect || $already_fraud) {
|
||||
$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
|
||||
@ -277,7 +277,7 @@ class FraudCore {
|
||||
|
||||
if ($already_suspect_by_names || $already_fraud_by_names) {
|
||||
$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);
|
||||
|
||||
$data = explode('&', $response);
|
||||
$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]);
|
||||
foreach ($data as $d) {
|
||||
$d = explode('=', $d);
|
||||
if($d[0] == 'NUMTRANS') {
|
||||
$num_trans = $d[1];
|
||||
} 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]);
|
||||
|
||||
@ -144,13 +160,14 @@ $test_mode = (int)Configuration::get('PBX_DEMO_MODE');
|
||||
$values = array(
|
||||
'm' => (int) $montant,
|
||||
'r' => (int) $cart->id,
|
||||
't' => (int) $num_appel[1],
|
||||
'p' => $autorisation[1],
|
||||
't' => (int) $num_appel,
|
||||
'p' => $autorisation,
|
||||
'c' => $paybox_card['payment_type'],
|
||||
'a' => 'CARTE',
|
||||
's' => (int) $num_trans[1],
|
||||
'e' => $code_reponse[1],
|
||||
's' => (int) $num_trans,
|
||||
'e' => $code_reponse,
|
||||
'd' => $paybox_card['date'],
|
||||
'i' => isset($pays)?$pays:null,
|
||||
'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";
|
||||
$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
|
||||
$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())
|
||||
{
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
$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 (!class_exists('Fraud')) {
|
||||
include_once _MODULE_DIR_.'fraud/fraud.php';
|
||||
@ -320,15 +312,6 @@ class Paybox extends PaymentModule
|
||||
**/
|
||||
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'])
|
||||
|| !empty($values['u'])
|
||||
&& !$direct_plus
|
||||
@ -372,14 +355,6 @@ class Paybox extends PaymentModule
|
||||
* @param array $values Tableau de retour Paybox
|
||||
**/
|
||||
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']);
|
||||
$date = substr($values["d"], -2).substr($values["d"], 0, 2);
|
||||
$payment = str_replace("_", " ",$values["c"]);
|
||||
|
Loading…
Reference in New Issue
Block a user