export type StripeApproveRequest = {checkoutSessionId?: string | undefined, orderId?: string | undefined, totalPaymentCent?: number | undefined}; export type CreateApiApiV2PaymentStripeApproveArgs = {body: StripeApproveRequest}; export type CreateApiApiV2PaymentStripeApproveOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Approve Stripe Payment * * POST /api/v2/payment/stripe/approve */ export const createApiApiV2PaymentStripeApprove = async (args: CreateApiApiV2PaymentStripeApproveArgs, options?: CreateApiApiV2PaymentStripeApproveOptions) => { 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/stripe/approve${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() };