export type ReleaseSettlementQueueEntries = {action?: 'RELEASE' | undefined, ids?: Array | undefined}; export type UpdateApiSettlementQueueEntriesArgs = {body: ReleaseSettlementQueueEntries}; export type UpdateApiSettlementQueueEntriesOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Release Settlement Queue Entries * * PUT /settlement_queue_entries */ export const updateApiSettlementQueueEntries = async (args: UpdateApiSettlementQueueEntriesArgs, options?: UpdateApiSettlementQueueEntriesOptions) => { 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 (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/settlement_queue_entries${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 };