Add business pricing and closure controls with compatible digest optimization

This commit is contained in:
Takeshi
2026-09-09 12:04:12 +09:00
parent 071e338e82
commit b3b82ef03e
35 changed files with 2203 additions and 59 deletions
+4 -4
View File
@@ -170,7 +170,7 @@ func _run_service_sale_with_round_trip() -> void:
var active: Array = _runtime.facility_service.get_active_services(_facility_id)
_expect(active.size() == 1, "facility queue fills an available service slot")
var service_id: StringName = active[0].service_id
_expect(active[0].price_snapshot == 35 and active[0].duration_minutes == 3, "service freezes quoted price and duration")
_expect(active[0].price_snapshot == 25 and active[0].duration_minutes == 3, "service freezes quoted price and duration")
var mid_snapshot: Dictionary = _runtime.create_snapshot()
var mid_digest := SimulationDigest.compute(mid_snapshot)
@@ -178,9 +178,9 @@ func _run_service_sale_with_round_trip() -> void:
var completed: ServiceInstance = _runtime.facility_service.get_service(service_id)
_expect(completed != null and completed.state == ServiceInstance.State.COMPLETED, "three active minutes complete the service")
_expect(_runtime.inventory_service.total_quantity(_facility_inventory_id, &"ingredient/basic_meal") == 1, "completion consumes exactly one reserved ingredient")
_expect(_runtime.economy_service.get_balance(&"GUEST_WALLET:guest_1") == 65, "guest pays the immutable quoted price")
_expect(_runtime.economy_service.get_balance(&"PLAYER_CASH") == 4235, "service cash sweep increases player Gold")
_expect(_state.get_resource(&"gold") == 4235, "UI Gold mirror follows the ledger transaction")
_expect(_runtime.economy_service.get_balance(&"GUEST_WALLET:guest_1") == 75, "guest pays the immutable quoted price")
_expect(_runtime.economy_service.get_balance(&"PLAYER_CASH") == 4225, "service cash sweep increases player Gold")
_expect(_state.get_resource(&"gold") == 4225, "UI Gold mirror follows the ledger transaction")
_expect(_runtime.economy_service.validate_ledger()[&"ok"], "service sale remains double-entry balanced")
var saw_completion := false
for event in _runtime.domain_events.recent_events():