export type PricingTierDto = {tier: number, amount: number, amountType: 'PER_ITEM' | 'TOTAL_INVOICE', tierMinimum: number}; export type DiscountDto = {type?: ('PERCENTAGE' | 'FIXED') | undefined, amount?: string | undefined, note?: string | undefined}; export type PatchBillingTermDto = {name?: string | undefined, description?: string | undefined, billingStartDate?: string | undefined, isRecurring?: boolean | undefined, includeInArr?: boolean | undefined, interval?: ('NONE' | 'DAY' | 'MONTH' | 'HOUR' | 'YEAR' | 'QUARTER' | 'SEMI_MONTH' | 'WEEK') | undefined, intervalFrequency?: number | undefined, duration?: number | undefined, invoiceDateStrategy?: ('FIRST_OF_PERIOD' | 'LAST_OF_PERIOD' | 'ARREARS' | 'ADVANCED_DUE_START') | undefined, netPaymentTerms?: number | undefined, quantity?: number | undefined, billingType?: ('UNIT' | 'FLAT') | undefined, pricingType?: ('SIMPLE' | 'TIERED' | 'VOLUME') | undefined, itemId?: string | undefined, productId?: (string | null) | undefined, classId?: string | undefined, departmentId?: string | undefined, projectId?: string | undefined, pricing?: Array | undefined, discount?: DiscountDto | undefined}; export type PatchApiV3ContractsIdBillingTermsBillingTermIdArgs = {id: string, billingTermId: string, body: PatchBillingTermDto}; export type PatchApiV3ContractsIdBillingTermsBillingTermIdOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update contract billing term * * PATCH /v3/contracts/{id}/billing-terms/{billingTermId} */ export const patchApiV3ContractsIdBillingTermsBillingTermId = async (args: PatchApiV3ContractsIdBillingTermsBillingTermIdArgs, options?: PatchApiV3ContractsIdBillingTermsBillingTermIdOptions) => { const {baseUrl = "https://integrators.prod.api.tabsplatform.com", fetch: fetchFn = fetch, customHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (customHeader !== undefined) headers.set("Authorization", customHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v3/contracts/${encodeURIComponent(String(args.id))}/billing-terms/${encodeURIComponent(String(args.billingTermId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };