From 32115399eee0ced689a05e24dd48a38d05fa085b Mon Sep 17 00:00:00 2001 From: HotelSync Date: Thu, 19 Mar 2026 12:40:52 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20reservation=5Fid:=20numeric=20string=20vi?= =?UTF-8?q?a=20hex=E2=86=92decimal=20UUID=20conversion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/routes/netup.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/routes/netup.ts b/backend/src/routes/netup.ts index 0090e8a..3e7115e 100644 --- a/backend/src/routes/netup.ts +++ b/backend/src/routes/netup.ts @@ -318,7 +318,7 @@ const netup: FastifyPluginAsync = async (fastify) => { if (!room) return reply.code(404).send({ error: 'Room not found' }) const result = await notifyNetupCheckinInternal( - hotelId, room_id, room.number, 'Тестовый гость', 'TEST-' + room.number, + hotelId, room_id, room.number, 'Тестовый гость', '99999999', ) if (result.ok) return { ok: true, message: `Check-in отправлен в NetUP (номер ${result.netupRoom})` } return reply.code(502).send({ error: result.error ?? 'Ошибка' }) @@ -368,8 +368,10 @@ async function notifyNetupCheckinInternal( const url = `${base}/mw/api/hotel-room/${encodeURIComponent(mapping.netup_room_number)}/check-in` const cred = Buffer.from(`${cfg.username}:${cfg.password}`).toString('base64') - // NetUP expects reservation_id as a string - const requestBody = { reservation_id: reservationId, name: guestName, language: language ?? cfg.default_language } + // NetUP expects reservation_id as a numeric string (parses with strconv.Atoi) + // Convert UUID to a stable numeric string by taking first 8 hex chars → decimal + const resIdStr = String(parseInt(reservationId.replace(/-/g, '').slice(0, 8), 16) % 100000000) + const requestBody = { reservation_id: resIdStr, name: guestName, language: language ?? cfg.default_language } try { const res = await fetch(url, {