export type PaymentReserveRequest = {orderChannel?: ('MOBILE' | 'PC') | undefined, orderId?: string | undefined, relayed?: boolean | undefined, returnUrl?: string | undefined}; export type CreateApiApiV2PaymentKcpReserveArgs = {body: PaymentReserveRequest}; export type CreateApiApiV2PaymentKcpReserveOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reserve KCP Order * * POST /api/v2/payment/kcp/reserve */ export const createApiApiV2PaymentKcpReserve = async (args: CreateApiApiV2PaymentKcpReserveArgs, options?: CreateApiApiV2PaymentKcpReserveOptions) => { const {baseUrl = "https://api.wincl.io:443", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/payment/kcp/reserve${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };