import { createRefIdPlugin } from "../../../plugins/refIdToConfirmationNumber" import { safeProtectedServiceProcedure } from "../../../procedures" import { priceChange } from "../../../services/booking/priceChange" const refIdPlugin = createRefIdPlugin() export const priceChangeRoute = safeProtectedServiceProcedure .concat(refIdPlugin.toConfirmationNumber) .use(async ({ ctx, next }) => { const token = await ctx.getScandicUserToken() return next({ ctx: { token, }, }) }) .mutation(async function ({ ctx }) { const { confirmationNumber } = ctx return await priceChange( { confirmationNumber }, ctx.token ?? ctx.serviceToken ) })