Skip to content

Commit 00bfaf1

Browse files
Add requestedProducts support to business and sole proprietor applications
Co-authored-by: GermanSmoliar <[email protected]>
1 parent 7ef40e2 commit 00bfaf1

File tree

2 files changed

+250
-0
lines changed

2 files changed

+250
-0
lines changed

tests/applications.spec.ts

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,129 @@ describe("Create Application", () => {
8181
const res = await unit.applications.get(createRes.data.id)
8282
expect(res.data.type).toBe("businessApplication")
8383
})
84+
85+
test("Create Business Application with requestedProducts", async () => {
86+
const req: CreateBusinessApplicationRequest = {
87+
"type": "businessApplication",
88+
"attributes": {
89+
"name": "Pied Piper",
90+
"address": {
91+
"street": "5230 Newell Rd",
92+
"city": "Palo Alto",
93+
"state": "CA",
94+
"postalCode": "94303",
95+
"country": "US"
96+
},
97+
"phone": {
98+
"countryCode": "1",
99+
"number": "5555555555"
100+
},
101+
"stateOfIncorporation": "DE",
102+
"ein": "123456789",
103+
"entityType": "Corporation",
104+
"contact": {
105+
"fullName": {
106+
"first": "Richard",
107+
"last": "Hendricks"
108+
},
109+
"email": "[email protected]",
110+
"phone": {
111+
"countryCode": "1",
112+
"number": "5555555555"
113+
}
114+
},
115+
"officer": {
116+
"fullName": {
117+
"first": "Richard",
118+
"last": "Hendricks"
119+
},
120+
"dateOfBirth": "2001-08-10",
121+
"title": "CEO",
122+
"ssn": "721074426",
123+
"email": "[email protected]",
124+
"phone": {
125+
"countryCode": "1",
126+
"number": "5555555555"
127+
},
128+
"address": {
129+
"street": "5230 Newell Rd",
130+
"city": "Palo Alto",
131+
"state": "CA",
132+
"postalCode": "94303",
133+
"country": "US"
134+
}
135+
},
136+
"beneficialOwners": [
137+
{
138+
"fullName": {
139+
"first": "Richard",
140+
"last": "Hendricks"
141+
},
142+
"dateOfBirth": "2001-08-10",
143+
"ssn": "123456789",
144+
"email": "[email protected]",
145+
"percentage": 75,
146+
"phone": {
147+
"countryCode": "1",
148+
"number": "5555555555"
149+
},
150+
"address": {
151+
"street": "5230 Newell Rd",
152+
"city": "Palo Alto",
153+
"state": "CA",
154+
"postalCode": "94303",
155+
"country": "US"
156+
}
157+
}
158+
],
159+
"requestedProducts": ["Banking", "BillPay"]
160+
}
161+
}
162+
163+
const res = await unit.applications.create(req)
164+
expect(res.data.type).toBe("businessApplication")
165+
})
166+
167+
test("Create Sole Proprietor Application with requestedProducts", async () => {
168+
const req: CreateSoleProprietorApplicationRequest = {
169+
"type": "individualApplication",
170+
"attributes": {
171+
"ssn": "721074426",
172+
"fullName": {
173+
"first": "Peter",
174+
"last": "Parker"
175+
},
176+
"dateOfBirth": "2001-08-10",
177+
"address": {
178+
"street": "20 Ingram St",
179+
"city": "Forest Hills",
180+
"state": "NY",
181+
"postalCode": "11375",
182+
"country": "US"
183+
},
184+
"email": "[email protected]",
185+
"phone": {
186+
"countryCode": "1",
187+
"number": "5555555555"
188+
},
189+
"ip": "127.0.0.2",
190+
"occupation": "ArchitectOrEngineer",
191+
"annualIncome": "Between50kAnd100k",
192+
"sourceOfIncome": "EmploymentOrPayrollIncome",
193+
"annualRevenue": "Between100kAnd200k",
194+
"soleProprietorship": true,
195+
"ein": "123456789",
196+
"dba": "Piedpiper Inc",
197+
"numberOfEmployees": "Between5And10",
198+
"businessVertical": "TechnologyMediaOrTelecom",
199+
"website": "https://www.piedpiper.com",
200+
"requestedProducts": ["Banking", "Capital"]
201+
}
202+
}
203+
204+
const res = await unit.applications.create(req)
205+
expect(res.data.type).toBe("individualApplication")
206+
})
84207
})
85208

86209
describe("Applications", () => {
@@ -533,6 +656,121 @@ describe("Business Applications", () => {
533656
expect(req.type).toBe("businessApplication")
534657
})
535658

659+
test("Simulation CreateBusinessApplicationRequest with requestedProducts - test structure", () => {
660+
const req: CreateBusinessApplicationRequest = {
661+
"type": "businessApplication",
662+
"attributes": {
663+
"name": "Pied Piper",
664+
"address": {
665+
"street": "5230 Newell Rd",
666+
"city": "Palo Alto",
667+
"state": "CA",
668+
"postalCode": "94303",
669+
"country": "US"
670+
},
671+
"phone": {
672+
"countryCode": "1",
673+
"number": "5555555555"
674+
},
675+
"stateOfIncorporation": "DE",
676+
"ein": "123456789",
677+
"entityType": "Corporation",
678+
"contact": {
679+
"fullName": {
680+
"first": "Richard",
681+
"last": "Hendricks"
682+
},
683+
"email": "[email protected]",
684+
"phone": {
685+
"countryCode": "1",
686+
"number": "5555555555"
687+
}
688+
},
689+
"officer": {
690+
"fullName": {
691+
"first": "Richard",
692+
"last": "Hendricks"
693+
},
694+
"dateOfBirth": "2001-08-10",
695+
"title": "CEO",
696+
"ssn": "721074426",
697+
"email": "[email protected]",
698+
"phone": {
699+
"countryCode": "1",
700+
"number": "5555555555"
701+
},
702+
"address": {
703+
"street": "5230 Newell Rd",
704+
"city": "Palo Alto",
705+
"state": "CA",
706+
"postalCode": "94303",
707+
"country": "US"
708+
}
709+
},
710+
"beneficialOwners": [
711+
{
712+
"fullName": {
713+
"first": "Richard",
714+
"last": "Hendricks"
715+
},
716+
"dateOfBirth": "2001-08-10",
717+
"ssn": "123456789",
718+
"email": "[email protected]",
719+
"percentage": 75,
720+
"phone": {
721+
"countryCode": "1",
722+
"number": "5555555555"
723+
},
724+
"address": {
725+
"street": "5230 Newell Rd",
726+
"city": "Palo Alto",
727+
"state": "CA",
728+
"postalCode": "94303",
729+
"country": "US"
730+
}
731+
}
732+
],
733+
"requestedProducts": ["Banking", "BillPay", "Capital"]
734+
}
735+
}
736+
737+
expect(req.type).toBe("businessApplication")
738+
expect(req.attributes.requestedProducts).toEqual(["Banking", "BillPay", "Capital"])
739+
})
740+
741+
test("Simulation CreateSoleProprietorApplicationRequest with requestedProducts - test structure", () => {
742+
const req: CreateSoleProprietorApplicationRequest = {
743+
"type": "individualApplication",
744+
"attributes": {
745+
"ssn": "721074426",
746+
"fullName": {
747+
"first": "Peter",
748+
"last": "Parker"
749+
},
750+
"dateOfBirth": "2001-08-10",
751+
"address": {
752+
"street": "20 Ingram St",
753+
"city": "Forest Hills",
754+
"state": "NY",
755+
"postalCode": "11375",
756+
"country": "US"
757+
},
758+
"email": "[email protected]",
759+
"phone": {
760+
"countryCode": "1",
761+
"number": "5555555555"
762+
},
763+
"soleProprietorship": true,
764+
"ein": "123456789",
765+
"dba": "Piedpiper Inc",
766+
"requestedProducts": ["Banking"]
767+
}
768+
}
769+
770+
expect(req.type).toBe("individualApplication")
771+
expect(req.attributes.requestedProducts).toEqual(["Banking"])
772+
})
773+
536774
test("Simulation UpdateBusinessApplicationRequest - test structure", async () => {
537775
const res = await createBusinessApplication(unit)
538776

types/application.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export type Application = IndividualApplication | BusinessApplication
1616

1717
export type ApplicationType = "businessApplication" | "individualApplication"
1818

19+
export type Product = "Banking" | "BillPay" | "Capital"
20+
1921
export type Occupation =
2022
"ArchitectOrEngineer" |
2123
"BusinessAnalystAccountantOrFinancialAdvisor" |
@@ -202,6 +204,11 @@ export interface BaseApplicationAttributes extends UnimplementedFields {
202204
* See [Tags](https://developers.unit.co/#tags).
203205
*/
204206
tags?: object
207+
208+
/**
209+
* Optional. The product being applied for. One of Banking, BillPay, or Capital.
210+
*/
211+
requestedProducts?: Product[]
205212
}
206213

207214
export interface BaseApplicationRelationships extends UnimplementedRelationships {
@@ -553,6 +560,11 @@ interface BaseCreateApplicationRequestAttributes {
553560
* Optional. A list of device fingerprints for fraud and risk prevention [See Device Fingerprints](https://developers.unit.co/applications/#device-fingerprints).
554561
*/
555562
deviceFingerprints?: DeviceFingerprint[]
563+
564+
/**
565+
* Optional. The product being applied for. One of Banking, BillPay, or Capital.
566+
*/
567+
requestedProducts?: Product[]
556568
}
557569

558570

0 commit comments

Comments
 (0)