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:
@@ -194,7 +194,7 @@ const deposit: FastifyPluginAsync = async (fastify) => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ── POST /api/hotels/:slug/bookings/:bookingId/deposit/release ────────────
|
// ── 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',
|
'/api/hotels/:slug/bookings/:bookingId/deposit/release',
|
||||||
{ onRequest: [fastify.authenticate] },
|
{ onRequest: [fastify.authenticate] },
|
||||||
async (request, reply) => {
|
async (request, reply) => {
|
||||||
@@ -205,7 +205,7 @@ const deposit: FastifyPluginAsync = async (fastify) => {
|
|||||||
const hotelId = await getHotelId(slug)
|
const hotelId = await getHotelId(slug)
|
||||||
if (!hotelId) return reply.code(404).send({ error: 'Hotel not found' })
|
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
|
// Get active deposit
|
||||||
const { rows: depRows } = await db.query(
|
const { rows: depRows } = await db.query(
|
||||||
|
|||||||
Reference in New Issue
Block a user