Add Bird gate call flow unit tests, self-serve machine wash minutes config, relay sync improvements, and OpenAPI updates. Refactor Bird call handling with terminal status detection and timeout normalization.

This commit is contained in:
Jeppe Bundgaard
2026-03-26 13:16:18 +01:00
parent a4654398d0
commit 95063d2a70
20 changed files with 731 additions and 77 deletions
@@ -124,7 +124,14 @@ class moduleSelfServeRoute
return date('Y-m-d H:i:s', $wash_start_time);
};
$included_minutes_when_machine_enabled = 20;
$selfserve = new selfserve();
$included_minutes_when_machine_enabled = (int)$selfserve
->config
->machine_wash_minutes_included
->getVariableValue();
if ($included_minutes_when_machine_enabled < 0) {
$included_minutes_when_machine_enabled = 0;
}
$rows = (new selfserve_wash_sessions_o())->getFieldsWhere([
'lane_id' => $lane_id,
@@ -141,7 +148,6 @@ class moduleSelfServeRoute
}
if ($session === null) {
$selfserve = new selfserve();
$lane = $selfserve->lane($lane_id);
$lane_status = $lane->getLaneStatus();
$lane_state = $lane->getLaneState();
@@ -316,6 +322,15 @@ class moduleSelfServeRoute
'customer_number' => $lane->getCustomerNumber(),
]);
} catch (\Exception $e) {
if (
$command === selfserve_lane_command::OPEN_PROPERTY_ACCESS_GATE ||
$command === selfserve_lane_command::OPEN_PROPERTY_EXIT_GATE
) {
error_log(
'Failed to execute self-serve property gate command ' . $command->name .
' for lane ' . $lane_id . ': ' . $e->getMessage()
);
}
$response->error("Failed to execute command: " . $e->getMessage());
}
},
@@ -416,7 +431,8 @@ class moduleSelfServeRoute
'state' => $lane->getLaneState()->name,
]);
} catch (\Exception $e) {
$response->error('Failed to open lane gate: ' . $e->getMessage(), 400);
error_log('Failed to open self-serve lane gate ' . $gate->name . ' for lane ' . $lane_id . ': ' . $e->getMessage());
$response->error('Failed to open ' . strtolower($gate->name) . ' gate.', 400);
}
}, [
'modules_selfserve_lane_gate_open' => 'Open ENTRANCE or EXIT gate for a self-serve lane'