15/01/2014, 10:44
|
| | Fecha de Ingreso: enero-2014 Ubicación: Sabadell
Mensajes: 12
Antigüedad: 10 años, 10 meses Puntos: 0 | |
Respuesta: Problema al ejecutar acción PHP automáticamente con setTimeout (jQuery) Este es el código completo de conexión al TPV.
<?PHP
function ShowError () {
echo "<html><head><title>Results</title></head><body><table width=100% height=50%><tr><td><p><h2><center>Compruebe que todos los datos del formulario son correctos!!</center></h2></p></td></tr></table></body></html>\n";
} # End of function ShowError
function ShowForm ($amount,$currency,$producto) {
// Posted data
global $HTTP_POST_VARS;
// Valores constantes del comercio
$url_tpvv='https://sis-t.redsys.es:25443/sis/realizarPago';
$clave='XXXXXXXXXXXXXXX';
$name='XXXXXXXXXXXXXX';
$code='XXXXXXXXXXXXXX';
$terminal='1';
$order=date('ymdHis');
$amount= $_POST["cantidad"]*100;
$currency='978';
$transactionType='0';
$urlMerchant='';
$producto='Donacion';
// Now, print the HTML script
echo "
<script language=JavaScript>
function calc() {
vent=window.open('','tpv','width=725,height=600,sc rollbars=no,resizable=yes,status=yes,menubar=no,lo cation=no');
document.forms[0].submit();}
</script>
<body bgcolor=white >
<style>
a{text-decoration:none}
</style>
<form name=compra action=$url_tpvv method=post target=tpv>
";
echo "</td>
</tr><tr><td>
<input type=hidden name=Ds_Merchant_Amount value='$amount'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_Currency value='$currency'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_Order value='$order'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_MerchantCode value='$code'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_Terminal value='$terminal'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_TransactionType value='$transactionType'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_MerchantURL value='$urlMerchant'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_UrlOK value='$urlOK'>
</td></tr><tr><td>
<input type=hidden name=Ds_Merchant_UrlKO value='$urlKO'>
</td></tr><tr><td>";
// Compute hash to sign form data
// $signature=sha1_hex($amount,$order,$code,$currency ,$clave);
$message = $amount.$order.$code.$currency.$transactionType.$u rlMerchant.$clave;
$signature = strtoupper(sha1($message));
echo "<input type=hidden name=Ds_Merchant_MerchantSignature value='$signature'>
</td></tr>
<script languange=JavaScript>
setTimeout(calc,1000);
</script>
</form>
</body>
";
} # End of function ShowForm
?> |