From c081ab5c74053a31bb6f19f30fc6cbc3919d8c15 Mon Sep 17 00:00:00 2001 From: HotelSync Date: Fri, 27 Mar 2026 16:20:36 +0300 Subject: [PATCH] feat: configurable DTO login/password per KKT device - Equipment page: add login/password fields in KKT fiscal mode form - Stored in device config JSON (dto_user, dto_pass) - Backend passes credentials to agent in test_device command - Agent uses per-device credentials for all ATOL DTO API calls Co-Authored-By: Claude Sonnet 4.6 --- backend/src/routes/workstations.ts | 2 ++ src/pages/EquipmentPage.tsx | 44 ++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/backend/src/routes/workstations.ts b/backend/src/routes/workstations.ts index e7b7ed2..0824a65 100644 --- a/backend/src/routes/workstations.ts +++ b/backend/src/routes/workstations.ts @@ -300,6 +300,8 @@ const workstationRoutes: FastifyPluginAsync = async (fastify) => { com_port: device.com_port, fiscal_mode: device.fiscal_mode, dto_port: device.dto_port, + dto_user: device.config?.dto_user, + dto_pass: device.config?.dto_pass, }, }) as { ok: boolean; error?: string; message?: string } return result diff --git a/src/pages/EquipmentPage.tsx b/src/pages/EquipmentPage.tsx index 8c58358..4ead7c5 100644 --- a/src/pages/EquipmentPage.tsx +++ b/src/pages/EquipmentPage.tsx @@ -201,6 +201,8 @@ function DeviceForm({ const [purpose, setPurpose] = useState(initial?.purpose ?? 'receipt') const [fiscalMode, setFiscalMode] = useState(initial?.fiscalMode !== false) const [dtoPort, setDtoPort] = useState(String(initial?.dtoPort ?? 16732)) + const [dtoUser, setDtoUser] = useState(String(initial?.config?.dto_user ?? '30')) + const [dtoPass, setDtoPass] = useState(String(initial?.config?.dto_pass ?? '30')) const [saving, setSaving] = useState(false) const [availablePorts, setAvailablePorts] = useState<{ port: string; description?: string }[] | null>(null) const [portsLoading, setPortsLoading] = useState(false) @@ -228,6 +230,7 @@ function DeviceForm({ purpose: purpose as WorkstationDevice['purpose'], fiscalMode: type === 'kkt' ? fiscalMode : undefined, dtoPort: type === 'kkt' && fiscalMode ? Number(dtoPort) : undefined, + config: type === 'kkt' && fiscalMode ? { dto_user: dtoUser, dto_pass: dtoPass } : undefined, }) setSaving(false) } @@ -291,15 +294,38 @@ function DeviceForm({ {fiscalMode && ( -
- - setDtoPort(e.target.value)} - className="w-32 input text-sm font-mono" - placeholder="16732" - /> -

Порт АТОЛ ДТО 10 (по умолчанию 16732). Для нескольких касс — разные порты.

+
+
+ + setDtoPort(e.target.value)} + className="w-32 input text-sm font-mono" + placeholder="16732" + /> +

По умолчанию 16732. Для нескольких касс — разные порты.

+
+
+
+ + setDtoUser(e.target.value)} + className="w-full input text-sm" + placeholder="30" + /> +
+
+ + setDtoPass(e.target.value)} + className="w-full input text-sm" + placeholder="30" + /> +
+
)}