export type GetApiPaymentOrdersPaymentOrderIdReversalsArgs = {payment_order_id: string, after_cursor?: string | undefined, per_page?: number | undefined}; export type GetApiPaymentOrdersPaymentOrderIdReversalsOptions = {baseUrl?: string | undefined, sec0?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * List Reversals * * GET /payment_orders/{payment_order_id}/reversals */ export const getApiPaymentOrdersPaymentOrderIdReversals = async (args: GetApiPaymentOrdersPaymentOrderIdReversalsArgs, options?: GetApiPaymentOrdersPaymentOrderIdReversalsOptions) => { const {baseUrl = "https://app.moderntreasury.com/api", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.after_cursor != null) query.append("after_cursor", String(args.after_cursor)) if (args.per_page != null) query.append("per_page", String(args.per_page)) if (sec0 !== undefined) headers.set('authorization', `Basic ${btoa(`${sec0.username}:${sec0.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/payment_orders/${encodeURIComponent(String(args.payment_order_id))}/reversals${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 undefined };