Can anybody tell me whats wrong here?
I detail for you guys, the two files in cuestion:
protocolo_wondersoft.inc
<?
if (!defined("PROTOCOLOS_TARJETAS_INC_ALREADY_INCLUDED")) {
define("_PROTOCOLOS_TARJETAS_INC_ALREADY_INCLUDED_",1);
class protocolo_wondersoft {
var $tracks; // Como se lee de banda magnetica [C(129)]
var $servicio; // "S" servicio ; "T" validación nro. tarjeta [C(1)]
var $cod_seguridad; // p/ingreso manual (AR, MC, LI) [C(3)]
var $comercio; // Alineado a Izquierda (8 digitos) [C(15)]
var $terminal; // [N(8)]
var $equipo; // Interno del comercio [N(3)]
var $moneda; // 1 pesos; 2 dolares. [N(1)]
var $importe; // '$$$$$$$$$$CC' [N(12,2)]
var $plan_pago; // plan de pago [C(1)]. Ver documentacion para mayor detalle
var $cuotas; // cant. de cuotas ('01','02',etc) [C(2)]
var $ingreso; // 1 automatico; 2 manual. [N(1)]
var $tipo_operacion; // 1 compra, 2 compra combustible... Ver documentacion. [N(1)]
var $anulacion; // 'S' o 'N'. No hay anulacion de tipo_operacion 2 y 9. [N(1)]
var $nro_cupon; // nro. cupon original. [C(8)]
var $fecha_original; // '01/01/00' [C(8)]
var $nro_factura; // 'A00-00000001' [C(12)]
var $nro_tarjeta; // '5323600000009999 ' [C(20)]
var $fecha_vto; // 'AAMM' [C(4)]
var $fecha_compra; // '01/01/00' [C(8)]
var $hora_compra; // 'HHMMSS' [C(6)]
var $nro_ticket; // [C(8)]
var $cod_respuesta; // [C(2)]
var $respuesta; // para visor cajera [C(36)]
var $nro_autorizacion; // [C(6)]
var $nro_trace; // [C(6)]
var $tipo_autorizacion; // 1 sin autorizacion, etc. Ver documentacion [C(1)]
var $nombre_tarjeta; // nombre de la tarjeta [C(30)]
var $operador; // [C(6)]
var $titular; // [C(40)]
var $tel_dir; // [C(40)]
var $tipo_documento; // [C(3)]
var $documento; // [C(10)]
var $fecha_pd; // Fecha posdatada de presentacion [C(8)]
var $cod_seguridad_amex; // (Ingreso manual) [C(4)]
var $cod_tarjeta; // [C(2)]
var $email; // [C(50)]
var $str; // el protocolo en si.
function protocolo_wondersoft () {
// constructor
$this->normalizar();
$this->armar_protocolo();
}
function armar_protocolo() {
// arma el protocolo con cada una de las partes
$this->$str=$this->$tracks.$this->$servicio.$this->$cod_seguridad.$this->$comercio;
$this->$str.=$this->$terminal.$this->$equipo.$this->$moneda.$this->$importe;
$this->$str.=$this->$plan_pago.$this->$cuotas.$this->$ingreso.$this->$tipo_operacion;
$this->$str.=$this->$anulacion.$this->$nro_cupon.$this->$fecha_original.$this->$nro_factura;
$this->$str.=$this->$nro_tarjeta.$this->$fecha_vto.$this->$fecha_compra.$this->$hora_compra;
$this->$str.=$this->$nro_ticket.$this->$cod_respuesta.$this->$respuesta.$this->$nro_autorizacion;
$this->$str.=$this->$nro_trace.$this->$tipo_autorizacion.$this->$nombre_tarjeta.$this->$operador;
$this->$str.=$this->$titular.$this->$tel_dir.$this->$tipo_documento.$this->$documento;
$this->$str.=$this->$fecha_pd.$this->$cod_seguridad_amex.$this->$cod_tarjeta.$this->$email;
}
function normalizar () {
// lleva cada uno de los campos a la longitud normalizada
$this->$tracks=sprintf("% 129s",$this->$tracks);
$this->$servicio=sprintf("% 1s",$this->$servicio);
$this->$cod_seguridad=sprintf("% 3s",$this->$cod_seguridad);
$this->$comercio=sprintf("% 15s",$this->$comercio);
$this->$terminal=sprintf("% 8s",$this->$terminal);
$this->$equipo=sprintf("% 3s",$this->$equipo);
$this->$moneda=sprintf("% 1s",$this->$moneda);
$this->$importe=sprintf("% 12s",$this->$importe);
$this->$plan_pago=sprintf("% 1s",$this->$plan_pago);
$this->$cuotas=sprintf("% 2s",$this->$cuotas);
$this->$ingreso=sprintf("% 1s",$this->$ingreso);
$this->$tipo_operacion=sprintf("% 1s",$this->$tipo_operacion);
$this->$anulacion=sprintf("% 1s",$this->$anulacion);
$this->$nro_cupon=sprintf("% 8s",$this->$nro_cupon);
$this->$fecha_original=sprintf("% 8s",$this->$fecha_original);
$this->$nro_factura=sprintf("% 12s",$this->$nro_factura);
$this->$nro_tarjeta=sprintf("% 20s",$this->$nro_tarjeta);
$this->$fecha_vto=sprintf("% 4s",$this->$fecha_vto);
$this->$fecha_compra=sprintf("% 8s",$this->$fecha_compra);
$this->$hora_compra=sprintf("% 6s",$this->$hora_compra);
$this->$nro_ticket=sprintf("% 8s",$this->$nro_ticket);
$this->$cod_respuesta=sprintf("% 2s",$this->$cod_respuesta);
$this->$respuesta=sprintf("% 36s",$this->$respuesta);
$this->$nro_autorizacion=sprintf("% 6s",$this->$nro_autorizacion);
$this->$nro_trace=sprintf("% 6s",$this->$nro_trace);
$this->$tipo_autorizacion=sprintf("% 1s",$this->$tipo_autorizacion);
$this->$nombre_tarjeta=sprintf("% 30s",$this->$nombre_tarjeta);
$this->$operador=sprintf("% 6s",$this->$operador);
$this->$titular=sprintf("% 40s",$this->$titular);
$this->$tel_dir=sprintf("% 40s",$this->$tel_dir);
$this->$tipo_documento=sprintf("% 3s",$this->$tipo_documento);
$this->$documento=sprintf("% 10s",$this->$documento);
$this->$fecha_pd=sprintf("% 8s",$this->$fecha_pd);
$this->$cod_seguridad_amex=sprintf("% 4s",$this->$cod_seguridad_amex);
$this->$cod_tarjeta=sprintf("% 2s",$this->$cod_tarjeta);
$this->$email=sprintf("% 50s",$this->$email);
}
} // class
} // if (!defined("TARJETAS_INC_ALREADY_INCLUDED...
?>
tarjetas.inc
<?
include("protocolo_wondersoft.inc");
?>
<head>
<title>Prueba de validación de tarjetas on-line</title>
</head>
<body>
<h2>Validación de tarjetas on-line</h2>
<hr>
<br><br><br><br>
<form method=post>
<table border=0>
<tr>
<td>Nro. de tarjeta</td>
<td><input type=text name=nro width="140" value="<?echo $nro ?>"></td>
<td><input type=submit value="go!" name=action></td>
</tr>
</table>
</form>
<hr>
<?
if ($action=="go!") {
$cc=new protocolo_wondersoft();
echo "el largo del campo 1 es ".strlen($cc->tracks)."<br>";
echo "el largo del protocolo en la clase es ".strlen($cc->str)."<br>";
die();
}
?>
</body>
I am sure I must having a conceptual error. Thanks.
Conogol