export type Channel = string; export type SellerId = string; export type CancelReason = 'BUYER_CANCELLED' | 'UNDELIVERABLE_TO_SHIPPING_ADDRESS' | 'UNDELIVERABLE_BY_CARRIER' | 'OUT_OF_STOCK' | 'DELAYED_INVENTORY' | 'PRICING_ERROR' | 'OTHER'; export type OrderAccept = {orderList?: (Array<{channel: Channel, sellerId: SellerId, orderId: string, orderAccepted?: boolean | undefined, reason?: CancelReason | undefined}>) | undefined}; export type UpdateApiV1SellerOrderAcceptArgs = {body: OrderAccept}; export type UpdateApiV1SellerOrderAcceptOptions = {baseUrl?: string | undefined, SellerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Order Confirm * * * PUT /v1/seller/order/accept */ export const updateApiV1SellerOrderAccept = async (args: UpdateApiV1SellerOrderAcceptArgs, options?: UpdateApiV1SellerOrderAcceptOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, SellerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (SellerAuth !== undefined) headers.set('authorization', `Bearer ${SellerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/seller/order/accept${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 undefined };