feat: add location intelligence engine and E2E simulation script

This commit is contained in:
Hamza-Ayed
2026-07-18 19:08:52 +03:00
parent a15e65c42e
commit fef1235fc9
14 changed files with 539 additions and 3 deletions
+7 -2
View File
@@ -5,6 +5,7 @@ export interface QuoteInput {
durationMin: number;
waitingMin?: number;
at?: Date; // لحظة الحساب (لاختيار النافذة الزمنية)
geofenceMultiplier?: number;
}
export interface QuoteBreakdown {
@@ -58,9 +59,13 @@ export class TariffEngine {
const surgeMultiplier =
def.surge?.enabled && def.surge.multiplier ? def.surge.multiplier : 1;
let total = subtotal * surgeMultiplier;
if (def.min_fare && total < def.min_fare) total = def.min_fare;
const geofenceMultiplier = input.geofenceMultiplier ?? 1.0;
const finalMultiplier = surgeMultiplier * geofenceMultiplier;
subtotal *= finalMultiplier;
let total = Math.max(def.min_fare ?? 0, subtotal);
total = TariffEngine.round(total, def.rounding);
return {