^^^^; //rilevato che una & nel nome blocca il processo var $descrizione = ''; //univoco a livello di MERCHANT_ID (anche per transazioni non andate a buon fine). //Poiché il Merchant ID di test è condiviso con altri esercenti, si consiglia di includere un prefisso specifico per scongiurare la possibilità di doppioni con test di altri esercenti, ad esempio: ABC00012345. var $identificativo = '';//20 cifre var $lingua = "ita"; //Valuta codice ISO International Standard 4217 (ITL= lire italiane, EUR=Euro) (char 3) var $divisa = "EUR"; var $restart_params = array( "TRANSACTION_ID"=>"", "MERCHANT_ID"=>"", "ORDER_ID"=>"", "COD_AUT"=>"", "IMPORTO"=>"", "DIVISA"=>"", "MAC"=>"" ); function demoInfo(){ return 'In ambiente demo e\' necessario usare importo: 0.01, numero carta: 5255999999999992, tipo: MASTERCARD, scadenza: qualsiasi valida, cifre di controllo: qualsiasi.'; } function auto(){ $this->indiLingua(); if($this->demo){ /* non vanno più $this->abi = '03599'; $this->mid = 'NCHTEST'; $this->key = 'CAE5859549B7F54834040AA110A533A1'; */ $this->abi = '03599'; $this->mid = '405206400002'; $this->key = 'E5D49168DEAA74078B22524B02360B6B'; $this->importo = '0.01';//errore punto voluto! } $this->importo = number_format(str_replace(",", ".", $this->importo), 2, ",", ""); switch($_GET[$this->step_var]){ default: $this->Procedura->iniziato($this->nome_metodo); //^^^^; //rilevato che una & nel nome blocca il processo $ITEMS = $this->identificativo."^". preg_replace("/[^a-z0-9\s]/ims", "", $this->descrizione). "^1^". $this->importo. "^$this->divisa;"; $uid = $this->uniqueID(20); //MAC = MD5(MID + OID + IMP + DIV + ABI + ITEMS + KEY) $MAC = strtoupper(md5($this->mid . $uid . $this->importo . $this->divisa . $this->abi . $ITEMS . $this->key)); //vecchio url: https://www.payment.fccrt.it/CheckOutEGIPSy.asp $form = '
'; if(false&&$this->demo) $form = nl2br($this->Procedura->htmlentities($form)).$form; else $form .= $this->autoSubmitForm('form_pagamento_tnx'); return $form; break; case 'return_ok': return $this->Procedura->concluso(); case 's2s': // $body = ""; // foreach($_GET as $k=>$v) $body .= "\n| $k:\t$v"; // mail("c@localhost", "s2s", $body); // PARAMETRI AGGIUNTI IN GET DALLA BANCA: // • Identificativo univoco della transazione (TRANSACTION_ID) // • Identificativo del Merchant (MERCHANT_ID). // • Identificativo dell’ordine (ORDER_ID). // • Codice di autorizzazione restituito dalla procedura POS (COD_AUT). // • Importo dell’ordine (IMPORTO). // • Divisa (DIVISA). // • Codice di controllo dell’integrità (MAC). // $_GET: // Array // ( // [p] => pagamento // [l] => ita // [code] => bc5ee79dc32dcb9697c3a28b7929d2aa // [ok] => 1 // [TRANSACTION_ID] => 194C5AAC41504753A54DD76824CB7C75 // [MERCHANT_ID] => NCHTEST // [ORDER_ID] => bc5ee79dc32dcb9697c3a28b7929d2aa // [COD_AUT] => TESTOK // [IMPORTO] => 0,01 // [DIVISA] => EUR // [MAC] => 132E2FB756D07E434AA5099421CCAE8C // ) // MAC = MD5(TID + MID + OID + AUT + IMP + DIV + KEY) $MAC = strtoupper(md5($_GET["TRANSACTION_ID"] . $this->mid . $_GET["ORDER_ID"] . $_GET["COD_AUT"] . $this->importo . $this->divisa . $this->key)); $internal_id = $this->identificativoFromUniqueID($_GET['ORDER_ID']); if($_SERVER['REMOTE_ADDR'] == '192.168.0.177' || $_GET['debugtnx']){ echo '
';
					$debugBacktrace = debug_backtrace(); array_unshift($debugBacktrace, array('file'=>__FILE__, 'line'=>__LINE__, 'function'=>'debugTnx')); foreach($debugBacktrace as $debugLine) echo "".str_replace("/tnx/www/html/www/", "", $debugLine['file']).""." ".$debugLine['function']."()
"; $printMe = $internal_id; ob_start(); if(is_object($printMe)||is_array($printMe)) print_r($printMe); else var_dump($printMe); echo htmlentities(ob_get_clean(), ENT_COMPAT|ENT_HTML401|ENT_SUBSTITUTE, 'UTF-8'); echo '
'; die; } if($MAC == $_GET["MAC"]){ //questo url viene chiamato solo per pagamenti andati a buon fine $this->Procedura->comunicazione_s2s($internal_id, $_GET['COD_AUT']); $this->Procedura->confermato($internal_id); return $this->Procedura->concluso(); } else{ $body = "ERRORE VERIFICA FIRMA DELLA COMUNICAZIONE S2S"; foreach($_GET as $k=>$v) $body .= "\n| $k:\t$v"; $this->Procedura->comunicazione_s2s($internal_id, $body); $body .= "\nhttp://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI] " . date ("d-M-Y H:i:s", mktime()) . " " . __FILE__ . " " . __LINE__; $body .= "\n\n" . print_r(array('$_GET'=>$_GET, '$_POST'=>$_POST, '$_SERVER'=>$_SERVER, '$_SESSION'=>$_SESSION), TRUE); mail("carlo@tnx.it", "ERRORE S2S ".$this->nome_metodo, $body); return $this->Procedura->errore($res['COD_AUT']); } return ''; case 'return_ko': return $this->Procedura->annulla(); case 'error': return $this->Procedura->errore(); } } function indiLingua(){ switch($GLOBALS['DATI']["lang"]) { case "ita": $this->lingua = "ita"; break; case "fra": $this->lingua = "fra"; break; case "spa": $this->lingua = "spa"; break; case "ger": $this->lingua = "ted"; break; default: $this->lingua = "ing"; break; } } } ?>