export type DeleteApiV1MarketplaceCheckoutIdArgs = {establishment_id: string, 'integration-key': string, 'x-token': string, id: string}; export type DeleteApiV1MarketplaceCheckoutIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancelar smart checkout * * DELETE /v1/marketplace/checkout/{id} */ export const deleteApiV1MarketplaceCheckoutId = async (args: DeleteApiV1MarketplaceCheckoutIdArgs, options?: DeleteApiV1MarketplaceCheckoutIdOptions) => { const {baseUrl = "https://api.sandbox.paytime.com.br", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.establishment_id != null) headers.set("establishment_id", String(args.establishment_id)) if (args['integration-key'] != null) headers.set("integration-key", String(args['integration-key'])) if (args['x-token'] != null) headers.set("x-token", String(args['x-token'])) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/marketplace/checkout/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };