cambios de desarrollo
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
include("mysql.php");
|
||||
|
||||
$id_viaje = $_POST['id_viaje'];
|
||||
$n_proveedor = $_POST['n_proveedor'];
|
||||
$usuario = $_POST['usuario'];
|
||||
$id_estado = $_POST['id_estado'];
|
||||
$incidencia = $_POST['incidencia'];
|
||||
$latitud = $_POST['latitud'];
|
||||
$longitud = $_POST['longitud'];
|
||||
$nombre = $_POST['nombre'] . '.jpg';
|
||||
|
||||
if ($nombre == "vacio.jpg") {
|
||||
$nombre = NULL;
|
||||
}
|
||||
|
||||
$consulta = "SELECT count(*) from c_cambios_estado where id_viaje='" . $id_viaje . "' and id_estado='" . $id_estado . "' and foto='" . $nombre . "'";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $consulta) or fatal_error('MySQL Error: ' . mysqli_errno($gaSql['link']));
|
||||
$fila = mysqli_fetch_row($rResult2);
|
||||
$duplicado = $fila[0];
|
||||
|
||||
if ($duplicado > 0) {
|
||||
echo json_encode("0");
|
||||
die();
|
||||
}
|
||||
|
||||
$sQuery2 = "UPDATE c_viajes SET id_estado = $id_estado, ind_edi_app = 1 WHERE id_viaje = $id_viaje";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $sQuery2) or fatal_error('MySQL Error: ' . mysqli_errno($gaSql['link']));
|
||||
|
||||
$sQuery2 = "INSERT INTO c_cambios_estado (id_viaje, n_proveedor, id_transportista, id_estado, incidencia, latitud, longitud, fecha_y_hora, foto) VALUES ('" . $id_viaje . "','" . $n_proveedor . "','" . $usuario . "','" . $id_estado . "','" . $incidencia . "','" . $latitud . "','" . $longitud . "',NOW(),'" . $nombre . "')";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $sQuery2) or fatal_error('MySQL Error: ' . mysqli_errno($gaSql['link']));
|
||||
|
||||
$consulta = "SELECT id_viaje_padre, id_cliente, cod_viaje from c_viajes where id_viaje='" . $id_viaje . "'";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $consulta) or fatal_error('MySQL Error: ' . mysqli_errno($gaSql['link']));
|
||||
$fila = mysqli_fetch_row($rResult2);
|
||||
$id_viaje_padre = $fila[0];
|
||||
$id_cliente = $fila[1];
|
||||
$cod_viaje = $fila[2];
|
||||
|
||||
while ($id_viaje_padre > 0) {
|
||||
$consulta = "UPDATE `c_viajes` SET id_estado='" . $id_estado . "', ind_edi_app = 1 where id_viaje='" . $id_viaje_padre . "'";
|
||||
$query_res = mysqli_query($gaSql['link'], $consulta);
|
||||
|
||||
$consulta = "INSERT INTO c_cambios_estado (id_viaje, n_proveedor, id_transportista, id_estado, incidencia, latitud, longitud, fecha_y_hora, foto) VALUES ('" . $id_viaje . "','" . $n_proveedor . "','" . $usuario . "','" . $id_estado . "','" . $incidencia . "','" . $latitud . "','" . $longitud . "',NOW(),'" . $nombre . "')";
|
||||
$query_res = mysqli_query($gaSql['link'], $consulta);
|
||||
|
||||
//vover consultar para ver si se sale del bucle
|
||||
$consulta = "SELECT id_viaje_padre, id_cr from c_viajes where id_viaje='" . $id_viaje_padre . "'";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $consulta) or fatal_error('MySQL Error: ' . mysqli_errno($gaSql['link']));
|
||||
$fila = mysqli_fetch_row($rResult2);
|
||||
$id_viaje_padre = $fila[0];
|
||||
}
|
||||
|
||||
$resultado = "0";
|
||||
|
||||
$consulta = "SELECT html FROM html_correo WHERE id_mensaje = 34";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $consulta);
|
||||
$fila = mysqli_fetch_row($rResult2);
|
||||
$mensaje = $fila[0];
|
||||
|
||||
$consulta = "SELECT user_smtp_admin, user_smtp_admin, pass_smtp_admin, host_smtp, puerto_smtp, date_format(NOW(), '%Y-%m-%d_%H_%i_%s') as ahora, email_operaciones FROM m_cr WHERE id_cr = $cr";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $consulta);
|
||||
$fila = mysqli_fetch_row($rResult2);
|
||||
$email_operaciones = $fila[0];
|
||||
$user_smtp = $fila[1];
|
||||
$pass_smtp = $fila[2];
|
||||
$host_smtp = $fila[3];
|
||||
$puerto_smtp = $fila[4];
|
||||
$ahora = $fila[5];
|
||||
$email_operaciones = $fila[6];
|
||||
|
||||
$consulta = "SELECT estado FROM t_viaje_estados WHERE id_estado = $id_estado";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $consulta);
|
||||
$fila = mysqli_fetch_row($rResult2);
|
||||
$estado = $fila[0];
|
||||
|
||||
if (strlen($user_smtp) > 4 && strlen($pass_smtp) > 4 && strlen($host_smtp) > 4) {
|
||||
|
||||
$mail = new PHPMailer();
|
||||
$mail->IsSMTP();
|
||||
$mail->From = $user_smtp;
|
||||
$mail->FromName = "Abian Service";
|
||||
|
||||
$html = '<br>Se ha cambiado el estado del viaje ' . $cod_viaje . ' a ' . $estado . ' mediante la APP';
|
||||
|
||||
$mail->AddAddress($email_operaciones);
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Host = $host_smtp;
|
||||
$mail->Port = $puerto_smtp;
|
||||
$mail->Username = $user_smtp;
|
||||
$mail->Password = $pass_smtp;
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$mail->Subject = "Facturas pendientes Abian Service";
|
||||
$mail->Body = $mensaje . "<br>" . $html;
|
||||
$mail->IsHTML(true);
|
||||
$mail->SMTPDebug = 0;
|
||||
|
||||
if ($mail->Send()) {
|
||||
echo json_encode("0");
|
||||
} else {
|
||||
echo json_encode("Error al enviar el correo");
|
||||
}
|
||||
|
||||
} else {
|
||||
echo json_encode("Error al enviar el correo: fallo con usuario/contraseña");
|
||||
}
|
||||
|
||||
if ($id_cliente == 532) {
|
||||
$consulta = "SELECT id_tipovehiculo AS matricula FROM c_viajes_proveedor WHERE id_viaje = $id_viaje AND n_proveedor = $n_proveedor";
|
||||
$rResult2 = mysqli_query($gaSql['link'], $consulta) or fatal_error('MySQL Error: ' . mysqli_errno($gaSql['link']));
|
||||
$fila = mysqli_fetch_row($rResult2);
|
||||
$matricula = $fila[0];
|
||||
|
||||
$xml = '
|
||||
<S:Envelope
|
||||
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<SOAP-ENV:Header/>
|
||||
<S:Body>
|
||||
<ns2:SubmitPosition xmlns="http://schemas.datacontract.org/2004/07/QESE.QFV.Classes.QAP"
|
||||
xmlns:ns2="QESE.QFV.QAP" xmlns:ns3="http://schemas.datacontract.org/2004/07/System"
|
||||
xmlns:ns4="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
|
||||
xmlns:ns5="http://schemas.datacontract.org/2004/07/QESE.QFV.Classes"
|
||||
xmlns:ns6="http://schemas.datacontract.org/2004/07/FV.Enums"
|
||||
xmlns:ns7="http://schemas.datacontract.org/2004/07/FV.Enums.DriverHours"
|
||||
xmlns:ns8="http://schemas.microsoft.com/2003/10/Serialization/">
|
||||
<ns2:credentials>
|
||||
<Client>abian</Client>
|
||||
<Password>TVwuW57u0^</Password>
|
||||
<UserName>abian-5567</UserName>
|
||||
<Version>1</Version>
|
||||
</ns2:credentials>
|
||||
<ns2:positions>
|
||||
<Position>
|
||||
<AssetCategory>1</AssetCategory>
|
||||
<CID>5567</CID>
|
||||
<CustomerName/>
|
||||
<DT>
|
||||
<ns3:DateTime>?fecha_hora?</ns3:DateTime>
|
||||
<ns3:OffsetMinutes>0</ns3:OffsetMinutes>
|
||||
</DT>
|
||||
<DeviceType>14</DeviceType>
|
||||
<From>' . $matricula . '</From>
|
||||
<GatewayMsgId/>
|
||||
<IdentifierType>12</IdentifierType>
|
||||
<MSISDN>' . $matricula . '</MSISDN>
|
||||
<RequestId>1</RequestId>
|
||||
<Version>1</Version>
|
||||
<Latitude>?latitud?</Latitude>
|
||||
<Longitude>?longitud?</Longitude>
|
||||
</Position>
|
||||
</ns2:positions>
|
||||
</ns2:SubmitPosition>
|
||||
</S:Body>
|
||||
</S:Envelope>';
|
||||
|
||||
$url = 'https://export.fleetvisor.eu/wsQAP/Positions.svc/ssl';
|
||||
$str = date("Y-m-d");
|
||||
$strb = date("H:i:s");
|
||||
|
||||
$fecha_hora = $str . "T" . $strb . "Z";
|
||||
|
||||
$xml = str_replace("?fecha_hora?", $fecha_hora, $xml);
|
||||
$xml = str_replace("?latitud?", $latitud, $xml);
|
||||
$xml = str_replace("?longitud?", $longitud, $xml);
|
||||
|
||||
//echo $xml;
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$headers = array(
|
||||
"Content-Type: text/xml",
|
||||
"SOAPAction: QESE.QFV.QAP/PositionsService/SubmitPosition"
|
||||
);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
$data = $xml;
|
||||
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
|
||||
$resp = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
echo json_encode($resultado);
|
||||
?>
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
|
||||
|
||||
Dear Gorka,
|
||||
thanks for your reply!
|
||||
|
||||
We have a standard API that we provide openly - please see the attached documentation for more details.
|
||||
The attached document also includes the URL and apikey for our TEST instance.
|
||||
|
||||
- endpoint URL for test and production
|
||||
|
||||
PROD URL: https://push-dhl.agheera.com/Telematics/positions
|
||||
apiKey for Abian: 2NL7G-0QTMP-T0N54-7ERGY-S7U6U-SXKWF
|
||||
TEST URL: https://push-test.agheera.com/Telematics/Positions
|
||||
apiKey for testing purposes: 0eec610a-aad5-4f60-91c7-7f9a4089d5b5
|
||||
|
||||
- authentication method and credentials process
|
||||
Authentication is done by sending an apikey in a HTTP header "apiKey" with each request.
|
||||
There is no further handshake (oauth flow or similar). If the apikey is correct and accepted, data will be assigned to the customer (in this case Abian)
|
||||
Apikey is provided by Agheera on request.
|
||||
1 Apikey is bound to 1 customer and 1 environment (prod/test).
|
||||
|
||||
- required payload format
|
||||
Please see attached documentation for more details.
|
||||
We encourage to send data batches whenever possible.
|
||||
|
||||
- required vehicle identifier: license plate, device ID, MSISDN, etc.
|
||||
Device ID and License Plate shall both be provided
|
||||
|
||||
- timestamp format/timezone
|
||||
Must be in UTC timezone
|
||||
Format: yyyy-MM-ddTHH:mm:ssZ
|
||||
|
||||
- required fields for position updates
|
||||
Minimum required are: latitude, longitude, vehicleid(deviceid), licensePlate, measurementTime
|
||||
We appreciate the following fields to have better Trip ETA calculation: speed, direction, assetType
|
||||
|
||||
- expected response codes
|
||||
200 - OK
|
||||
If data was accepted and was syntactically correct
|
||||
400 - Bad request
|
||||
If data was syntactically wrong/malformed
|
||||
401 - Unauthorized
|
||||
Wrong apikey or apikey header missing
|
||||
405 - Method not available
|
||||
If request method was not POST
|
||||
|
||||
- retry/error handling recommendations
|
||||
We are not validating the semantics of position data at the point of response generation, so we return 200 - OK on almost all requests unless the request is badly malformed or unauthorized.
|
||||
This also means a retry is not very likely needed, unless the Agheera server is down.
|
||||
For sending position data to us, it is fine to "fire and forget" and not schedule a retry.
|
||||
In case you notice any errors, please contact ops@agheera.com and we will investigate.
|
||||
|
||||
- whether positions should be sent only for active DHL trips/customer id 532 or for all authorized vehicles
|
||||
Agheera does already filter the data so that DHL can only see data that is relevant for DHL trips.
|
||||
So as far as we are concerned, you can send for all vehicles, and we will filter it anyway.
|
||||
But I think this should be decided by ABIAN if they want this.
|
||||
|
||||
- any IP allowlist requirements
|
||||
No IP whitelist in place. We do not need to know your IPs upfront.
|
||||
|
||||
|
||||
Let me know if you have any open questions!
|
||||
|
||||
Kind Regards / Freundliche Grüße
|
||||
Stephan Wahlen
|
||||
Head of IoT Hardware
|
||||
Agheera GmbH – a DHL Group company
|
||||
|
||||
stephan.wahlen@agheera.com
|
||||
+49 2203 29757-23
|
||||
Office: August-Horch-Straße 5, 51149 Köln
|
||||
Warehouse: Kasinostraße 24, 53840 Troisdorf, Deutschland
|
||||
Registered office Cologne; Register court Bonn; HRB 18111
|
||||
VAT ID no. DE 273 231 181
|
||||
Managing Directors: Pierre Lynch, Sven Kefferpütz
|
||||
|
||||
|
||||
|
||||
-----Ursprüngliche Nachricht-----
|
||||
Von: Gorka Leceta <gleceta@roganet.es>
|
||||
Gesendet: Donnerstag, 28. Mai 2026 11:52
|
||||
An: Operations <ops@agheera.com>; Stephan Wahlen <stephan.wahlen@agheera.com>
|
||||
Betreff: ABIAN SERVICE - Agheera Push API documentation request for GPS position integration
|
||||
|
||||
Hello Stephan / Agheera team,
|
||||
|
||||
We are Roganet, GPS provider for ABIAN SERVICE.
|
||||
|
||||
ABIAN has asked us to integrate active position pushing from their mobile app backend to Agheera for DHL transports.
|
||||
|
||||
Could you please send us the technical documentation for Agheera's push API?
|
||||
|
||||
We need:
|
||||
- endpoint URL for test and production
|
||||
- authentication method and credentials process
|
||||
- required payload format
|
||||
- required vehicle identifier: license plate, device ID, MSISDN, etc.
|
||||
- timestamp format/timezone
|
||||
- required fields for position updates
|
||||
- expected response codes
|
||||
- retry/error handling recommendations
|
||||
- whether positions should be sent only for active DHL trips/customer id
|
||||
532 or for all authorized vehicles
|
||||
- any IP allowlist requirements
|
||||
|
||||
ABIAN registration was submitted on 2024-01-23 and the authorization document is AFTemplateV2-ABIAN SERVICE_2024-01-23T11_55_17Z.PDF.
|
||||
|
||||
Kind regards
|
||||
|
||||
Reference in New Issue
Block a user