Viewing file: request.php (2.48 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/** * DESCRIZIONE PARAMETRI OBBLIGATORI * NOME Obb. Formato Descrizione alias SI 1-30 chars Codice identificativo del negozio (valore fisso comunicato da Key Client spa nella fase di attivazione definitiva) importo SI 1-7 chars importo da autorizzare espresso in centesimi di euro senza sparatore, i primi 2 numeri a destra rappresentano gli euro cent, es.: 5000 corrisponde a 50,00 € divisa SI 3 chars Il codice della divisa in cui l’importo è espresso (EUR = Euro) codTrans SI 1-30 chars codice di identificazione del pagamento composto da caratteri alfanumerici, escluso il carattere #. Il codice dev’essere univoco per ogni richiesta di autorizzazione, solo in caso di esito negativodell’autorizzazione il merchant può riproporre la stessa richiesta con medesimo codTrans per altre 2volte, in fase di configurazione l’esercente può scegliere di diminuire i 3 tentativi. url_back SI max 200 chars Url ritorno con parametri di pagamento mac SI 40 chars Message Code Authentication (vedi capitolo 8)
*/
filter_var($_REQUEST["Email"], FILTER_SANITIZE_EMAIL); filter_var($_REQUEST["Documento"], FILTER_SANITIZE_STRING);
$identificativo_codice_trans= "WTK"; $alias = "payment_testm_urlmac"; $divisa = "EUR"; $url_complete_transaction = "http://www.essebinet.com/pagamento/esito.php"; $mac_key = "esempiodicalcolomac";
/* DA QUI IN POI NON MODIFICARE */
$email = $_REQUEST["Email"];
$codTrans = $identificativo_codice_trans."-".$_REQUEST["Documento"]; $codTrans = preg_replace('|[^A-Za-z0-9]|', '_', $codTrans); $codTrans = substr($codTrans,0,30);
$importo = $_REQUEST["Importo"]; $importo = (int) (floatval($importo)*100);
$payment_baseurl = "https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet?"; //alias=valore&importo=5000&divisa=EUR&codTrans=990101-00001&mail=xxx@xxxx.it&url=http://www.xxxxx.it&session_id=xxxxxxxx&mac=yyyy&languageId=ITA
$params = array();
$params[0] = "alias=".$alias.""; $params[1] = "importo=".$importo.""; $params[2] = "divisa=".$divisa.""; $params[3] = "codTrans=".$codTrans.""; $params[4] = "mail=".$email.""; $params[5] = "url=".$url_complete_transaction."";
$mac = $params[3].$params[2].$params[1].$mac_key; $mac = sha1($mac);
$params[6] = "mac=".$mac."";
$payment_baseurl .= implode('&',$params);
$response['url'] = $payment_baseurl;
echo json_encode($response);
|