export type CreateApiApiV2PaymentKcpApproveArgs = {request: {[key: string]: string}}; export type CreateApiApiV2PaymentKcpApproveOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Approval Kcp Order * * POST /api/v2/payment/kcp/approve */ export const createApiApiV2PaymentKcpApprove = async (args: CreateApiApiV2PaymentKcpApproveArgs, options?: CreateApiApiV2PaymentKcpApproveOptions) => { const {baseUrl = "https://api.wincl.io:443", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.request != null) query.append("request", JSON.stringify(args.request)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/payment/kcp/approve${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };