Foros del Web » Programando para Internet » PHP »

problema recogiendo valores tpv la caixa

Estas en el tema de problema recogiendo valores tpv la caixa en el foro de PHP en Foros del Web. Hola a todos Espero que podáis ayudarme... Estoy configurando una pasarela de pago la caixa, y tras realizar el pago, recojo los datos introducidos y ...
  #1 (permalink)  
Antiguo 25/02/2014, 02:55
Avatar de garciasanchezdani  
Fecha de Ingreso: noviembre-2011
Mensajes: 429
Antigüedad: 12 años, 5 meses
Puntos: 51
problema recogiendo valores tpv la caixa

Hola a todos
Espero que podáis ayudarme...
Estoy configurando una pasarela de pago la caixa, y tras realizar el pago, recojo los datos introducidos y los envío por mail para notificación (post). El caso es que no recibo nada, los parámetros recibidos no tienen valores...

Este es el fichero que envía los datos (form):

Código PHP:
<!--
    File:         form.php
    Function:     Exemplary Web Form Script!  
                  Better diagnostics!  Combines
                  form-display (if no input) 
                  and result-processing.
    Author:       Jose Lopez, <[email protected]>
    Date:         27 June 2001
  
    Outline:
       Set up necessary output and some variables.
       If there was input, then
             call subroutine interpret_inputs.
       Otherwise, call subroutine show_form.
       Exit.
       Subroutine interpret_inputs  validates the
         inputs, and if they're ok, calls subroutine
         mail_results to save the results via email.
-->

<HTML>
<HEAD>
  <TITLE>PhP Form Example</TITLE>
</HEAD>
<BODY>

<?PHP
// If form is submitted with all required data then show the form
// else show error page
empty($Formulario) ?                            
      
ShowForm($Ds_Merchant_Amount,$Ds_Merchant_Currency,$prod) :
      
ShowError();
exit;
?>

<?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.sermepa.es:25443/sis/realizarPago';
$clave='qwertyasdf0123456789';
$name='Comercio Pruebas';
$code='999008881';
$terminal='4';
$order=date('ymdHis');
$amount='25';
$currency='978';
$transactionType='0';
$urlMerchant='http://www.sermepa.es';
$producto='Zapatos';

// Now, print the HTML script
echo "<html><head><title>Comercio Simulador</title></head>
<script language=JavaScript>
function calc() { 
vent=window.open('','tpv','width=725,height=600,scrollbars=no,resizable=yes,status=yes,menubar=no,location=no');
document.forms[0].submit();}
</script>
<body bgcolor=white>
<form name=compra action=$url_tpvv method=post target=tpv>
<pre>
<table>
<tr><td>
<h2>Comercio de prueba.</h2>
</td></tr><tr><td>
Comercio: <font color=blue>$name</font>
</td></tr><tr><td>
FUC: <font color=blue>$code</font>
</td></tr><tr><td>
Terminal: <font color=blue>$terminal</font>
</td></tr><tr><td>
Pedido: <font color=blue>$order</font>
</td></tr><tr><td>
Producto: <font color=blue>$producto</font>
</td></tr><tr><td>
Importe: <font color=blue>$amount</font>
</td></tr><tr><td>
Tipo de Operacion: <font color=blue>$transactionType (Autorización)</font>
</td></tr><tr><td>
URL del comercio: <font color=blue>$urlMerchant</font>
</td></tr><tr><td>"
;

// Currency strings 
if ($currency == "978") {
    echo 
"Moneda: <font color=blue>Euros</font>";
}

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>"
;

// Compute hash to sign form data
// $signature=sha1_hex($amount,$order,$code,$currency,$clave);
$message $amount.$order.$code.$currency.$transactionType.$urlMerchant.$clave;
$signature strtoupper(sha1($message));

echo 
"<input type=hidden name=Ds_Merchant_MerchantSignature value='$signature'>
</td></tr>
</table>
<center><a href='javascript:calc()'><img src='/tpvirtual.jpg' border=0 ALT='TPV Virtual'></a></center>
</pre>
</form>                                          
</body></html>"
;
# End of function ShowForm
?>
Este es mi fichero que recoge los parámetros y envía el mail:

Código PHP:
<?php

$to 
'[email protected]';    //mail destinatario
$subject 'Resumen pedido panel piedra';    //asunto mail

$body '<p>Compra realizada correctamente en panel piedra.</p>';    //cuerpo del mensaje
$body .= '<p>Resumen del pedido:</p>';
$body .= '<p><strong>Producto: </strong> '.htmlspecialchars($_POST['Ds_Merchant_Producto']).'</p>';
$body .= '<p><strong>Importe: </strong> '.htmlspecialchars($_POST['Ds_Merchant_Amount']).'</p>';
$body .= '<p><strong>Pedido: </strong> '.htmlspecialchars($_POST['Ds_Merchant_Order']).'</p>';

$headers 'From: Daniel Garcia'."\r\n";    //remitente
$headers .= 'Reply-To: [email protected]'."\r\n";
$headers .= 'Return-Path: [email protected]'."\r\n";
$headers .= 'X-Mailer: PHP5'."\n";
$headers .= 'MIME-Version: 1.0'."\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";

mail($to$subject$body$headers);    //se envía mail

?>

No sé qué puede estar fallando......
Un saludo, Daniel
__________________
Diseño Web Jaén

Etiquetas: caixa, formulario, html, tpv, variable
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:16.