export type GetApiV1MarketplaceTransactionsIdReceiptReversalArgs = {'integration-key': string, 'x-token': string, id: string}; export type GetApiV1MarketplaceTransactionsIdReceiptReversalOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Comprovante de cancelamento * * GET /v1/marketplace/transactions/{id}/receipt/reversal */ export const getApiV1MarketplaceTransactionsIdReceiptReversal = async (args: GetApiV1MarketplaceTransactionsIdReceiptReversalArgs, options?: GetApiV1MarketplaceTransactionsIdReceiptReversalOptions) => { const {baseUrl = "https://api.sandbox.paytime.com.br", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") 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/transactions/${encodeURIComponent(String(args.id))}/receipt/reversal${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };