Files
web/server/routers/booking/output.ts
Tobias Johansson 740419bad2 Merged in feat/SW-459-payment-flow-ui-ux (pull request #657)
Feat/SW-459 payment flow ui ux

* feat(SW-431): List payment methods and handle booking status and redirection

* feat(SW-431): small fix

* fix(SW-431): Added intl string and sorted dictionaries

* fix(SW-431): add todo comments

* feat(SW-459): Added payment method icons

* feat(SW-459): refactored into new component and added form

* feat(SW-459): Localized strings

* feat(SW-459): added checkbox

* feat(SW-459): Refactored payment options and updated payment form

* feat(SW-459): update input bg color

* feat(SW-459): add current web links and style fixes

* fix(SW-459): fix issue with booking confirmation not being accessible

* feat(SW-459): style changes

* feat(SW-459): update max width of payment container

* feat(SW-459): update create booking schema

* feat(SW-459): fixes from PR


Approved-by: Arvid Norlin
2024-10-10 12:20:41 +00:00

36 lines
1015 B
TypeScript

import { z } from "zod"
export const createBookingSchema = z
.object({
data: z.object({
attributes: z.object({
confirmationNumber: z.string(),
cancellationNumber: z.string().nullable(),
reservationStatus: z.string(),
paymentUrl: z.string().nullable(),
metadata: z.any(), // TODO: define metadata schema (not sure what it does)
}),
type: z.string(),
id: z.string(),
links: z.object({
self: z.object({
href: z.string().url(),
meta: z.object({
method: z.string(),
}),
}),
}),
}),
})
.transform((d) => ({
id: d.data.id,
links: d.data.links,
type: d.data.type,
confirmationNumber: d.data.attributes.confirmationNumber,
cancellationNumber: d.data.attributes.cancellationNumber,
reservationStatus: d.data.attributes.reservationStatus,
paymentUrl: d.data.attributes.paymentUrl,
}))
type CreateBookingData = z.infer<typeof createBookingSchema>