export type BankBilletPayObject = {paid_amount: number, paid_at: string, bank_rate?: (string | null) | undefined, direct_payment?: (boolean | null) | undefined}; export type UpdateApiV1BankBilletsIdPayArgs = {'User-Agent'?: string | undefined, 'X-Idempotency-Key'?: string | undefined, id: string, body: BankBilletPayObject}; export type UpdateApiV1BankBilletsIdPayOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Marcar Boleto Como Pago * * PUT /v1/bank_billets/{id}/pay */ export const updateApiV1BankBilletsIdPay = async (args: UpdateApiV1BankBilletsIdPayArgs, options?: UpdateApiV1BankBilletsIdPayOptions) => { const {baseUrl = "https://api-sandbox.kobana.com.br", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) if (args['X-Idempotency-Key'] != null) headers.set("X-Idempotency-Key", String(args['X-Idempotency-Key'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/bank_billets/${encodeURIComponent(String(args.id))}/pay${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 };