export type CreateApiFundCustomerAaConsentArgs = {'api-key'?: string | undefined, 'auth-key'?: string | undefined, body: {customerId: string, transactionId: string, redirectUrl?: string | undefined}}; export type CreateApiFundCustomerAaConsentOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Account Aggregator * * POST /fund/customer/aa/consent */ export const createApiFundCustomerAaConsent = async (args: CreateApiFundCustomerAaConsentArgs, options?: CreateApiFundCustomerAaConsentOptions) => { const {baseUrl = "https://uatclientapi-v2.stockal.com/client/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['api-key'] != null) headers.set("api-key", String(args['api-key'])) if (args['auth-key'] != null) headers.set("auth-key", String(args['auth-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/fund/customer/aa/consent${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 (await res.json()) as unknown };