1+ import { Except } from "type-fest" ;
12import { AboundBaseResource } from "./base/AboundBaseResource" ;
2- import { Pagination } from "./base/AboundResource" ;
3+ import { Notes , Pagination } from "./base/AboundResource" ;
34import { AboundBulkResponse , AboundResponse } from "./base/AboundResponse" ;
45
56// request body
67export interface UserRequest {
78 email ?: string ;
89 foreignId ?: string ;
10+ notes ?: Notes ;
911 profile ?: UserProfile ;
12+ business ?: UserBusiness ;
1013}
1114
1215export interface UserProfile {
@@ -21,7 +24,32 @@ export interface UserProfile {
2124 phoneNumber ?: string ; // no country code, numerical digits only
2225 dateOfBirth ?: string ; // YYYY-MM-DD
2326 socialSecurityNumber ?: string ; // no hyphens, numerical digits only
24- ipAddress ?: string ;
27+ }
28+
29+ export interface UserBusiness {
30+ ein : string ; // no hyphens, numerical digits only
31+ name : string ;
32+ taxClassification ?: TaxClassification ;
33+ address ?: string ;
34+ address2 ?: string ;
35+ city ?: string ;
36+ state ?: string ;
37+ country ?: string ; // The user's country of residence. Adhering to the ISO 3166-2 format.
38+ zipcode ?: string ;
39+ }
40+
41+ export enum TaxClassification {
42+ C_CORPORATION = "cCorporation" ,
43+ ESTATE = "estate" ,
44+ INDIVIDUAL = "individual" ,
45+ LLC_PARTNERSHIP = "llcPartnership" ,
46+ LLC_C_CORPORATION = "llcCCorporation" ,
47+ LLC_S_CORPORATION = "llcSCorporation" ,
48+ PARTNERSHIP = "partnership" ,
49+ S_CORPORATION = "sCorporation" ,
50+ SINGLE_MEMBER_LLC = "singleMemberLlc" ,
51+ SOLE_PROPRIETOR = "soleProprietor" ,
52+ TRUST = "trust" ,
2553}
2654
2755// query params
@@ -32,6 +60,30 @@ export interface UserParameters extends Pagination {
3260// response body
3361export interface User extends UserRequest {
3462 userId : Readonly < string > ;
63+ einVerification : TinVerification ;
64+ ssnVerification : TinVerification ;
65+ }
66+
67+ // list response body
68+ export type BaseUser = Except <
69+ User ,
70+ "business" | "einVerification" | "profile" | "ssnVerification"
71+ > ;
72+
73+ export interface TinVerification {
74+ status : TinVerificationStatus ;
75+ message ?: string ;
76+ lastVerifiedTimestamp ?: number ;
77+ unlockTimestamp ?: number ;
78+ }
79+
80+ export enum TinVerificationStatus {
81+ ERROR = "error" ,
82+ LOCKED_OUT = "lockedOut" ,
83+ MISMATCH = "mismatch" ,
84+ PENDING = "pending" ,
85+ UNVERIFIED = "unverified" ,
86+ VERIFIED = "verified" ,
3587}
3688
3789// The raw `User` object returned from the APIs returns one deprecated field, which the SDK will remove.
@@ -55,8 +107,20 @@ export default class Users extends AboundBaseResource<
55107
56108 public async list (
57109 parameters ?: UserParameters
58- ) : Promise < AboundBulkResponse < User > > {
59- return super . listBaseResource ( parameters ) ;
110+ ) : Promise < AboundBulkResponse < BaseUser > > {
111+ const response = await super . listBaseResource ( parameters ) ;
112+ return {
113+ ...response ,
114+ data : response . data . map < BaseUser > (
115+ ( {
116+ business,
117+ einVerification,
118+ profile,
119+ ssnVerification,
120+ ...baseUser
121+ } ) => baseUser
122+ ) ,
123+ } ;
60124 }
61125
62126 public async create ( user : UserRequest ) : Promise < AboundResponse < User > > {
0 commit comments