indiLingua(); if($this->demo){ $this->clientId = 'b97f298ae19b4cbe9414aebd53c712ce';//sandbox portamia (da' errore) $redirectUri = $this->Procedura->genera_link_agg(array($this->step_var=>"oauth-callback")); $redirectUri = substr($redirectUri, 0, -1);//hanno sbagliato a inserirlo $this->clientId = '6e0dbfc6dd534faf8c54f8bc7a13b0d7';//sandbox test generica $redirectUri = 'http://nowhere.edenred.net/oauth-callback'; } $this->importo = number_format(str_replace(",", ".", $this->importo), 2, ",", ""); switch($_GET[$this->step_var]){ default: $this->Procedura->iniziato($this->nome_metodo); if($this->demo){ $url = "https://sso.auth-sandbox.api.edenred.com/idsrv/connect/authorize"; } else{ die("manca url produzione"); } $this->Procedura->redirect($url."?response_type=code&client_id=".$this->clientId."&scope=openid%20edg-xp-mealdelivery-api%20offline_access&redirect_uri=".$redirectUri."&state=abc123&nonce=456azerty&acr_values=tenant:it-ben&ui_locales=it-IT"); // $this->Procedura->redirect($url."?response_type=code&client_id=b97f298ae19b4cbe9414aebd53c712ce&scope=openid%20edg-xp-mealdelivery-api%20offline_access&redirect_uri=https://demo.tnx.it/base/it/test-pagamenti/metodo:edenred/step:oauth-callback &state=abc123&nonce=456azerty&acr_values=tenant%3Ait-ben&ui_locales=it-IT"); // funzion, preso da doc online // $this->Procedura->redirect($url."?response_type=code&client_id=6e0dbfc6dd534faf8c54f8bc7a13b0d7&scope=openid%20edg-xp-mealdelivery-api&redirect_uri=http://nowhere.edenred.net/oauth-callback&state=abc123&nonce=456azerty&acr_values=tenant:it-ben&ui_locales=it-IT"); break; break; case 'return_ok': return $this->Procedura->concluso(); break; case 's2s': /* $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", "S2S", $body); */ $params = $_GET; foreach($params as $k=>$v){ $params[$k] = stripslashes($v); } $identificativo = $this->identificativoFromUniqueID($_GET['ORDERID']); if($this->mac($params, 'in') == $_GET["MAC"]){ $results = array( "00" => "Success", "01" => "Denied by system", "02" => "Denied due to store configuration issues", "03" => "Denied due to communication issues with the authorization circuits", "04" => "Denied by card issuer", "05" => "Denied due to incorrect card number", "06" => "Unforeseen error during processing of request", "07" => "Duplicated order", ); $this->Procedura->comunicazione_s2s($identificativo, $results[$params["RESULT"]]." TRANSACTIONID: ".$params["TRANSACTIONID"]); if($params["RESULT"] == "00"){ $this->Procedura->confermato($identificativo); } else{ $body = ''; foreach($params as $k=>$v) $body .= "\n| $k:\t$v"; $this->Procedura->comunicazione_s2s($identificativo, $body); } } else{ $body = "ERRORE VERIFICA FIRMA DELLA COMUNICAZIONE S2S"; foreach($params as $k=>$v) $body .= "\n| $k:\t$v"; $this->Procedura->comunicazione_s2s($identificativo?$identificativo:$this->identificativo, $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); } $this->pulisciOutput(); die(); case 'return_ko': return $this->Procedura->annulla(); break; // case 'error': // return $this->Procedura->errore(); // break; // case 'uncertain': // return $this->Procedura->incerto(); // break; } } // function indiLingua(){ // switch($GLOBALS['DATI']["lang"]) { // case "ita": // $this->lingua = "ITA"; // break; // default: // $this->lingua = "EN"; // break; // } // } } ?>