fix: corrections build - _showOverlay supprime, passageDate Ulys ajoute, withValues deprecation

This commit is contained in:
ElPoyo
2026-06-04 14:32:03 +02:00
parent e14b333a67
commit 1bf5c8061f
6 changed files with 30 additions and 14 deletions
+2
View File
@@ -7,3 +7,5 @@ SMTP_PASS="aL8@Rx8xqFrNij$a"
# URL de l'application
APP_URL="https://app.em2events.fr"
API_MAPS="AIzaSyDt2d-T9YRmHO3-QEq1uWomdqVbJqXfO04"
+24 -9
View File
@@ -72,11 +72,13 @@ async function getUlysTollLegs(encodedPolyline) {
// ─────────────────────────────────────────────
async function getUlysRate(vehicleCategory, passages) {
try {
const now = new Date().toISOString();
const payload = {
vehicleCategory: String(vehicleCategory),
paymentOption: 2,
tollPassages: passages.map((p) => ({
toll: { operatorId: p.operatorId, tollId: p.tollId },
passageDate: now,
})),
};
const body = JSON.stringify(payload);
@@ -119,17 +121,30 @@ async function calculateTollCost(encodedPolyline, vehicleCategory) {
const tollGates = [];
for (const feature of legsData.features) {
const props = feature.properties || {};
const id = props.id_gare || props.id || props.gareId;
if (id && id.length >= 5) {
tollGates.push({
id,
operatorId: id.substring(0, 2),
tollId: id.substring(2, 5),
name: props.nom || props.name || id,
});
}
// La réponse Ulys peut utiliser différents noms de champs
// On cherche l'identifiant de la gare dans tous les champs connus
const id =
props.id_gare ||
props.idGare ||
props.id ||
props.gareId ||
props.gare_id ||
props.tollStationId;
if (!id) continue;
const idStr = String(id);
if (idStr.length < 5) continue;
tollGates.push({
id: idStr,
operatorId: idStr.substring(0, 2),
tollId: idStr.substring(2, 5),
name: props.nom || props.name || props.label || idStr,
});
}
logger.info(`[Travel] Ulys /legs found ${tollGates.length} toll gates`);
if (tollGates.length === 0) return 0;
// Greedy: trouver les segments fermés + barrières ouvertes