"20", "AE"=>"784", "AF"=>"4", "AG"=>"28", "AI"=>"660", "AL"=>"8", "AM"=>"51", "AO"=>"24", "AQ"=>"10", "AR"=>"32", "AS"=>"16", "AT"=>"40", "AU"=>"36", "AW"=>"533", "AX"=>"248", "AZ"=>"31",
"BA"=>"70", "BB"=>"52", "BD"=>"50", "BE"=>"56", "BF"=>"854", "BG"=>"100", "BH"=>"48", "BI"=>"108", "BJ"=>"204", "BL"=>"652", "BM"=>"60", "BN"=>"96", "BO"=>"68", "BQ"=>"535", "BR"=>"76", "BS"=>"44", "BT"=>"64", "BV"=>"74", "BW"=>"72", "BY"=>"112", "BZ"=>"84",
"CA"=>"124", "CC"=>"166", "CD"=>"180", "CF"=>"140", "CG"=>"178", "CH"=>"756", "CI"=>"384", "CK"=>"184", "CL"=>"152", "CM"=>"120", "CN"=>"156", "CO"=>"170", "CR"=>"188", "CU"=>"192", "CV"=>"132", "CW"=>"531", "CX"=>"162", "CY"=>"196", "CZ"=>"203",
"DE"=>"276", "DJ"=>"262", "DK"=>"208", "DM"=>"212", "DO"=>"214", "DZ"=>"12",
"EC"=>"218", "EE"=>"233", "EG"=>"818", "EH"=>"732", "ER"=>"232", "ES"=>"724", "ET"=>"231",
"FI"=>"246", "FJ"=>"242", "FK"=>"238", "FM"=>"583", "FO"=>"234", "FR"=>"250",
"GA"=>"266", "GB"=>"826", "GD"=>"308", "GE"=>"268", "GF"=>"254", "GG"=>"831", "GH"=>"288", "GI"=>"292", "GL"=>"304", "GM"=>"270", "GN"=>"324", "GP"=>"312", "GQ"=>"226", "GR"=>"300", "GS"=>"239", "GT"=>"320", "GU"=>"316", "GW"=>"624", "GY"=>"328",
"HK"=>"344", "HM"=>"334", "HN"=>"340", "HR"=>"191", "HT"=>"332", "HU"=>"348",
"ID"=>"360", "IE"=>"372", "IL"=>"376", "IM"=>"833", "IN"=>"356", "IO"=>"86", "IQ"=>"368", "IR"=>"364", "IS"=>"352", "IT"=>"380",
"JE"=>"832", "JM"=>"388", "JO"=>"400", "JP"=>"392",
"KE"=>"404", "KG"=>"417", "KH"=>"116", "KI"=>"296", "KM"=>"174", "KN"=>"659", "KP"=>"408", "KR"=>"410", "KW"=>"414", "KY"=>"136", "KZ"=>"398",
"LA"=>"418", "LB"=>"422", "LC"=>"662", "LI"=>"438", "LK"=>"144", "LR"=>"430", "LS"=>"426", "LT"=>"440", "LU"=>"442", "LV"=>"428", "LY"=>"434",
"MA"=>"504", "MC"=>"492", "MD"=>"498", "ME"=>"499", "MF"=>"663", "MG"=>"450", "MH"=>"584", "MK"=>"807", "ML"=>"466", "MM"=>"104", "MN"=>"496", "MO"=>"446", "MP"=>"580", "MQ"=>"474", "MR"=>"478", "MS"=>"500", "MT"=>"470", "MU"=>"480", "MV"=>"462", "MW"=>"454", "MX"=>"484", "MY"=>"458", "MZ"=>"508",
"NA"=>"516", "NC"=>"540", "NE"=>"562", "NF"=>"574", "NG"=>"566", "NI"=>"558", "NL"=>"528", "NO"=>"578", "NP"=>"524", "NR"=>"520", "NU"=>"570", "NZ"=>"554",
"OM"=>"512",
"PA"=>"591", "PE"=>"604", "PF"=>"258", "PG"=>"598", "PH"=>"608", "PK"=>"586", "PL"=>"616", "PM"=>"666", "PN"=>"612", "PR"=>"630", "PS"=>"275", "PT"=>"620", "PW"=>"585", "PY"=>"600",
"QA"=>"634",
"RE"=>"638", "RO"=>"642", "RS"=>"688", "RU"=>"643", "RW"=>"646",
"SA"=>"682", "SB"=>"90", "SC"=>"690", "SD"=>"729", "SE"=>"752", "SG"=>"702", "SH"=>"654", "SI"=>"705", "SJ"=>"744", "SK"=>"703", "SL"=>"694", "SM"=>"674", "SN"=>"686", "SO"=>"706", "SR"=>"740", "SS"=>"728", "ST"=>"678", "SV"=>"222", "SX"=>"534", "SY"=>"760", "SZ"=>"748",
"TC"=>"796", "TD"=>"148", "TF"=>"260", "TG"=>"768", "TH"=>"764", "TJ"=>"762", "TK"=>"772", "TL"=>"626", "TM"=>"795", "TN"=>"788", "TO"=>"776", "TR"=>"792", "TT"=>"780", "TV"=>"798", "TW"=>"158", "TZ"=>"834",
"UA"=>"804", "UG"=>"800", "UM"=>"581", "US"=>"840", "UY"=>"858", "UZ"=>"860",
"VA"=>"336", "VC"=>"670", "VE"=>"862", "VG"=>"92", "VI"=>"850", "VN"=>"704", "VU"=>"548",
"WF"=>"876", "WS"=>"882",
"YE"=>"887", "YT"=>"175",
"ZA"=>"710", "ZM"=>"894", "ZW"=>"716"
);
// Convert the alpha-2 code to uppercase to ensure consistency
$alpha2Code = strtoupper($alpha2Code);
// Check if the alpha-2 code exists in the array
if (array_key_exists($alpha2Code, $countryCodes)) {
return $countryCodes[$alpha2Code];
} else {
return $default;
}
}
function retrouver_prenom_nom($data, &$prenom, &$nom) {
// Diviser la chaîne en mots en utilisant l'espace comme séparateur
$mots = explode(" ", trim($data));
// Extraire le premier mot
$prenom = trim($mots[0]);
// Extraire le reste des mots et les réassembler en une chaîne
$nom = trim(implode(" ", array_slice($mots, 1)));
if ( $prenom == "" ) {
$prenom = "inconnu";
}
if ( $nom == "" ) {
$nom = $prenom;
$prenom = "inconnu";
}
}
/**
* Etransactions class for online payment
*/
class Etransactions_direct {
/**
* The code name for module
*
* @var string
*/
public $code;
/**
* The module title
*
* @var string
*/
public $title;
/**
* The module descriptipon
*
* @var string
*/
public $description;
/**
* The current module state
*
* @var string
*/
public $enabled;
/**
* 3D secure state
*
* @var type
*/
public $enabled_3d;
/**
* The module signature
*
* @var string
*/
public $signature;
/**
* The public title of the module
*
* @var string
*/
public $public_title;
/**
* Sort order
*
* @var string
*/
public $sort_order;
/**
* The order status
*
* @var string
*/
public $order_status;
/**
* The gateway url
*
* @var string
*/
public $form_action_url;
public $form_action_url_redirect;
/**
* Class utility for Etransactions
*
* @var Etransactions
*/
public $Etransactions = null;
/**
* Class utility for Cryptography
*
* @var crypto
*/
public $crypto = null;
/**
* Default constructor
*
* @global order $order
*/
public function __construct() {
global $order;
$this->crypto = new ETransactionsEncrypt();
$this->signature = 'Etransactions_direct|Etransactions_direct|1.0|2.2';
$this->code = 'Etransactions_direct';
$this->title = MODULE_PAYMENT_Etransactions_DIRECT_TEXT_TITLE;
$this->public_title = MODULE_PAYMENT_Etransactions_DIRECT_TEXT_PUBLIC_TITLE;
$this->description = MODULE_PAYMENT_Etransactions_DIRECT_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_Etransactions_DIRECT_SORT_ORDER;
$this->enabled = ( ( MODULE_PAYMENT_Etransactions_DIRECT_STATUS == 'True' ) ? true : false );
$this->enabled_3d = ( ( MODULE_PAYMENT_Etransactions_DIRECT_3DSECURE == 'True' ) ? true : false );
$this->Etransactions = new Etransactions( $this );
// vd: --> redirect confirmation to checkout_process
$this->form_action_url = null;
if ( MODULE_PAYMENT_Etransactions_DIRECT_ENVIRONMENT == "Production" ) {
// URL principale :
$this->form_action_url_redirect = "https://tpeweb.e-transactions.fr/php/";
// URL secondaire :
// $this->form_action_url_redirect = "https://tpeweb1.e-transactions.fr/php/";
} else {
$this->form_action_url_redirect = "https://recette-tpeweb.e-transactions.fr/php/";
}
if ( is_object( $order ) ) {
$this->update_status();
}
}
/**
* Install payment module Etransactions with default configuration
*/
public function install() {
$this->_getConfLang();
//Activation
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_ENABLE ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_STATUS', '', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_ENABLE ) . "', '6', '0','tep_cfg_select_option(array(\'True\', \'False\'), ', now())" );
//Environment
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_ENVIRONMENT ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_ENVIRONMENT', 'Test', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_ENVIRONMENT ) . "', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())" );
//ID site
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_IDSITE ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_IDSITE', '9999999', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_IDSITE ) . "', '6', '0', now())" );
//Rank site
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_RANK ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_RANK', '95', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_RANK ) . "', '6', '0', now())" );
//Etransactions ID
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_IDPROFIL ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_IDPROFIL', '259207933', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_IDPROFIL ) . "', '6', '0', now())" );
//Secret Key
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_LABEL_HMACKEY ) . "', 'MODULE_PAYMENT_Etransactions_HMACKEY', '". $this->crypto->encrypt('4642EDBBDFF9790734E673A9974FC9DD4EF40AA2929925C40B3A95170FF5A578E7D2579D6074E28A78BD07D633C0E72A378AD83D4428B0F3741102B69AD1DBB0') . "', '" . tep_db_input( MODULE_PAYMENT_Etransactions_TEXT_HMACKEY ) . "', '6', '0','','', now())" );
//Enable 3D Secure
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function,date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_3DSECURE ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_3DSECURE', 'True', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_3DSECURE ) . "', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())" );
//Minimum amount 3d secure
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_MIN_AMOUNT_3D ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_MIN_AMOUNT_3D', '', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_MIN_AMOUNT_3D ) . "', '6', '0', now())" );
//Order status
tep_db_query( "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) "
. " VALUES ('" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_LABEL_ORDER_STATUS ) . "', 'MODULE_PAYMENT_Etransactions_DIRECT_ORDER_STATUS', '', '" . tep_db_input( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_ORDER_STATUS ) . "', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())" );
$this->Etransactions->create_table_info();
}
/**
* functions for encrypting and decrypting from this class
**/
public function encryptKey(){
return $this->crypto->encrypt(MODULE_PAYMENT_Etransactions_HMACKEY);
}
public function decryptKey(){
return $this->crypto->decrypt(MODULE_PAYMENT_Etransactions_HMACKEY);
}
/**
* Include the file with translation
*/
private function _getConfLang() {
//test current lang for I18N
$defaultPathLang = realpath( dirname( __FILE__ ) ) . "/../../languages/english/modules/payment/Etransactions_direct.php";
if ( isset( $_SESSION["language"] ) && $_SESSION["language"] != "" ) {
$currentPathLang = realpath( dirname( __FILE__ ) ) . "/../../languages/" . trim( strtolower( $_SESSION["language"] ) . "/modules/payment/Etransactions_direct.php" );
if ( file_exists( $currentPathLang ) ) {
require_once $currentPathLang;
} else {
require_once $defaultPathLang;
}
} else {
require_once $defaultPathLang;
}
}
/**
* Delete the module and all configurations
*/
public function remove() {
tep_db_query( "DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key IN ('" . implode( "', '", $this->keys() ) . "')" );
}
public function pre_confirmation_check() {
return null; /*jc 1.6 15/03/2017*/
}
public function confirmation() {
return false;
}
public function redirect_payment($orderid) {
global $language, $order, $currency;
require_once DIR_WS_CLASSES. 'currencies.php';
$currency_object = new currencies();
$precision = $currency_object->get_decimal_places($currency);
$thousands_point = $currency_object->currencies[$currency]['thousands_point'];
$decimal_point = $currency_object->currencies[$currency]['decimal_point'];
//Detect mobile
if ( $this->Etransactions->is_mobile() ) {
if ( MODULE_PAYMENT_Etransactions_DIRECT_ENVIRONMENT == "Production" ) {
$this->form_action_url_redirect = "https://tpeweb.e-transactions.fr/php/";
// url secondaire : si necessaire
// $this->form_action_url_redirect = "https://tpeweb1.e-transactions.fr/php/";
} else {
$this->form_action_url_redirect = "https://recette-tpeweb.e-transactions.fr/php/";
}
}
$order = new order( $orderid );
//Define language
$langue_pbx = Etransactions::getLang( $language );
//Define currency
$pbx_devise = Etransactions::getCurrency( $currency );
define( 'PBX_Etransactions_EFFECTUE', tep_href_link( FILENAME_CHECKOUT_SUCCESS ) );
// cmd : numero de commande
$pbx_cmd=$orderid;
// porteur : email de l'acheteur
$pbx_porteur=$order->customer['email_address'];
// repondre a : url de retour back office site (notification de paiement IPN)
$pbx_repondre_a=tep_href_link( "Etransactions_ipn.php" );
// retour: Parametrage des donnees retournees via l'IPN :
$pbx_retour = Etransactions::getPbxRetour();
// Parametrage des urls de redirection navigateur client apres paiement
$pbx_effectue = PBX_Etransactions_EFFECTUE;
$pbx_annule = tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'NONSSL', true );
$pbx_refuse = tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'NONSSL', true );
//define date
$dateTime = date( "c" );
//define total
$tmp_total = str_replace($thousands_point,'',$order->info['total']);
$tmp_total = str_replace(',',".",$order->info['total']);
$tmp_total = preg_replace('/[^0-9\.]/','',$tmp_total);
//17.11.2017 TPHILIPPS : cause pb de paiement si total > 1000E
//if($precision>0)$tmp_total = money_format('%'.$precision.'n',$tmp_total);
$pbx_total = Etransactions::getTotal( $tmp_total );
//define 3d secure
$pbx_souhaitauthent="01"; // variable de test authentification 3DS (01 par defaut, 02 pour exemption 3DS)
// shoppingcart
// Nombre de produit envoye dans PBX_SHOPPINGCART :
$pbx_nb_produit = sizeof($order->products);
if ( $pbx_nb_produit > 99 ) { $pbx_nb_produit = 99; }
// Construction de PBX_SHOPPINGCART :
$pbx_shoppingcart = "".$pbx_nb_produit."";
// Valeurs envoyees dans PBX_BILLING :
retrouver_prenom_nom($order->customer['name'], $pbx_prenom_fact, $pbx_nom_fact); // prenom/nom de l utilisateur de facturation
$pbx_adresse1_fact = $order->customer['street_address']; // ligne1 de l adresse de facturation' : variable de test 1 rue de Paris
$pbx_adresse2_fact = ''; // ligne2 de l adresse de facturation' : variable de test
$pbx_zipcode_fact = $order->customer['postcode']; // code postal de l adresse de facturation' : variable de test 75001
$pbx_city_fact = $order->customer['city']; // ville de l adresse de facturation : variable de test Paris
$country_name = $order->customer['country'];
$country_iso_code_2_array_query = tep_db_query( "select countries_iso_code_2 from " . TABLE_COUNTRIES . " where countries_name = '$country_name'" );
$country_iso_code_2_array = tep_db_fetch_array($country_iso_code_2_array_query);
// code pays iso-3166-1 numerique de l adresse de facturation' : variable de test 250 (pour la France)
$pbx_country_fact = getCountryNumericCode($country_iso_code_2_array[0]['countries_iso_code_2'], "250");
$pbx_country_code_mobile_phone = MOBILE_PHONE_COUNTRY_DEFAULT;
$pbx_mobile_phone = MOBILE_PHONE_DEFAULT;
$customer_mobile_phone = $order->customer['telephone'];
$ret_phone = tep_validate_phone($customer_mobile_phone);
$msg = "customer_phone=<" . $customer_mobile_phone . "> ret=<" . $ret_phone['country_code']. ">\n";
$file=fopen("/tmp/msg.txt", "a");
fwrite($file, $msg . "\n");
fclose($file);
if ( $ret_phone['valid'] &&
tep_is_valid_number( $ret_phone['country_code'], 3) &&
tep_is_valid_number( $ret_phone['phone'], 10) )
{
$pbx_country_code_mobile_phone = "+" . $ret_phone['country_code'];
$pbx_mobile_phone = $ret_phone['phone'];
tep_mail('', "vincent@accrosys.com",
"[www.linder-partner.com] - OK validation telephone=<" .(string)$customer_mobile_phone . ">" ,
"pour le client " . (string)$order->customer['email_address'],
STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
else{
tep_mail('', "vincent@accrosys.com",
"[www.linder-partner.com] - erreur validation telephone=<" .(string)$customer_mobile_phone . ">" ,
"pour le client " . (string)$order->customer['email_address'],
STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
//
// --------------- VERIFICATION DU BON FORMAT DES DONNEES (FACULTATIF) -------------
//---------- FONCTION DE SUPPRESSION DES ACCENTS --------
function remove_accents($string) {
if ( !preg_match('/[\x80-\xff]/', $string) )
return $string;
$chars = array(
// Decompositions for Latin-1 Supplement
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
chr(195).chr(191) => 'y',
// Decompositions for Latin Extended-A
chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
);
$string = strtr($string, $chars);
return $string;
}
if($pbx_total > 3000) {
$pbx_souhaitauthent = '01'; // V�rification du montant maximal pour l'exemption 3DS
}
$maxLength = 22; // Longueur maximale de FirstName et LastName
$maxLength2 = 50; // Longueur maximale des champs Address1, Address2 et City
$pbx_prenom_fact = remove_accents($pbx_prenom_fact); // Suppression des accents
$pbx_nom_fact = remove_accents($pbx_nom_fact);
$pbx_adresse1_fact = remove_accents($pbx_adresse1_fact);
$pbx_adresse2_fact = remove_accents($pbx_adresse2_fact);
$pbx_city_fact = remove_accents($pbx_city_fact);
$pbx_prenom_fact = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $pbx_prenom_fact); // Suppression des espaces inutiles
$pbx_nom_fact = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $pbx_nom_fact);
$pbx_adresse1_fact = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $pbx_adresse1_fact);
$pbx_adresse2_fact = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $pbx_adresse2_fact);
$pbx_city_fact = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $pbx_city_fact);
$pbx_country_fact = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $pbx_country_fact);
if (!empty($maxLength) && is_numeric($maxLength) && $maxLength > 0) { // V�rification de la longueur maximale des donn�es
if (function_exists('mb_strlen')) {
$pbx_prenom_fact = mb_substr($pbx_prenom_fact, 0, $maxLength);
}
elseif (strlen($pbx_prenom_fact) > $maxLength) {
$pbx_prenom_fact = substr($pbx_prenom_fact, 0, $maxLength);
}
}
if (!empty($maxLength) && is_numeric($maxLength) && $maxLength > 0) {
if (function_exists('mb_strlen')) {
$pbx_nom_fact = mb_substr($pbx_nom_fact, 0, $maxLength);
}
elseif (strlen($pbx_prenom_fact) > $maxLength) {
$pbx_nom_fact = substr($pbx_nom_fact, 0, $maxLength);
}
}
if (!empty($maxLength2) && is_numeric($maxLength2) && $maxLength2 > 0) {
if (function_exists('mb_strlen')) {
$pbx_adresse1_fact = mb_substr($pbx_adresse1_fact, 0, $maxLength2);
}
elseif (strlen($pbx_adresse1_fact) > $maxLength2) {
$pbx_adresse1_fact = substr($pbx_adresse1_fact, 0, $maxLength2);
}
}
if (!empty($maxLength2) && is_numeric($maxLength2) && $maxLength2 > 0) {
if (function_exists('mb_strlen')) {
$pbx_adresse2_fact = mb_substr($pbx_adresse2_fact, 0, $maxLength2);
}
elseif (strlen($pbx_adresse2_fact) > $maxLength2) {
$pbx_adresse2_fact = substr($pbx_adresse2_fact, 0, $maxLength2);
}
}
if (!empty($maxLength2) && is_numeric($maxLength2) && $maxLength2 > 0) {
if (function_exists('mb_strlen')) {
$pbx_city_fact = mb_substr($pbx_city_fact, 0, $maxLength2);
}
elseif (strlen($pbx_city_fact) > $maxLength2) {
$pbx_city_fact = substr($pbx_city_fact, 0, $maxLength2);
}
}
$pbx_prenom_fact = strtoupper($pbx_prenom_fact);
$pbx_nom_fact = strtoupper($pbx_nom_fact);
$pbx_adresse1_fact = strtoupper($pbx_adresse1_fact);
$pbx_adresse2_fact = strtoupper($pbx_adresse2_fact);
$pbx_city_fact = strtoupper($pbx_city_fact);
$pbx_country_fact = strtoupper($pbx_country_fact);
// --------------- FIN DE VERIFICATION DU BON FORMAT DES DONNEES (FACULTATIF) -------------
//
// Construction de PBX_BILLING :
$pbx_billing = "".$pbx_prenom_fact."".
"".$pbx_nom_fact."".$pbx_adresse1_fact."".
"".$pbx_adresse2_fact."".$pbx_zipcode_fact."".
"".$pbx_city_fact."".$pbx_country_fact."".
"".$pbx_country_code_mobile_phone."".$pbx_mobile_phone."".
"";
//define datas
$msg = "PBX_SITE=" . MODULE_PAYMENT_Etransactions_DIRECT_IDSITE .
"&PBX_RANG=" . MODULE_PAYMENT_Etransactions_DIRECT_RANK .
"&PBX_IDENTIFIANT=" . MODULE_PAYMENT_Etransactions_DIRECT_IDPROFIL .
"&PBX_TOTAL=".$pbx_total.
"&PBX_DEVISE=$pbx_devise" .
"&PBX_CMD=$pbx_cmd" .
"&PBX_PORTEUR=".$pbx_porteur.
"&PBX_REPONDRE_A=".$pbx_repondre_a.
"&PBX_RETOUR=".$pbx_retour.
"&PBX_EFFECTUE=".$pbx_effectue.
"&PBX_ANNULE=".$pbx_annule.
"&PBX_REFUSE=".$pbx_refuse.
"&PBX_HASH=SHA512" .
"&PBX_TIME=$dateTime" .
"&PBX_SHOPPINGCART=".$pbx_shoppingcart.
"&PBX_BILLING=".$pbx_billing.
"&PBX_SOUHAITAUTHENT=".$pbx_souhaitauthent;
$file=fopen("/tmp/msg.txt", "a");
fwrite($file, $msg . "\n");
fclose($file);
//Define hash string
$hmac = Etransactions::getHashKey( $msg, $this->crypto->decrypt(MODULE_PAYMENT_Etransactions_HMACKEY)) ;
?>
enabled == true ) && ( (int) MODULE_PAYMENT_Etransactions_DIRECT_EXPRESS_ZONE > 0 ) ) {
$check_flag = false;
$check_query = tep_db_query( "select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_Etransactions_DIRECT_EXPRESS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id" );
while ( $check = tep_db_fetch_array( $check_query ) ) {
if ( $check['zone_id'] < 1 ) {
$check_flag = true;
break;
} else if ( $check['zone_id'] == $order->delivery['zone_id'] ) {
$check_flag = true;
break;
}
}
if ( $check_flag == false ) {
$this->enabled = false;
}
}
}
/**
* Keys enable for module Etransactions
*
* @return array
*/
public function keys() {
return array( 'MODULE_PAYMENT_Etransactions_DIRECT_STATUS',
'MODULE_PAYMENT_Etransactions_DIRECT_IDSITE',
'MODULE_PAYMENT_Etransactions_DIRECT_RANK',
'MODULE_PAYMENT_Etransactions_DIRECT_IDPROFIL',
'MODULE_PAYMENT_Etransactions_HMACKEY',
'MODULE_PAYMENT_Etransactions_DIRECT_ENVIRONMENT',
'MODULE_PAYMENT_Etransactions_DIRECT_ORDER_STATUS',
'MODULE_PAYMENT_Etransactions_DIRECT_3DSECURE');
}
/**,
'MODULE_PAYMENT_Etransactions_DIRECT_MIN_AMOUNT_3D' */
public function process_button() {
return false;
}
public function before_process() {
return false;
}
public function after_process() {
return false;
}
public function javascript_validation() {
return false;
}
public function check() {
if ( !isset( $this->_check ) ) {
$check_query = tep_db_query( "select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_Etransactions_DIRECT_STATUS'" );
$this->_check = tep_db_num_rows( $check_query );
}
return $this->_check;
}
public function selection() {
return array( 'id' => $this->code,
'module' => tep_image(DIR_WS_ICONS . 'logo_cb_credit_agricole_151x42.png', '', '', '', 'align="left" style="margin-right:7px;"') . $this->public_title . ( strlen( MODULE_PAYMENT_Etransactions_DIRECT_TEXT_PUBLIC_DESCRIPTION ) > 0 ? ' (' . MODULE_PAYMENT_Etransactions_DIRECT_TEXT_PUBLIC_DESCRIPTION . ')' : '' ) );
}
public function get_error() {
global $HTTP_GET_VARS;
if ( isset( $_GET['erreur'] ) && ( strlen( $_GET['erreur'] ) > 0 ) && constant( "MODULE_PAYMENT_Etransactions_DIRECT_CODE_ERROR_" . $_GET['erreur'] ) != NULL ) {
$error = constant( "MODULE_PAYMENT_Etransactions_DIRECT_CODE_ERROR_" . $_GET['erreur'] );
} else {
$error = MODULE_PAYMENT_Etransactions_DIRECT_TEXT_ERROR_MESSAGE;
}
return array( 'title' => MODULE_PAYMENT_Etransactions_DIRECT_TEXT_ERROR,
'error' => $error );
}
}