fix: corrections build - _showOverlay supprime, passageDate Ulys ajoute, withValues deprecation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user