Skip to content

Commit 9d6ec15

Browse files
authored
Merge pull request #537 from unit-finance/copilot/add-requested-products-support
Add requestedProducts field to business and sole proprietor applications
2 parents 53e899e + 69c6e4d commit 9d6ec15

File tree

6 files changed

+523
-4
lines changed

6 files changed

+523
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@unit-finance/unit-node-sdk",
3-
"version": "1.3.9",
3+
"version": "1.3.10",
44
"description": "",
55
"main": "dist/unit.js",
66
"types": "dist/unit.d.ts",

tests/applicationForms.spec.ts

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,261 @@ describe("ApplicationForms", () => {
150150

151151
expect(applicationFormPrefill.applicationType).toBe("Business")
152152
})
153+
154+
test("Create Application Form V2 for Business with requestedProducts", async () => {
155+
const req: CreateApplicationFormV2 = {
156+
type: "applicationForm",
157+
attributes: {
158+
idempotencyKey: Math.random().toString(36).substring(7),
159+
applicantDetails: {
160+
applicationType: "SingleMemberBusiness",
161+
name: "Pied Piper",
162+
address: {
163+
street: "5230 Newell Rd",
164+
city: "Palo Alto",
165+
state: "CA",
166+
postalCode: "94303",
167+
country: "US"
168+
},
169+
phone: {
170+
countryCode: "1",
171+
number: "5555555555"
172+
},
173+
stateOfIncorporation: "DE",
174+
ein: "123456789",
175+
entityType: "Corporation",
176+
contact: {
177+
fullName: {
178+
first: "Richard",
179+
last: "Hendricks"
180+
},
181+
182+
phone: {
183+
countryCode: "1",
184+
number: "5555555555"
185+
}
186+
},
187+
officer: {
188+
fullName: {
189+
first: "Richard",
190+
last: "Hendricks"
191+
},
192+
dateOfBirth: "2001-08-10",
193+
title: "CEO",
194+
ssn: "721074426",
195+
196+
phone: {
197+
countryCode: "1",
198+
number: "5555555555"
199+
},
200+
address: {
201+
street: "5230 Newell Rd",
202+
city: "Palo Alto",
203+
state: "CA",
204+
postalCode: "94303",
205+
country: "US"
206+
}
207+
},
208+
beneficialOwners: [
209+
{
210+
fullName: {
211+
first: "Richard",
212+
last: "Hendricks"
213+
},
214+
dateOfBirth: "2001-08-10",
215+
ssn: "123456789",
216+
217+
percentage: 75,
218+
phone: {
219+
countryCode: "1",
220+
number: "5555555555"
221+
},
222+
address: {
223+
street: "5230 Newell Rd",
224+
city: "Palo Alto",
225+
state: "CA",
226+
postalCode: "94303",
227+
country: "US"
228+
}
229+
}
230+
],
231+
businessVertical: "TechnologyMediaOrTelecom",
232+
yearOfIncorporation: "2014"
233+
},
234+
requestedProducts: ["Banking", "BillPay"]
235+
},
236+
relationships: {}
237+
}
238+
const res = await unitWithVersion.applicationForms.create(req)
239+
expect(res.data.type).toBe("applicationFormV2")
240+
})
241+
242+
test("Create Application Form V2 for Sole Proprietor with requestedProducts", async () => {
243+
const req: CreateApplicationFormV2 = {
244+
type: "applicationForm",
245+
attributes: {
246+
idempotencyKey: Math.random().toString(36).substring(7),
247+
applicantDetails: {
248+
applicationType: "SoleProprietorship",
249+
fullName: {
250+
first: "Peter",
251+
last: "Parker"
252+
},
253+
ssn: "721074426",
254+
dateOfBirth: "2001-08-10",
255+
address: {
256+
street: "20 Ingram St",
257+
city: "Forest Hills",
258+
state: "NY",
259+
postalCode: "11375",
260+
country: "US"
261+
},
262+
263+
phone: {
264+
countryCode: "1",
265+
number: "5555555555"
266+
},
267+
occupation: "ArchitectOrEngineer",
268+
annualIncome: "Between50kAnd100k",
269+
sourceOfIncome: "EmploymentOrPayrollIncome",
270+
annualRevenue: "Between100kAnd200k",
271+
ein: "123456789",
272+
dba: "Piedpiper Inc",
273+
numberOfEmployees: "Between5And10",
274+
businessVertical: "TechnologyMediaOrTelecom",
275+
website: "https://www.piedpiper.com"
276+
},
277+
requestedProducts: ["BillPay"]
278+
},
279+
relationships: {}
280+
}
281+
const res = await unitWithVersion.applicationForms.create(req)
282+
expect(res.data.type).toBe("applicationFormV2")
283+
})
284+
285+
test("Simulation CreateApplicationFormV2 for Business with requestedProducts - test structure", () => {
286+
const req: CreateApplicationFormV2 = {
287+
type: "applicationForm",
288+
attributes: {
289+
idempotencyKey: "3a1a33be-4e12-4603-9ed0-820922389fb8",
290+
applicantDetails: {
291+
applicationType: "Business",
292+
name: "Pied Piper",
293+
address: {
294+
street: "5230 Newell Rd",
295+
city: "Palo Alto",
296+
state: "CA",
297+
postalCode: "94303",
298+
country: "US"
299+
},
300+
phone: {
301+
countryCode: "1",
302+
number: "5555555555"
303+
},
304+
stateOfIncorporation: "DE",
305+
ein: "123456789",
306+
entityType: "Corporation",
307+
contact: {
308+
fullName: {
309+
first: "Richard",
310+
last: "Hendricks"
311+
},
312+
313+
phone: {
314+
countryCode: "1",
315+
number: "5555555555"
316+
}
317+
},
318+
officer: {
319+
fullName: {
320+
first: "Richard",
321+
last: "Hendricks"
322+
},
323+
dateOfBirth: "2001-08-10",
324+
title: "CEO",
325+
ssn: "721074426",
326+
327+
phone: {
328+
countryCode: "1",
329+
number: "5555555555"
330+
},
331+
address: {
332+
street: "5230 Newell Rd",
333+
city: "Palo Alto",
334+
state: "CA",
335+
postalCode: "94303",
336+
country: "US"
337+
}
338+
},
339+
beneficialOwners: [
340+
{
341+
fullName: {
342+
first: "Richard",
343+
last: "Hendricks"
344+
},
345+
dateOfBirth: "2001-08-10",
346+
ssn: "123456789",
347+
348+
percentage: 75,
349+
phone: {
350+
countryCode: "1",
351+
number: "5555555555"
352+
},
353+
address: {
354+
street: "5230 Newell Rd",
355+
city: "Palo Alto",
356+
state: "CA",
357+
postalCode: "94303",
358+
country: "US"
359+
}
360+
}
361+
],
362+
businessVertical: "TechnologyMediaOrTelecom",
363+
yearOfIncorporation: "2014"
364+
},
365+
requestedProducts: ["Banking", "BillPay", "Capital"]
366+
},
367+
relationships: {}
368+
}
369+
370+
expect(req.type).toBe("applicationForm")
371+
expect(req.attributes.requestedProducts).toEqual(["Banking", "BillPay", "Capital"])
372+
})
373+
374+
test("Simulation CreateApplicationFormV2 for Sole Proprietor with requestedProducts - test structure", () => {
375+
const req: CreateApplicationFormV2 = {
376+
type: "applicationForm",
377+
attributes: {
378+
idempotencyKey: "3a1a33be-4e12-4603-9ed0-820922389fb8",
379+
applicantDetails: {
380+
applicationType: "SoleProprietorship",
381+
fullName: {
382+
first: "Peter",
383+
last: "Parker"
384+
},
385+
ssn: "721074426",
386+
dateOfBirth: "2001-08-10",
387+
address: {
388+
street: "20 Ingram St",
389+
city: "Forest Hills",
390+
state: "NY",
391+
postalCode: "11375",
392+
country: "US"
393+
},
394+
395+
phone: {
396+
countryCode: "1",
397+
number: "5555555555"
398+
},
399+
ein: "123456789",
400+
dba: "Piedpiper Inc"
401+
},
402+
requestedProducts: ["Banking"]
403+
},
404+
relationships: {}
405+
}
406+
407+
expect(req.type).toBe("applicationForm")
408+
expect(req.attributes.requestedProducts).toEqual(["Banking"])
409+
})
153410
})

0 commit comments

Comments
 (0)