export type CreateImageRequest = {imageType: 'JPEG' | 'PNG' | 'GIF' | 'BMP' | 'WEBP' | 'OTHER', width: number, height: number, file: string, category?: ('UNKNOWN' | 'SELFIE' | 'DOCUMENT' | 'SIGNATURE') | undefined}; export type CustomerDocumentData = {fieldName?: string | undefined, value?: string | undefined}; export type CustomerDocumentRequest = {type?: ('PASSPORT' | 'ID_CARD') | undefined, number?: string | undefined, images?: Array | undefined, other?: Array | undefined}; export type CreateCustomerRequest = {firstName?: string | undefined, lastName?: string | undefined, ssn?: string | undefined, phoneNumber?: string | undefined, additionalPhoneNumber?: string | undefined, images?: Array | undefined, customerDocument?: CustomerDocumentRequest | undefined}; export type ApplicationMetadata = {fieldName?: string | undefined, value?: string | undefined}; export type CreateApplicationRequest = {customer: CreateCustomerRequest, merchantBranchUuId: string, metadata?: Array | undefined}; export type CreateApiApplicationArgs = {body: CreateApplicationRequest}; export type CreateApiApplicationOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /application */ export const createApiApplication = async (args: CreateApiApplicationArgs, options?: CreateApiApplicationOptions) => { const {baseUrl = "https://api.velox.am", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/application${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 res.blob() };