Index: www-lp/www/includes/modules/payment/Etransactions_direct.php
===================================================================
diff -u -r4 -r26
--- www-lp/www/includes/modules/payment/Etransactions_direct.php (.../Etransactions_direct.php) (revision 4)
+++ www-lp/www/includes/modules/payment/Etransactions_direct.php (.../Etransactions_direct.php) (revision 26)
@@ -3,6 +3,69 @@
include_once realpath( dirname( __FILE__ ) ) . "/../../../ext/modules/payment/Etransactions/Etransactions.php";
include_once realpath( dirname( __FILE__ ) ) . "/../../EtransactionsEncrypt.php";
+define('MOBILE_PHONE_COUNTRY_DEFAULT', '+33');
+define('MOBILE_PHONE_DEFAULT', '0672756926');
+
+function getCountryNumericCode($alpha2Code, $default) {
+ $countryCodes = array(
+ "AD"=>"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
*/
@@ -117,9 +180,12 @@
// vd: --> redirect confirmation to checkout_process
$this->form_action_url = null;
if ( MODULE_PAYMENT_Etransactions_DIRECT_ENVIRONMENT == "Production" ) {
- $this->form_action_url_redirect = 'https://tpeweb.e-transactions.fr/cgi/MYchoix_pagepaiement.cgi';
+ // 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://preprod-tpeweb.e-transactions.fr/cgi/MYchoix_pagepaiement.cgi';
+ $this->form_action_url_redirect = "https://recette-tpeweb.e-transactions.fr/php/";
}
if ( is_object( $order ) ) {
@@ -217,77 +283,333 @@
//Detect mobile
if ( $this->Etransactions->is_mobile() ) {
if ( MODULE_PAYMENT_Etransactions_DIRECT_ENVIRONMENT == "Production" ) {
- $this->form_action_url_redirect = "https://tpeweb.e-transactions.fr/cgi/ChoixPaiementMobile.cgi";
+ $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://preprod-tpeweb.e-transactions.fr/cgi/ChoixPaiementMobile.cgi";
+ $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
- $currencyPbx = Etransactions::getCurrency( $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
- $secure3d = "";
- if ( !$this->enabled_3d || ( MODULE_PAYMENT_Etransactions_DIRECT_MIN_AMOUNT_3D != "" && $order->info['total'] < MODULE_PAYMENT_Etransactions_DIRECT_MIN_AMOUNT_3D ) ) {
- $secure3d = "&PBX_3DS=N";
- }
-
- //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);
+ $pbx_souhaitauthent="01"; // variable de test authentification 3DS (01 par defaut, 02 pour exemption 3DS)
- //17.11.2017 TPHILIPPS : cause pb de paiement si total > 1000E
- //if($precision>0)$tmp_total = money_format('%'.$precision.'n',$tmp_total);
+ // 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."";
- $total = Etransactions::getTotal( $tmp_total );
-
+ // 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=" . $total .
- "&PBX_DEVISE=$currencyPbx" .
- "&PBX_LANGUE=$langue_pbx" .
- "&PBX_CMD=$orderid" .
- "&PBX_PORTEUR=" . $order->customer['email_address'] .
- "&PBX_RETOUR=" . Etransactions::getPbxRetour() .
+ "&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_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 ) .
"&PBX_TIME=$dateTime" .
- $secure3d .
- "&PBX_EFFECTUE=" . PBX_Etransactions_EFFECTUE.
- "&PBX_REPONDRE_A=" . tep_href_link( "Etransactions_ipn.php" );
+ "&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)) ;
?>