export type EdubankTransactionBankSlipDto = {description?: string | undefined, bank_slip_link?: ('PDF' | 'HTML') | undefined}; export type CreateApiV1TransactionsTransactionIdBankSlipArgs = {transaction_id: string, body: EdubankTransactionBankSlipDto}; export type CreateApiV1TransactionsTransactionIdBankSlipOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Generate bank slip for payment * * POST /v1/transactions/{transaction_id}/bank-slip * * Also accepts auth: authorization, authorization */ export const createApiV1TransactionsTransactionIdBankSlip = async (args: CreateApiV1TransactionsTransactionIdBankSlipArgs, options: CreateApiV1TransactionsTransactionIdBankSlipOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/transactions/${encodeURIComponent(String(args.transaction_id))}/bank-slip${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };