export type FieldAssignments = Array<{field_id: string, field_value_id: string}>; export type CurrencyCode = string; export type RoundedMonetaryAmount = {amount: string, currency: CurrencyCode}; export type CashMatchFxAmount = {amount: RoundedMonetaryAmount, rate: string}; export type CashMatchQuickEntryLine = {side: 'DEBIT' | 'CREDIT', account_id: string, amount: RoundedMonetaryAmount, fx_amount?: CashMatchFxAmount | undefined, description?: string | undefined, fields?: FieldAssignments | undefined}; export type MatchBankTransactionsQuickEntryRequest = {transaction_ids: Array, type: 'VENDOR' | 'EMPLOYEE' | 'OTHER' | 'FEE' | 'ADJUSTMENT' | 'CUSTOMER' | 'NONE', account_id: string, vendor_id?: string | undefined, customer_id?: string | undefined, name: string, description?: string | undefined, fields?: FieldAssignments | undefined, attachment_url?: string | undefined, line_items?: Array | undefined, fees_account_id?: string | undefined}; export type CreateApiBankTransactionsReconcileQuickEntryArgs = {body: MatchBankTransactionsQuickEntryRequest}; export type CreateApiBankTransactionsReconcileQuickEntryOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Matches bank transactions with new quick entries * * POST /bank-transactions/reconcile/quick-entry */ export const createApiBankTransactionsReconcileQuickEntry = async (args: CreateApiBankTransactionsReconcileQuickEntryArgs, options?: CreateApiBankTransactionsReconcileQuickEntryOptions) => { const {baseUrl = "https://api.rillet.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/bank-transactions/reconcile/quick-entry${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 };