export type Score = {ficoScore?: string | undefined}; export type Request = {date: string}; export type Requests = {request?: Array | undefined}; export type Loan = {currency: string, balance: string, pledgeSubject: string, creditStart: string, closeDate: string, interest: string, sourceName: string, delayPaymentQuantity112?: string | undefined, delayPaymentQuantity136?: string | undefined, delayPaymentQuantity160?: string | undefined, creditStatus?: string | undefined, delayPaymentMax112?: string | undefined, delayPaymentMax136?: string | undefined, delayPaymentMax160?: string | undefined}; export type CurrentOverdueBalance = {amount?: string | undefined, currency?: string | undefined}; export type ScoreAcraParticipient = {thePresenceData?: string | undefined, theWorstClassCredit?: string | undefined, personBankruptIncome?: string | undefined, theWorstClassLoan?: string | undefined, theWorstClassGuarantee?: string | undefined, score?: Score | undefined, requests?: Requests | undefined, loan?: Array | undefined, currentOverdueLoan: Array, currentOverdueGuarantee: Array}; export type ScoreAcraNorq = {hasPermanentRegistration?: boolean | undefined, actualIncome: number}; export type ScoreAcraEkeng = {gender: 'MALE' | 'FEMALE'}; export type ScoreCardBasedLimitRequest = {cooperationWithMerchantUuId?: string | undefined, age: number, acraParticipient: ScoreAcraParticipient, scoreAcraNorq: ScoreAcraNorq, scoreAcraEkeng: ScoreAcraEkeng, ssn: string, requestDateTime: string, cooperationWithMerchantUuIdOptional?: string | undefined}; export type CreateApiScoreCardLimitArgs = {body: ScoreCardBasedLimitRequest}; export type CreateApiScoreCardLimitOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /score/card/limit */ export const createApiScoreCardLimit = async (args: CreateApiScoreCardLimitArgs, options?: CreateApiScoreCardLimitOptions) => { 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(/\/+$/, '')}/score/card/limit${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() };