export type CustomerCreditCheckRequest = {amount_requested: number, business_description?: (string | null) | undefined, has_purchase_history: boolean, has_purchase_terms_history?: boolean | undefined}; export type CreateApiCustomersCustomerIdCreditCheckArgs = {customer_id: string, body: CustomerCreditCheckRequest}; export type CreateApiCustomersCustomerIdCreditCheckOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Request a credit check * * POST /customers/{customer_id}/credit-check * * Also accepts auth: basicAuth */ export const createApiCustomersCustomerIdCreditCheck = async (args: CreateApiCustomersCustomerIdCreditCheckArgs, options?: CreateApiCustomersCustomerIdCreditCheckOptions) => { const {baseUrl = "https://app-sandbox.resolvepay.com/api", 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(/\/+$/, '')}/customers/${encodeURIComponent(String(args.customer_id))}/credit-check${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 };