@borrowbetter/swsdk 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +189 -0
- package/dist/index.d.mts +611 -0
- package/dist/index.d.ts +611 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +115 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
import { KyInstance } from 'ky';
|
|
2
|
+
|
|
3
|
+
interface SpinwheelConfig {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
sandbox?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface SpinwheelClients {
|
|
8
|
+
client: KyInstance;
|
|
9
|
+
secureClient: KyInstance;
|
|
10
|
+
}
|
|
11
|
+
type VerificationType = "SMS" | "PHONE_CALL" | "KYC" | "CREDIT_REPORT";
|
|
12
|
+
interface ConnectPreverifiedPhoneAudit {
|
|
13
|
+
/** The date the user was verified. Formatted as YYYY-MM-DD */
|
|
14
|
+
verificationDate: string;
|
|
15
|
+
/** The date the user consented to verification. Formatted as YYYY-MM-DD */
|
|
16
|
+
userConsentDate: string;
|
|
17
|
+
/** The type of verification performed */
|
|
18
|
+
verificationType: VerificationType;
|
|
19
|
+
}
|
|
20
|
+
interface ConnectPreverifiedPhoneInput {
|
|
21
|
+
/** The phone number in E.164 format (e.g., +14155552671) */
|
|
22
|
+
phoneNumber: string;
|
|
23
|
+
/** The date of birth. Formatted as YYYY-MM-DD */
|
|
24
|
+
dateOfBirth: string;
|
|
25
|
+
/** An existing userId to connect with. One of extUserId or userId is required. */
|
|
26
|
+
userId?: string;
|
|
27
|
+
/** A unique external ID for the user. One of extUserId or userId is required. */
|
|
28
|
+
extUserId?: string;
|
|
29
|
+
/** Documentation of your own user verification */
|
|
30
|
+
audit: ConnectPreverifiedPhoneAudit;
|
|
31
|
+
}
|
|
32
|
+
interface ConnectNetworkTokenAudit {
|
|
33
|
+
/** The date the user consented to verification. Formatted as YYYY-MM-DD */
|
|
34
|
+
userConsentDate: string;
|
|
35
|
+
}
|
|
36
|
+
interface ConnectNetworkTokenInput {
|
|
37
|
+
/** A unique external ID for the user */
|
|
38
|
+
extUserId: string;
|
|
39
|
+
/** Network token */
|
|
40
|
+
networkToken: string;
|
|
41
|
+
/** Last 4 digits of SSN (exactly 4 characters) */
|
|
42
|
+
ssnLastFourDigits: string;
|
|
43
|
+
/** The date of birth. Formatted as YYYY-MM-DD */
|
|
44
|
+
dateOfBirth: string;
|
|
45
|
+
/** Documentation of your own user verification */
|
|
46
|
+
audit: ConnectNetworkTokenAudit;
|
|
47
|
+
}
|
|
48
|
+
type MessageType = "ERROR" | "WARN" | "INFO";
|
|
49
|
+
interface SpinwheelStatusMessage {
|
|
50
|
+
desc: string;
|
|
51
|
+
type?: MessageType;
|
|
52
|
+
}
|
|
53
|
+
interface SpinwheelResponseStatus {
|
|
54
|
+
code: number;
|
|
55
|
+
desc: string;
|
|
56
|
+
messages?: SpinwheelStatusMessage[];
|
|
57
|
+
}
|
|
58
|
+
interface SpinwheelResponse<T> {
|
|
59
|
+
status: SpinwheelResponseStatus;
|
|
60
|
+
data: T;
|
|
61
|
+
}
|
|
62
|
+
type USStateCode = "AL" | "AK" | "AZ" | "AR" | "CA" | "CO" | "CT" | "DC" | "DE" | "FL" | "GA" | "HI" | "ID" | "IL" | "IN" | "IA" | "KS" | "KY" | "LA" | "ME" | "MD" | "MA" | "MI" | "MN" | "MS" | "MO" | "MT" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "NC" | "ND" | "OH" | "OK" | "OR" | "PA" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VT" | "VA" | "WA" | "WV" | "WI" | "WY";
|
|
63
|
+
type CreditBureau = "Equifax" | "Experian" | "TransUnion";
|
|
64
|
+
type CreditReportType = "1_BUREAU.FULL";
|
|
65
|
+
type CreditScoreModel = "VANTAGE_SCORE_3_0";
|
|
66
|
+
type LiabilityStatus = "OPEN" | "CLOSED";
|
|
67
|
+
type DebtType = "SECURED" | "UNSECURED" | "UNKNOWN";
|
|
68
|
+
type AccountType = "CREDIT_LINE" | "INSTALLMENT" | "MORTGAGE" | "OPEN" | "REVOLVING" | "UNKNOWN";
|
|
69
|
+
type TermsFrequency = "BIWEEKLY" | "DEFERRED" | "SEMI_MONTHLY" | "BI_MONTHLY" | "MONTHLY" | "SINGLE_PAYMENT_LOAN" | "QUARTERLY" | "SEMI_ANNUALLY" | "TRI_ANNUALLY" | "WEEKLY" | "ANNUALLY";
|
|
70
|
+
type AccountOwnershipType = "AUTHORIZED_USER" | "COMAKER" | "INDIVIDUAL" | "JOINT_CONTRACTUAL_LIABILITY" | "JOINT_PARTICIPATING" | "MAKER" | "ON_BEHALF_OF" | "TERMINATED" | "UNDESIGNATED" | "DECEASED";
|
|
71
|
+
type EcoaCode = "I" | "J" | "A" | "C" | "M" | "T" | "X";
|
|
72
|
+
type ConsumerDisputeStatus = "DISPUTED" | "NOT_DISPUTED";
|
|
73
|
+
type DerogatoryDataStatus = "DEROGATORY" | "NOT_DEROGATORY";
|
|
74
|
+
type CollectionStatus = "IN_COLLECTION" | "NOT_IN_COLLECTION";
|
|
75
|
+
type ChargeOffStatus = "CHARGED_OFF" | "NOT_CHARGED_OFF";
|
|
76
|
+
type OverduePeriod = "LATE_30_DAYS" | "LATE_60_DAYS" | "LATE_90_DAYS" | "LATE_120_DAYS" | "NOT_OVERDUE";
|
|
77
|
+
type AdverseRating = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "G" | "H" | "J" | "R" | "L" | "E" | "B" | "D";
|
|
78
|
+
type InquiryPurposeType = "HARD" | "SOFT" | "OTHER";
|
|
79
|
+
type BankruptcyType = "INDIVIDUAL" | "BUSINESS";
|
|
80
|
+
type BankruptcyFiler = "INDIVIDUAL" | "JOINT";
|
|
81
|
+
type BankruptcyDisposition = "FILED_CH_7" | "FILED_CH_11" | "FILED_CH_12" | "FILED_CH_13" | "DISCHARGED_CH_7" | "DISCHARGED_CH_11" | "DISCHARGED_CH_12" | "DISCHARGED_CH_13" | "DISMISSED_OR_CLOSED_CH_7" | "DISMISSED_OR_CLOSED_CH_11" | "DISMISSED_OR_CLOSED_CH_12" | "DISMISSED_OR_CLOSED_CH_13" | "INVOLUNTARY_CH_7" | "VOLUNTARY_CH_7" | "WAGE_EARNER";
|
|
82
|
+
type AprType = "PURCHASE" | "BALANCE_TRANSFER" | "PENALTY" | "CASH_ADVANCE" | "INTRO";
|
|
83
|
+
type DataStatusType = "IN_PROGRESS" | "COMPLETED" | "ERROR";
|
|
84
|
+
type CapabilityStatus = "SUPPORTED" | "NOT_SUPPORTED" | "INSTITUTION_NOT_SUPPORTED" | "INSTITUTION_DISABLED" | "REFRESH_EXHAUSTED" | "NOT_PRIMARY_ACCOUNT_HOLDER" | "ACCOUNT_TERMINATED" | "CLOSED_ACCOUNT_NO_BALANCE" | "CLOSED_ACCOUNT" | "ACCOUNT_NUMBER_VERIFICATION_FAILED" | "FIELD_ERROR";
|
|
85
|
+
type NarrativeCode = "UNPAID" | "FINANCIAL_COUNSELOR" | "ADJUSTMENT" | "WAGE_EARNER" | "NEW_LISTING" | "PAID" | "ACCOUNT_DISPUTED" | "PAYMENT" | "UNKNOWN" | "CHECKED" | "IN_BANKRUPTCY";
|
|
86
|
+
type CollectionAccountStatus = NarrativeCode;
|
|
87
|
+
type LimitType = "FLEXIBLE" | "REGULAR";
|
|
88
|
+
type StudentLoanType = "PUBLIC" | "PRIVATE" | "UNVERIFIED";
|
|
89
|
+
type ResidencyType = "CURRENT" | "PREVIOUS";
|
|
90
|
+
type AddressOwnership = "OWN" | "RENT" | "BUY";
|
|
91
|
+
type AddressSource = "EQUIFAX" | "TRANSUNION" | "OTHER" | "AUTOMATED_UPDATE";
|
|
92
|
+
type EmploymentStatusType = "CURRENT" | "PREVIOUS";
|
|
93
|
+
type LiabilityType = "STUDENT_LOAN" | "CREDIT_CARD" | "HOME_LOAN" | "AUTO_LOAN" | "PERSONAL_LOAN" | "MISCELLANEOUS_LIABILITY";
|
|
94
|
+
interface DateWithFormat {
|
|
95
|
+
value: string;
|
|
96
|
+
format: string;
|
|
97
|
+
}
|
|
98
|
+
interface SpinwheelAddress {
|
|
99
|
+
addressLine1: string;
|
|
100
|
+
addressLine2?: string;
|
|
101
|
+
city: string;
|
|
102
|
+
state: USStateCode;
|
|
103
|
+
zip: string;
|
|
104
|
+
zipExtension?: string;
|
|
105
|
+
}
|
|
106
|
+
interface UserProfile {
|
|
107
|
+
firstName: string;
|
|
108
|
+
middleName?: string;
|
|
109
|
+
lastName: string;
|
|
110
|
+
phoneNumber?: string;
|
|
111
|
+
emailAddress?: string;
|
|
112
|
+
ssnLastFourDigits?: string;
|
|
113
|
+
dob?: string;
|
|
114
|
+
dateOfBirth?: string;
|
|
115
|
+
creditScore?: number;
|
|
116
|
+
model?: CreditScoreModel;
|
|
117
|
+
addresses?: SpinwheelAddress[];
|
|
118
|
+
}
|
|
119
|
+
interface LoanSummary {
|
|
120
|
+
noOfLoans: number;
|
|
121
|
+
currentOutstandingBalance: number;
|
|
122
|
+
minimumPaymentAmount: number;
|
|
123
|
+
interestRate?: number;
|
|
124
|
+
interestRateDerived?: number;
|
|
125
|
+
updatedOn?: number;
|
|
126
|
+
createdOn?: number;
|
|
127
|
+
}
|
|
128
|
+
interface CreditCardSummary {
|
|
129
|
+
noOfCreditCards: number;
|
|
130
|
+
currentOutstandingBalance: number;
|
|
131
|
+
availableCredit: number;
|
|
132
|
+
creditUtilization: number;
|
|
133
|
+
updatedOn: number;
|
|
134
|
+
}
|
|
135
|
+
interface LiabilityGroupPayoffQuote {
|
|
136
|
+
studentLoanIds: string[];
|
|
137
|
+
liabilityGroupId: string;
|
|
138
|
+
payoffAmount: number;
|
|
139
|
+
payoffGoodThroughDate: string;
|
|
140
|
+
updatedOn: number;
|
|
141
|
+
}
|
|
142
|
+
interface StudentLoanSummary extends LoanSummary {
|
|
143
|
+
liabilityGroupPayoffQuotes?: LiabilityGroupPayoffQuote[];
|
|
144
|
+
}
|
|
145
|
+
interface Narrative {
|
|
146
|
+
code: NarrativeCode;
|
|
147
|
+
description: string;
|
|
148
|
+
}
|
|
149
|
+
interface LiabilityTransfers {
|
|
150
|
+
transferredFrom?: {
|
|
151
|
+
creditorName: string;
|
|
152
|
+
};
|
|
153
|
+
transferredTo?: {
|
|
154
|
+
creditorName: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
interface PaymentHistoryDetail {
|
|
158
|
+
date: string;
|
|
159
|
+
description: string;
|
|
160
|
+
code: string;
|
|
161
|
+
}
|
|
162
|
+
interface PaymentHistory {
|
|
163
|
+
lastAssessedStatementDate?: string;
|
|
164
|
+
details?: PaymentHistoryDetail[];
|
|
165
|
+
}
|
|
166
|
+
interface LiabilityProfile {
|
|
167
|
+
accountOriginationDate?: string;
|
|
168
|
+
status?: LiabilityStatus;
|
|
169
|
+
interestRateDerived?: number;
|
|
170
|
+
loanOriginationAmount?: number;
|
|
171
|
+
highCreditAmount?: number;
|
|
172
|
+
accountRating?: string;
|
|
173
|
+
liabilitySubtype?: string;
|
|
174
|
+
debtType?: DebtType;
|
|
175
|
+
pendingLoanTermInMonthsDerived?: number;
|
|
176
|
+
loanTermInMonths?: number;
|
|
177
|
+
termsFrequency?: TermsFrequency;
|
|
178
|
+
accountOwnershipType?: AccountOwnershipType;
|
|
179
|
+
ecoaCode?: EcoaCode;
|
|
180
|
+
reviewedInMonths?: number;
|
|
181
|
+
accountType?: AccountType;
|
|
182
|
+
consumerDisputeStatus?: ConsumerDisputeStatus;
|
|
183
|
+
derogatoryDataStatus?: DerogatoryDataStatus;
|
|
184
|
+
collectionStatus?: CollectionStatus;
|
|
185
|
+
chargeOffStatus?: ChargeOffStatus;
|
|
186
|
+
chargeOffAmount?: number;
|
|
187
|
+
accountTypeCode?: string;
|
|
188
|
+
accountNumberLastFour?: string;
|
|
189
|
+
adverseRatingCount?: number;
|
|
190
|
+
highestAdverseRating?: AdverseRating;
|
|
191
|
+
mostRecentAdverseRating?: AdverseRating;
|
|
192
|
+
secondMostRecentAdverseRating?: AdverseRating;
|
|
193
|
+
closedDateWithFormat?: DateWithFormat;
|
|
194
|
+
reportedDateWithFormat?: DateWithFormat;
|
|
195
|
+
chargeOffDateWithFormat?: DateWithFormat;
|
|
196
|
+
firstDelinquencyDateWithFormat?: DateWithFormat;
|
|
197
|
+
lastActivityDateWithFormat?: DateWithFormat;
|
|
198
|
+
highestAdverseRatingDateWithFormat?: DateWithFormat;
|
|
199
|
+
mostRecentAdverseRatingDateWithFormat?: DateWithFormat;
|
|
200
|
+
secondMostRecentAdverseRatingDateWithFormat?: DateWithFormat;
|
|
201
|
+
liabilityTransfers?: LiabilityTransfers;
|
|
202
|
+
narratives?: Narrative[];
|
|
203
|
+
paymentHistory?: PaymentHistory;
|
|
204
|
+
loanType?: StudentLoanType;
|
|
205
|
+
collectionAccountStatus?: CollectionAccountStatus;
|
|
206
|
+
}
|
|
207
|
+
interface CardProfile extends Omit<LiabilityProfile, "loanTermInMonths"> {
|
|
208
|
+
creditLimit?: number;
|
|
209
|
+
creditUtilization?: number;
|
|
210
|
+
creditCardNumberMasked?: string;
|
|
211
|
+
availableCreditDerived?: number;
|
|
212
|
+
limitType?: LimitType;
|
|
213
|
+
}
|
|
214
|
+
interface BalanceDetails {
|
|
215
|
+
outstandingBalance: number;
|
|
216
|
+
updatedOn?: number;
|
|
217
|
+
}
|
|
218
|
+
interface StatementSummary {
|
|
219
|
+
statementBalance?: number;
|
|
220
|
+
principalBalance?: number;
|
|
221
|
+
minimumPaymentAmount?: number;
|
|
222
|
+
dueDate?: string;
|
|
223
|
+
overduePeriod?: OverduePeriod;
|
|
224
|
+
amountPastDue?: number;
|
|
225
|
+
updatedOn?: number;
|
|
226
|
+
statementDateWithFormat?: DateWithFormat;
|
|
227
|
+
lastPaymentDateWithFormat?: DateWithFormat;
|
|
228
|
+
refreshedFields?: {
|
|
229
|
+
lastPaymentDate?: DateWithFormat & {
|
|
230
|
+
updatedOn: number;
|
|
231
|
+
};
|
|
232
|
+
dueDay?: DateWithFormat & {
|
|
233
|
+
updatedOn: number;
|
|
234
|
+
};
|
|
235
|
+
lastPaymentAmount?: {
|
|
236
|
+
value: number;
|
|
237
|
+
updatedOn: number;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
interface PayoffSummary {
|
|
242
|
+
payoffAmount: number;
|
|
243
|
+
payoffGoodThroughDate: string;
|
|
244
|
+
updatedOn: number;
|
|
245
|
+
}
|
|
246
|
+
interface CreditorAddress extends SpinwheelAddress {
|
|
247
|
+
addressType?: ResidencyType;
|
|
248
|
+
reportedDate?: string;
|
|
249
|
+
reportedDateWithFormat?: DateWithFormat;
|
|
250
|
+
}
|
|
251
|
+
interface Creditor {
|
|
252
|
+
originalName?: string;
|
|
253
|
+
industryType?: string;
|
|
254
|
+
industryCode?: string;
|
|
255
|
+
phoneNumber?: string;
|
|
256
|
+
bureauSubscriberCode?: string;
|
|
257
|
+
address?: SpinwheelAddress;
|
|
258
|
+
billingAddresses?: CreditorAddress[];
|
|
259
|
+
}
|
|
260
|
+
interface CapabilityAvailability {
|
|
261
|
+
availability: CapabilityStatus;
|
|
262
|
+
description?: string;
|
|
263
|
+
liabilityGroupId?: string;
|
|
264
|
+
fieldErrors?: {
|
|
265
|
+
field: string;
|
|
266
|
+
error: CapabilityStatus;
|
|
267
|
+
description?: string;
|
|
268
|
+
}[];
|
|
269
|
+
}
|
|
270
|
+
interface Capabilities {
|
|
271
|
+
payments?: {
|
|
272
|
+
billPayment?: CapabilityAvailability;
|
|
273
|
+
};
|
|
274
|
+
data?: {
|
|
275
|
+
realtimeBalance?: CapabilityAvailability;
|
|
276
|
+
statementSummary?: CapabilityAvailability;
|
|
277
|
+
payoffSummary?: CapabilityAvailability;
|
|
278
|
+
liabilityGroupPayoffQuote?: CapabilityAvailability;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
interface BaseLiability {
|
|
282
|
+
displayName?: string;
|
|
283
|
+
logoUrl: string;
|
|
284
|
+
balanceDetails: BalanceDetails;
|
|
285
|
+
statementSummary: StatementSummary;
|
|
286
|
+
creditor?: Creditor;
|
|
287
|
+
capabilities: Capabilities;
|
|
288
|
+
updatedOn?: number;
|
|
289
|
+
createdOn?: number;
|
|
290
|
+
}
|
|
291
|
+
interface HomeLoan extends BaseLiability {
|
|
292
|
+
homeLoanId: string;
|
|
293
|
+
liabilityProfile: LiabilityProfile;
|
|
294
|
+
}
|
|
295
|
+
interface AutoLoan extends BaseLiability {
|
|
296
|
+
autoLoanId: string;
|
|
297
|
+
liabilityProfile: LiabilityProfile;
|
|
298
|
+
payoffSummary?: PayoffSummary;
|
|
299
|
+
}
|
|
300
|
+
interface PersonalLoan extends BaseLiability {
|
|
301
|
+
personalLoanId: string;
|
|
302
|
+
liabilityProfile: LiabilityProfile;
|
|
303
|
+
}
|
|
304
|
+
interface StudentLoan extends BaseLiability {
|
|
305
|
+
studentLoanId: string;
|
|
306
|
+
liabilityProfile: LiabilityProfile;
|
|
307
|
+
}
|
|
308
|
+
interface MiscellaneousLiability extends BaseLiability {
|
|
309
|
+
miscellaneousLiabilityId: string;
|
|
310
|
+
liabilityProfile: LiabilityProfile;
|
|
311
|
+
}
|
|
312
|
+
interface Apr {
|
|
313
|
+
rate: number;
|
|
314
|
+
type: AprType;
|
|
315
|
+
applicableBalance?: number;
|
|
316
|
+
expirationDate?: string;
|
|
317
|
+
updatedOn: number;
|
|
318
|
+
}
|
|
319
|
+
interface CreditCard extends BaseLiability {
|
|
320
|
+
creditCardId: string;
|
|
321
|
+
cardProfile: CardProfile;
|
|
322
|
+
aprs?: Apr[];
|
|
323
|
+
}
|
|
324
|
+
interface CreditReportAddress extends SpinwheelAddress {
|
|
325
|
+
residencyType?: ResidencyType;
|
|
326
|
+
addressOwnership?: AddressOwnership;
|
|
327
|
+
addressSource?: AddressSource;
|
|
328
|
+
residencyDurationInMonths?: number;
|
|
329
|
+
reportedDate?: string;
|
|
330
|
+
reportedDateWithFormat?: DateWithFormat;
|
|
331
|
+
firstReportedDateWithFormat?: DateWithFormat;
|
|
332
|
+
}
|
|
333
|
+
interface FormerName {
|
|
334
|
+
firstName?: string;
|
|
335
|
+
middleName?: string;
|
|
336
|
+
lastName?: string;
|
|
337
|
+
}
|
|
338
|
+
interface EmploymentHistory {
|
|
339
|
+
employerName?: string;
|
|
340
|
+
position?: string;
|
|
341
|
+
startDateWithFormat?: DateWithFormat;
|
|
342
|
+
reportedDateWithFormat?: DateWithFormat;
|
|
343
|
+
employmentStatus?: EmploymentStatusType;
|
|
344
|
+
}
|
|
345
|
+
interface CreditReportProfile {
|
|
346
|
+
firstName?: string;
|
|
347
|
+
middleName?: string;
|
|
348
|
+
lastName?: string;
|
|
349
|
+
creditScore?: number;
|
|
350
|
+
model?: CreditScoreModel;
|
|
351
|
+
dateOfBirth?: string;
|
|
352
|
+
ssn?: string;
|
|
353
|
+
formerNames?: FormerName[];
|
|
354
|
+
addresses?: CreditReportAddress[];
|
|
355
|
+
employmentHistory?: EmploymentHistory[];
|
|
356
|
+
updatedOn?: number;
|
|
357
|
+
createdOn?: number;
|
|
358
|
+
}
|
|
359
|
+
interface Inquiry {
|
|
360
|
+
inquirerName?: string;
|
|
361
|
+
phoneNumber?: string;
|
|
362
|
+
inquiryDate?: string;
|
|
363
|
+
inquirerIndustryCode?: string;
|
|
364
|
+
purposeType?: InquiryPurposeType;
|
|
365
|
+
sourceBureau?: CreditBureau;
|
|
366
|
+
bureauSubscriberCode?: string;
|
|
367
|
+
address?: SpinwheelAddress;
|
|
368
|
+
}
|
|
369
|
+
interface BankruptcyCourt {
|
|
370
|
+
industryType?: string;
|
|
371
|
+
industryCode?: string;
|
|
372
|
+
bureauSubscriberCode?: string;
|
|
373
|
+
}
|
|
374
|
+
interface Bankruptcy {
|
|
375
|
+
caseNumber?: string;
|
|
376
|
+
type?: BankruptcyType;
|
|
377
|
+
filer?: BankruptcyFiler;
|
|
378
|
+
disposition?: BankruptcyDisposition;
|
|
379
|
+
priorDisposition?: BankruptcyDisposition;
|
|
380
|
+
liabilityAmount?: number;
|
|
381
|
+
assetAmount?: number;
|
|
382
|
+
exemptAmount?: number;
|
|
383
|
+
court?: BankruptcyCourt;
|
|
384
|
+
narratives?: Narrative[];
|
|
385
|
+
filedDateWithFormat?: DateWithFormat;
|
|
386
|
+
dispositionDateWithFormat?: DateWithFormat;
|
|
387
|
+
verifiedDateWithFormat?: DateWithFormat;
|
|
388
|
+
reportedDateWithFormat?: DateWithFormat;
|
|
389
|
+
}
|
|
390
|
+
interface CreditScoreFactor {
|
|
391
|
+
code: string;
|
|
392
|
+
description: string;
|
|
393
|
+
}
|
|
394
|
+
interface CreditScoreDetail {
|
|
395
|
+
reportedDate?: string;
|
|
396
|
+
creditScore?: number;
|
|
397
|
+
model?: CreditScoreModel;
|
|
398
|
+
sourceBureau?: CreditBureau;
|
|
399
|
+
riskBasedPricingPercentage?: number;
|
|
400
|
+
riskBasedPricingMin?: number;
|
|
401
|
+
riskBasedPricingMax?: number;
|
|
402
|
+
factors?: CreditScoreFactor[];
|
|
403
|
+
}
|
|
404
|
+
interface CreditAttribute {
|
|
405
|
+
description: string;
|
|
406
|
+
value: string;
|
|
407
|
+
}
|
|
408
|
+
interface CreditReportSummary {
|
|
409
|
+
totalSecuredDebtAmount?: number;
|
|
410
|
+
securedDebtLiabilitiesCount?: number;
|
|
411
|
+
totalUnsecuredDebtAmount?: number;
|
|
412
|
+
unsecuredDebtLiabilitiesCount?: number;
|
|
413
|
+
totalUnsecuredDebtExcludingStudent?: number;
|
|
414
|
+
unsecuredDebtExcludingStudentCount?: number;
|
|
415
|
+
totalUnknownDebtAmount?: number;
|
|
416
|
+
unknownDebtLiabilitiesCount?: number;
|
|
417
|
+
}
|
|
418
|
+
interface DataStatus {
|
|
419
|
+
status: DataStatusType;
|
|
420
|
+
updatedOn: number;
|
|
421
|
+
}
|
|
422
|
+
interface ConnectionStatus {
|
|
423
|
+
statusCode: number;
|
|
424
|
+
description: string;
|
|
425
|
+
lastAuthAttemptOn?: number;
|
|
426
|
+
isAuthSuccessful?: boolean;
|
|
427
|
+
isValid?: boolean;
|
|
428
|
+
isSecurityStepPending?: boolean;
|
|
429
|
+
lastSuccessfulAuthOn?: number;
|
|
430
|
+
dataStatus?: DataStatus;
|
|
431
|
+
}
|
|
432
|
+
interface CreditReport {
|
|
433
|
+
id: string;
|
|
434
|
+
sourceBureau: CreditBureau;
|
|
435
|
+
type: CreditReportType;
|
|
436
|
+
profile?: CreditReportProfile;
|
|
437
|
+
inquiries?: Inquiry[];
|
|
438
|
+
bankruptcies?: Bankruptcy[];
|
|
439
|
+
creditScoreDetails?: CreditScoreDetail[];
|
|
440
|
+
creditAttributes?: CreditAttribute[];
|
|
441
|
+
summary?: CreditReportSummary;
|
|
442
|
+
connectionStatus?: ConnectionStatus;
|
|
443
|
+
updatedOn?: number;
|
|
444
|
+
createdOn?: number;
|
|
445
|
+
}
|
|
446
|
+
interface UserData {
|
|
447
|
+
userId: string;
|
|
448
|
+
extUserId?: string;
|
|
449
|
+
connectionId?: string;
|
|
450
|
+
connectionStatus?: string;
|
|
451
|
+
networkToken?: string;
|
|
452
|
+
profile?: UserProfile;
|
|
453
|
+
}
|
|
454
|
+
interface HydratedUserData {
|
|
455
|
+
userId: string;
|
|
456
|
+
extUserId?: string;
|
|
457
|
+
isBorrower?: boolean;
|
|
458
|
+
isChampion?: boolean;
|
|
459
|
+
networkToken?: string;
|
|
460
|
+
updatedOn: number;
|
|
461
|
+
createdOn: number;
|
|
462
|
+
profile?: UserProfile;
|
|
463
|
+
autoLoanSummary?: LoanSummary;
|
|
464
|
+
homeLoanSummary?: LoanSummary;
|
|
465
|
+
personalLoanSummary?: LoanSummary;
|
|
466
|
+
miscellaneousLiabilitySummary?: LoanSummary;
|
|
467
|
+
creditCardSummary?: CreditCardSummary;
|
|
468
|
+
studentLoanSummary?: StudentLoanSummary;
|
|
469
|
+
creditReports?: CreditReport[];
|
|
470
|
+
homeLoans?: HomeLoan[];
|
|
471
|
+
autoLoans?: AutoLoan[];
|
|
472
|
+
personalLoans?: PersonalLoan[];
|
|
473
|
+
studentLoans?: StudentLoan[];
|
|
474
|
+
miscellaneousLiabilities?: MiscellaneousLiability[];
|
|
475
|
+
creditCards?: CreditCard[];
|
|
476
|
+
}
|
|
477
|
+
type ConnectPreverifiedPhoneResponse = SpinwheelResponse<UserData>;
|
|
478
|
+
type ConnectNetworkTokenResponse = SpinwheelResponse<UserData>;
|
|
479
|
+
type GetUserResponse = SpinwheelResponse<HydratedUserData>;
|
|
480
|
+
interface FetchDebtProfileOptions {
|
|
481
|
+
/** Filter by liability type */
|
|
482
|
+
liabilityType?: LiabilityType;
|
|
483
|
+
/** Credit report configuration */
|
|
484
|
+
creditReport?: {
|
|
485
|
+
/** Credit bureau source. Defaults to bureau configured during onboarding. */
|
|
486
|
+
sourceBureau?: CreditBureau;
|
|
487
|
+
/** Type of credit report requested */
|
|
488
|
+
type: CreditReportType;
|
|
489
|
+
};
|
|
490
|
+
/** Credit score configuration */
|
|
491
|
+
creditScore?: {
|
|
492
|
+
/** Credit bureau source. Defaults to bureau configured during onboarding. */
|
|
493
|
+
sourceBureau?: CreditBureau;
|
|
494
|
+
/** Scoring model to use */
|
|
495
|
+
model: CreditScoreModel;
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Connect API — Discover > Connect
|
|
501
|
+
*
|
|
502
|
+
* Handles user connection flows (preverified phone, network tokens).
|
|
503
|
+
*/
|
|
504
|
+
declare class ConnectAPI {
|
|
505
|
+
private clients;
|
|
506
|
+
constructor(clients: SpinwheelClients);
|
|
507
|
+
/**
|
|
508
|
+
* Connect a user that has already been pre-verified by phone number/SMS.
|
|
509
|
+
* Requires Spinwheel Support approval to enable.
|
|
510
|
+
*
|
|
511
|
+
* @see https://docs.spinwheel.io/reference/connect-preverified-phone-number
|
|
512
|
+
*/
|
|
513
|
+
preverifiedPhone(input: ConnectPreverifiedPhoneInput): Promise<ConnectPreverifiedPhoneResponse>;
|
|
514
|
+
/**
|
|
515
|
+
* Connect a user using a network token obtained from user verification.
|
|
516
|
+
*
|
|
517
|
+
* @see https://docs.spinwheel.io/reference/create-network-user
|
|
518
|
+
*/
|
|
519
|
+
networkToken(input: ConnectNetworkTokenInput): Promise<ConnectNetworkTokenResponse>;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Debt Profile API — Discover > Debt Profile
|
|
524
|
+
*
|
|
525
|
+
* Triggers asynchronous credit pulls. After calling `fetch`, use
|
|
526
|
+
* `userManagement.get()` to retrieve the resulting hydrated user data.
|
|
527
|
+
*/
|
|
528
|
+
declare class DebtProfileAPI {
|
|
529
|
+
private clients;
|
|
530
|
+
constructor(clients: SpinwheelClients);
|
|
531
|
+
/**
|
|
532
|
+
* Trigger a credit pull for a user's debt profile.
|
|
533
|
+
*
|
|
534
|
+
* This is an async operation — the credit pull happens in the background.
|
|
535
|
+
* Poll `userManagement.get(userId)` to retrieve results once complete.
|
|
536
|
+
*
|
|
537
|
+
* Note: Your implementation must display the Spinwheel End User Agreement:
|
|
538
|
+
* "By continuing you agree to the Spinwheel End User Agreement. Further,
|
|
539
|
+
* you are providing written instructions to Spinwheel Solutions, Inc.
|
|
540
|
+
* authorizing it to obtain your credit profile from any consumer reporting agency."
|
|
541
|
+
*
|
|
542
|
+
* @see https://docs.spinwheel.io/reference/fetch-debt-profile
|
|
543
|
+
*/
|
|
544
|
+
fetch(userId: string, options: FetchDebtProfileOptions): Promise<void>;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
type GetUserInput = {
|
|
548
|
+
userId: string;
|
|
549
|
+
} | {
|
|
550
|
+
extUserId: string;
|
|
551
|
+
};
|
|
552
|
+
/**
|
|
553
|
+
* User Management API — Optimize > User Management
|
|
554
|
+
*
|
|
555
|
+
* Handles user profile retrieval with unmasked sensitive fields.
|
|
556
|
+
* Always uses the secure API endpoint.
|
|
557
|
+
*/
|
|
558
|
+
declare class UserManagementAPI {
|
|
559
|
+
private clients;
|
|
560
|
+
constructor(clients: SpinwheelClients);
|
|
561
|
+
/**
|
|
562
|
+
* Retrieve a user's full hydrated profile with unmasked account number and SSN.
|
|
563
|
+
*
|
|
564
|
+
* @param input - Either `userId` (Spinwheel's ID) or `extUserId` (your external ID)
|
|
565
|
+
* @see https://docs.spinwheel.io/reference/get-user-profile
|
|
566
|
+
*/
|
|
567
|
+
get(input: GetUserInput): Promise<GetUserResponse>;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Spinwheel SDK
|
|
572
|
+
*
|
|
573
|
+
* Domain-based client for the Spinwheel credit data and debt profile API.
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* ```typescript
|
|
577
|
+
* const spinwheel = new SpinwheelSDK({
|
|
578
|
+
* apiKey: "your-api-key",
|
|
579
|
+
* sandbox: true,
|
|
580
|
+
* });
|
|
581
|
+
*
|
|
582
|
+
* // Connect a user
|
|
583
|
+
* const { data } = await spinwheel.connect.preverifiedPhone({
|
|
584
|
+
* phoneNumber: "+14155552671",
|
|
585
|
+
* dateOfBirth: "1990-01-15",
|
|
586
|
+
* extUserId: "your-user-id",
|
|
587
|
+
* audit: {
|
|
588
|
+
* verificationDate: "2025-01-01",
|
|
589
|
+
* userConsentDate: "2025-01-01",
|
|
590
|
+
* verificationType: "SMS",
|
|
591
|
+
* },
|
|
592
|
+
* });
|
|
593
|
+
*
|
|
594
|
+
* // Trigger a credit pull
|
|
595
|
+
* await spinwheel.debtProfile.fetch(data.userId, {
|
|
596
|
+
* creditReport: { sourceBureau: "TransUnion", type: "1_BUREAU.FULL" },
|
|
597
|
+
* creditScore: { sourceBureau: "TransUnion", model: "VANTAGE_SCORE_3_0" },
|
|
598
|
+
* });
|
|
599
|
+
*
|
|
600
|
+
* // Retrieve hydrated profile
|
|
601
|
+
* const profile = await spinwheel.userManagement.get({ userId: data.userId });
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
declare class SpinwheelSDK {
|
|
605
|
+
readonly connect: ConnectAPI;
|
|
606
|
+
readonly debtProfile: DebtProfileAPI;
|
|
607
|
+
readonly userManagement: UserManagementAPI;
|
|
608
|
+
constructor(config: SpinwheelConfig);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
export { type AccountOwnershipType, type AccountType, type AddressOwnership, type AddressSource, type AdverseRating, type Apr, type AprType, type AutoLoan, type BalanceDetails, type Bankruptcy, type BankruptcyCourt, type BankruptcyDisposition, type BankruptcyFiler, type BankruptcyType, type Capabilities, type CapabilityAvailability, type CapabilityStatus, type CardProfile, type ChargeOffStatus, type CollectionAccountStatus, type CollectionStatus, type ConnectNetworkTokenAudit, type ConnectNetworkTokenInput, type ConnectNetworkTokenResponse, type ConnectPreverifiedPhoneAudit, type ConnectPreverifiedPhoneInput, type ConnectPreverifiedPhoneResponse, type ConnectionStatus, type ConsumerDisputeStatus, type CreditAttribute, type CreditBureau, type CreditCard, type CreditCardSummary, type CreditReport, type CreditReportAddress, type CreditReportProfile, type CreditReportSummary, type CreditReportType, type CreditScoreDetail, type CreditScoreFactor, type CreditScoreModel, type Creditor, type CreditorAddress, type DataStatus, type DataStatusType, type DateWithFormat, type DebtType, type DerogatoryDataStatus, type EcoaCode, type EmploymentHistory, type EmploymentStatusType, type FetchDebtProfileOptions, type FormerName, type GetUserResponse, type HomeLoan, type HydratedUserData, type Inquiry, type InquiryPurposeType, type LiabilityGroupPayoffQuote, type LiabilityProfile, type LiabilityStatus, type LiabilityTransfers, type LiabilityType, type LimitType, type LoanSummary, type MessageType, type MiscellaneousLiability, type Narrative, type NarrativeCode, type OverduePeriod, type PaymentHistory, type PaymentHistoryDetail, type PayoffSummary, type PersonalLoan, type ResidencyType, type SpinwheelAddress, type SpinwheelClients, type SpinwheelConfig, type SpinwheelResponse, type SpinwheelResponseStatus, SpinwheelSDK, type SpinwheelStatusMessage, type StatementSummary, type StudentLoan, type StudentLoanSummary, type StudentLoanType, type TermsFrequency, type USStateCode, type UserData, type UserProfile, type VerificationType };
|