export type RemoveSettlementEntries = {settlement_entry_ids?: Array | undefined}; export type DeleteApiSettlementsSettlementIdEntriesArgs = {'Finix-Version'?: string | undefined, body: RemoveSettlementEntries}; export type DeleteApiSettlementsSettlementIdEntriesOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete Settlement Entries * * DELETE /settlements/{settlement_id}/entries */ export const deleteApiSettlementsSettlementIdEntries = async (args: DeleteApiSettlementsSettlementIdEntriesArgs, options?: DeleteApiSettlementsSettlementIdEntriesOptions) => { const {baseUrl = "https://finix.sandbox-payments-api.com", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Finix-Version'] != null) headers.set("Finix-Version", String(args['Finix-Version'])) if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/settlements/${encodeURIComponent(String(args.settlement_id))}/entries${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };