export type TransferFunds = {accountref: number, amount: number, description: string, employee_id: string}; export type CreateApiEmployeesDeductMoneyArgs = {body: TransferFunds}; export type CreateApiEmployeesDeductMoneyOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deduct money from employee wallet * * POST /employees/deductMoney */ export const createApiEmployeesDeductMoney = async (args: CreateApiEmployeesDeductMoneyArgs, options?: CreateApiEmployeesDeductMoneyOptions) => { const {baseUrl = "https://api.boyahq.com/v1", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-API-KEY", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/employees/deductMoney${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 };