fix: deposit release — read captured_amount (snake_case) from request body

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 12:38:43 +03:00
parent a4fc4a0972
commit 633625e7be

View File

@@ -194,7 +194,7 @@ const deposit: FastifyPluginAsync = async (fastify) => {
)
// ── POST /api/hotels/:slug/bookings/:bookingId/deposit/release ────────────
fastify.post<SlugBookingParam & { Body: { capturedAmount: number; reason?: string } }>(
fastify.post<SlugBookingParam & { Body: { captured_amount: number; reason?: string } }>(
'/api/hotels/:slug/bookings/:bookingId/deposit/release',
{ onRequest: [fastify.authenticate] },
async (request, reply) => {
@@ -205,7 +205,7 @@ const deposit: FastifyPluginAsync = async (fastify) => {
const hotelId = await getHotelId(slug)
if (!hotelId) return reply.code(404).send({ error: 'Hotel not found' })
const { capturedAmount, reason } = request.body
const { captured_amount: capturedAmount, reason } = request.body
// Get active deposit
const { rows: depRows } = await db.query(