Files
citas-getter/services_real.js
cc-ultrav-1 7da1dbe0fd Smoke-test verified booking stack v1.3.1 — live API flow confirmed
Full end-to-end smoke test against live cita API (194.179.69.48:443):
  - TLS pre-connect: 415ms, TCP_NODELAY set, connection reused
  - getHorasCitas: 200, 9 slots returned
  - Booking 15:15: 200, 'Fecha posterior' (expected pre-midnight)
  - Skew retry 43ms x5: verified retry stack
  - Post-verify: slot still free, no accidental citas
  - TLS tunnel reuse PROVEN: same fd (3), same port (53880), only 1 TCP conn in ss

Fixes in this commit:
  - Fixed 3 stale comments referencing old 200ms skew retry delay (now 43ms)
    (lines 276, 295, 372) — line 351 kept as intentional comparison
  - All 56 tests pass

Changes:
  - book_final.py: comment fixes (lines 276, 295, 351, 372)
  - test_book_final.py: unchanged (40 tests)
  - test_connection_reuse.py: unchanged (16 tests)
2026-10-03 19:30:03 +02:00

223 lines
8.5 KiB
JavaScript

angular.module('CitaPreviaAlicante.services', []).
factory('citaPreviaServices', function ($http){
var serviciosCitas = {};
serviciosCitas.obtenerIp = function (){
return $http({
method: "GET",
url: "https://ipinfo.io/"
});
};
serviciosCitas.obtenerServicio = function (idServicio){
return $http({
method: "GET",
url: url_base + '/ScServicioVo1/'+idServicio+'/'
})
};
serviciosCitas.anularCita = function (idServicio, idCola, nif, idCita){
/*var idServicio = codigo.substring(0,1);
var idCola = codigo.substring(1,2);*/
/*return $http({
method: "POST",
url: url_base+'/ScCitaVo1',
data: {'name':'anularCitaInsertada',
'parameters':[{"servicio" : ""+idServicio+""},
{"cola": ""+idCola+""},
{"documento": ""+nif+""}]},
headers:{
'Content-type':'application/vnd.oracle.adf.action+json'
}
});*/
return $http({
method: "POST",
url: url_base+'/ScCitaVo1',
data: {'name':'anularCitaInsertadaCodigo',
'parameters':[{"servicio" : ""+idServicio+""},
{"cola": ""+idCola+""},
{"documento": ""+nif+""},
{"codigoCita": ""+idCita.substring(2)+""}]},
headers:{
'Content-type':'application/vnd.oracle.adf.action+json'
}
});
};
serviciosCitas.consultarCita = function (tipoDoc, nif, codigo, tipoBusqueda){
var idServicio = codigo.substring(0,1).toUpperCase( );
var idCola = codigo.substring(1,2).toUpperCase( );
if(tipoBusqueda == 'NEW') {
return $http({
method: "POST",
url: url_base+'/ScCitaVo1',
data: {'name':'obtenerCitaInsertadaCodigo',
'parameters':[{"servicio" : ""+idServicio+""},
{"cola": ""+idCola+""},
{"documento": ""+nif+""},
{"codigoCita": ""+codigo.substring(2)+""}]},
headers:{
'Content-type':'application/vnd.oracle.adf.action+json'
}
});
} else {
return $http({
method: "POST",
url: url_base+'/ScCitaVo1',
data: {'name':'obtenerCitaInsertada',
'parameters':[{"servicio" : ""+idServicio+""},
{"cola": ""+idCola+""},
{"documento": ""+nif+""}]},
headers:{
'Content-type':'application/vnd.oracle.adf.action+json'
}
});
}
};
serviciosCitas.insertarCitaPrevia = function (resumen, colamotivo, procedencia){
if (procedencia == undefined) {
procedencia = 'NULO'
}
/*if (colamotivo != 'S'){
// resumen.comentario = '';
};*/
/*if (resumen.email == undefined || resumen.email == ''){*/
if (resumen.id_servicio != 'L') {
resumen.impuestos = 'N'
}else{
if (resumen.impuestos == ''){
resumen.impuestos = 'N'
}
};
var ahora = new Date();
var cadenaHora = ahora.getHours() + ':' + ahora.getMinutes() + ':' + ahora.getSeconds();
return $http({
method: "POST",
url: url_base+'/ScCitaVo1',
data: {'name':'insertarCitaPrevia',
'parameters':[{"servicio":""+resumen.id_servicio+""},
{"cola":""+resumen.id_gestion+""},
{"fecha":""+resumen.fecha+""},
{"hora":""+resumen.hora+""},
{"documento":""+resumen.num_documento+""},
{"ip":""+resumen.ip+""},
{"nombre":""+resumen.nombre+""},
{"apellido1":""+resumen.primer_apellido+""},
{"apellido2":""+resumen.segundo_apellido+""},
{"tipo":""+resumen.tipo_documento+""},
{"telefono":""+resumen.telefono+""},
{"email":""+resumen.email+""},
{"impuestos":""+resumen.impuestos+""},
{"motivo":""+cadenaHora+' '+resumen.comentario+""},
{"procedencia":""+procedencia+""},
]
},
headers:{
'Content-type':'application/vnd.oracle.adf.action+json'
}
});
}
serviciosCitas.obtenerCitasDisponible = function (servicio, cola, fecha){
/*servicio = 'E';
cola='C';
fecha='24-05-2018'*/;
return $http({
method: "POST",
url: url_base+'/ScCitaVo1',
data: {'name':'getHorasCitas',
'parameters':[{"servicio":""+servicio+""},
{"cola":""+cola+""},
{"fecha":""+fecha+""}]},
headers:{
'Content-type':'application/vnd.oracle.adf.action+json'
}
});
};
serviciosCitas.obtenerCitasEjemplo = function (servicio, cola, fecha){
var horas = ["08:30","09:00","09:30","10:00","10:30","11:00","11:30","12:00","12:30","13:00","13:30","14:00","14:30"];
return horas;
}
serviciosCitas.obtenerTipoDocumento = function (){
return $http({
method: "GET",
//url: url_base + '/ScTipoDocumentoVo1'
url: url_base + '/ScTipoDocumentoVo1?limit=99'
})
}
serviciosCitas.getServicios = function () {
return $http({
method: "GET",
//url: url_base + '/ScServicioVo1'
//url: url_base + '/ScServicioVo1?limit=99'
url: url_base + '/ScServicioFiltrado1?limit=99'
});
};
serviciosCitas.getGestiones = function (idServicio) {
//window.alert("SERVICIO: ->" + idServicio + "<-");
//if (idServicio!="") {
if (idServicio!="" && idServicio!=null) {
return $http({
method: "GET",
//url: url_base+'/ScServicioVo1/'+idServicio+'/child/ScColaVo'
url: url_base+'/ScServicioVo1/'+idServicio+'/child/ScColaVo?limit=99'
});
}else{
return [];
}
};
serviciosCitas.echo = function (tipoDoc, nif, codigo){
return $http({
method: "POST",
url: url_base+'/ScServicioVo1',
data: {'name':'echo',
'parameters':[{'mensaje':'holaaaa'}]},
headers:{
'Content-type':'application/vnd.oracle.adf.action+json'
}
});
};
return serviciosCitas;
});
angular.module('F1FeederApp.services', []).
factory('ergastAPIservice', function($http) {
var ergastAPI = {};
ergastAPI.getDrivers = function() {
return $http({
method: 'JSONP',
url: 'http://ergast.com/api/f1/2013/driverStandings.json?callback=JSON_CALLBACK'
});
}
ergastAPI.getDriverDetails = function(id) {
return $http({
method: 'JSONP',
url: 'http://ergast.com/api/f1/2013/drivers/'+ id +'/driverStandings.json?callback=JSON_CALLBACK'
});
}
ergastAPI.getDriverRaces = function(id) {
return $http({
method: 'JSONP',
url: 'http://ergast.com/api/f1/2013/drivers/'+ id +'/results.json?callback=JSON_CALLBACK'
});
}
return ergastAPI;
});