export type CreateApiBapiV2PaymentPurchaseIdCancelArgs = {purchaseId: string}; export type CreateApiBapiV2PaymentPurchaseIdCancelOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * 사용자가 이미 구매한 배출권 환불하기 * * POST /bapi/v2/payment/{purchaseId}/cancel */ export const createApiBapiV2PaymentPurchaseIdCancel = async (args: CreateApiBapiV2PaymentPurchaseIdCancelArgs, options?: CreateApiBapiV2PaymentPurchaseIdCancelOptions) => { const {baseUrl = "https://api.wincl.io:443", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/bapi/v2/payment/${encodeURIComponent(String(args.purchaseId))}/cancel${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() };