export type OrderStatusDetail = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; export type CreateApiPaymentApiV2OrderTransactionIdCancelStatusDetailArgs = {transactionId: string, statusDetail: OrderStatusDetail, Authorization: string, MerchantId?: string | undefined}; export type CreateApiPaymentApiV2OrderTransactionIdCancelStatusDetailOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /payment-api/v2/order/{transactionId}/cancel/{statusDetail} */ export const createApiPaymentApiV2OrderTransactionIdCancelStatusDetail = async (args: CreateApiPaymentApiV2OrderTransactionIdCancelStatusDetailArgs, options: CreateApiPaymentApiV2OrderTransactionIdCancelStatusDetailOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args.MerchantId != null) headers.set("MerchantId", String(args.MerchantId)) const url = `${baseUrl.replace(/\/+$/, '')}/payment-api/v2/order/${encodeURIComponent(String(args.transactionId))}/cancel/${encodeURIComponent(String(args.statusDetail))}${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 undefined };