export type PauseCollections = {reason?: ('SCRA' | 'PENDING_BK_VERIFICATION' | 'PENDING_FRAUD_INVESTIGATION' | 'PERMANENT_HARDSHIP_TERMINAL_ILLNESS' | 'PERMANENT_HARDSHIP_PERMANENT_DISABILITY' | 'PERMANENT_HARDSHIP_LONG_TERM_INCARCERATION' | 'TEMPORARY_HARDSHIP' | 'OTHER' | 'GEOGRAPHIC_SUPPRESSION' | 'GOOD_FAITH_PAYMENT' | 'INVALID_DISPUTE_PAUSE_PERIOD' | 'PROFANITY' | 'MAILED_IN_PAYMENT' | 'TEMPORARY_HARDSHIP_CONFIRMED' | 'DV_DOCS_MAILED' | 'PENDING_PREV_PAID_DOCS') | undefined, pauseLengthInDays?: number | undefined, notes?: string | undefined}; export type CreateApiCustomersCustomerIdDebtsDebtIdPauseCollectionsArgs = {changeDebtStatus?: boolean | undefined, body: PauseCollections}; export type CreateApiCustomersCustomerIdDebtsDebtIdPauseCollectionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pause collections on a debt * * POST /customers/{customerId}/debts/{debtId}/pauseCollections */ export const createApiCustomersCustomerIdDebtsDebtIdPauseCollections = async (args: CreateApiCustomersCustomerIdDebtsDebtIdPauseCollectionsArgs, options?: CreateApiCustomersCustomerIdDebtsDebtIdPauseCollectionsOptions) => { const {baseUrl = "https://api.trueaccord.com/api/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.changeDebtStatus != null) query.append("changeDebtStatus", String(args.changeDebtStatus)) const url = `${baseUrl.replace(/\/+$/, '')}/customers/${encodeURIComponent(String(args.customerId))}/debts/${encodeURIComponent(String(args.debtId))}/pauseCollections${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 };