Update: 2026-07-06 18:23:46

This commit is contained in:
Hamza-Ayed
2026-07-06 18:23:46 +03:00
parent 9d257c5d7d
commit d6ab09c19b
7 changed files with 505 additions and 202 deletions
+19 -1
View File
@@ -120,7 +120,25 @@ try {
// Fixed-price types, Speed & Awfar: use quoted price as-is
$fixedPriceTypes = ['Speed', 'Fixed Price', 'Awfar Car'];
if (in_array($carType, $fixedPriceTypes)) {
$finalPrice = $quotedPrice;
$finalPrice = $quotedPrice; // Fallback if Redis fails
// 🆕 Immutable Fare Lock: Force use of Redis locked price
try {
global $redis;
if ($redis) {
$lockedPrice = $redis->get("ride_locked_price_{$rideId}");
if ($lockedPrice !== false) {
$finalPrice = floatval($lockedPrice);
error_log("[finish_ride_updates] Using Redis Locked Price for ride {$rideId}: {$finalPrice}");
} else {
error_log("[finish_ride_updates] Redis Locked Price not found for ride {$rideId}. Using DB quoted price.");
}
} else {
error_log("[finish_ride_updates] Global Redis instance not available, using DB quoted price.");
}
} catch (Exception $e) {
error_log("[finish_ride_updates] Redis Error (reading locked price): " . $e->getMessage());
}
} else {
// Variable pricing: calculate from actual distance
$cleanDist = preg_replace('/[^0-9.]/', '', $actualDistance);