Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unit-finance/unit-node-sdk",
"version": "1.3.9",
"version": "1.3.10",
"description": "",
"main": "dist/unit.js",
"types": "dist/unit.d.ts",
Expand Down
257 changes: 257 additions & 0 deletions tests/applicationForms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,261 @@ describe("ApplicationForms", () => {

expect(applicationFormPrefill.applicationType).toBe("Business")
})

test("Create Application Form V2 for Business with requestedProducts", async () => {
const req: CreateApplicationFormV2 = {
type: "applicationForm",
attributes: {
idempotencyKey: Math.random().toString(36).substring(7),
applicantDetails: {
applicationType: "SingleMemberBusiness",
name: "Pied Piper",
address: {
street: "5230 Newell Rd",
city: "Palo Alto",
state: "CA",
postalCode: "94303",
country: "US"
},
phone: {
countryCode: "1",
number: "5555555555"
},
stateOfIncorporation: "DE",
ein: "123456789",
entityType: "Corporation",
contact: {
fullName: {
first: "Richard",
last: "Hendricks"
},
email: "richard@piedpiper.com",
phone: {
countryCode: "1",
number: "5555555555"
}
},
officer: {
fullName: {
first: "Richard",
last: "Hendricks"
},
dateOfBirth: "2001-08-10",
title: "CEO",
ssn: "721074426",
email: "richard@piedpiper.com",
phone: {
countryCode: "1",
number: "5555555555"
},
address: {
street: "5230 Newell Rd",
city: "Palo Alto",
state: "CA",
postalCode: "94303",
country: "US"
}
},
beneficialOwners: [
{
fullName: {
first: "Richard",
last: "Hendricks"
},
dateOfBirth: "2001-08-10",
ssn: "123456789",
email: "richard@piedpiper.com",
percentage: 75,
phone: {
countryCode: "1",
number: "5555555555"
},
address: {
street: "5230 Newell Rd",
city: "Palo Alto",
state: "CA",
postalCode: "94303",
country: "US"
}
}
],
businessVertical: "TechnologyMediaOrTelecom",
yearOfIncorporation: "2014"
},
requestedProducts: ["Banking", "BillPay"]
},
relationships: {}
}
const res = await unitWithVersion.applicationForms.create(req)
expect(res.data.type).toBe("applicationFormV2")
})

test("Create Application Form V2 for Sole Proprietor with requestedProducts", async () => {
const req: CreateApplicationFormV2 = {
type: "applicationForm",
attributes: {
idempotencyKey: Math.random().toString(36).substring(7),
applicantDetails: {
applicationType: "SoleProprietorship",
fullName: {
first: "Peter",
last: "Parker"
},
ssn: "721074426",
dateOfBirth: "2001-08-10",
address: {
street: "20 Ingram St",
city: "Forest Hills",
state: "NY",
postalCode: "11375",
country: "US"
},
email: "peter@oscorp.com",
phone: {
countryCode: "1",
number: "5555555555"
},
occupation: "ArchitectOrEngineer",
annualIncome: "Between50kAnd100k",
sourceOfIncome: "EmploymentOrPayrollIncome",
annualRevenue: "Between100kAnd200k",
ein: "123456789",
dba: "Piedpiper Inc",
numberOfEmployees: "Between5And10",
businessVertical: "TechnologyMediaOrTelecom",
website: "https://www.piedpiper.com"
},
requestedProducts: ["BillPay"]
},
relationships: {}
}
const res = await unitWithVersion.applicationForms.create(req)
expect(res.data.type).toBe("applicationFormV2")
})

test("Simulation CreateApplicationFormV2 for Business with requestedProducts - test structure", () => {
const req: CreateApplicationFormV2 = {
type: "applicationForm",
attributes: {
idempotencyKey: "3a1a33be-4e12-4603-9ed0-820922389fb8",
applicantDetails: {
applicationType: "Business",
name: "Pied Piper",
address: {
street: "5230 Newell Rd",
city: "Palo Alto",
state: "CA",
postalCode: "94303",
country: "US"
},
phone: {
countryCode: "1",
number: "5555555555"
},
stateOfIncorporation: "DE",
ein: "123456789",
entityType: "Corporation",
contact: {
fullName: {
first: "Richard",
last: "Hendricks"
},
email: "richard@piedpiper.com",
phone: {
countryCode: "1",
number: "5555555555"
}
},
officer: {
fullName: {
first: "Richard",
last: "Hendricks"
},
dateOfBirth: "2001-08-10",
title: "CEO",
ssn: "721074426",
email: "richard@piedpiper.com",
phone: {
countryCode: "1",
number: "5555555555"
},
address: {
street: "5230 Newell Rd",
city: "Palo Alto",
state: "CA",
postalCode: "94303",
country: "US"
}
},
beneficialOwners: [
{
fullName: {
first: "Richard",
last: "Hendricks"
},
dateOfBirth: "2001-08-10",
ssn: "123456789",
email: "richard@piedpiper.com",
percentage: 75,
phone: {
countryCode: "1",
number: "5555555555"
},
address: {
street: "5230 Newell Rd",
city: "Palo Alto",
state: "CA",
postalCode: "94303",
country: "US"
}
}
],
businessVertical: "TechnologyMediaOrTelecom",
yearOfIncorporation: "2014"
},
requestedProducts: ["Banking", "BillPay", "Capital"]
},
relationships: {}
}

expect(req.type).toBe("applicationForm")
expect(req.attributes.requestedProducts).toEqual(["Banking", "BillPay", "Capital"])
})

test("Simulation CreateApplicationFormV2 for Sole Proprietor with requestedProducts - test structure", () => {
const req: CreateApplicationFormV2 = {
type: "applicationForm",
attributes: {
idempotencyKey: "3a1a33be-4e12-4603-9ed0-820922389fb8",
applicantDetails: {
applicationType: "SoleProprietorship",
fullName: {
first: "Peter",
last: "Parker"
},
ssn: "721074426",
dateOfBirth: "2001-08-10",
address: {
street: "20 Ingram St",
city: "Forest Hills",
state: "NY",
postalCode: "11375",
country: "US"
},
email: "peter@oscorp.com",
phone: {
countryCode: "1",
number: "5555555555"
},
ein: "123456789",
dba: "Piedpiper Inc"
},
requestedProducts: ["Banking"]
},
relationships: {}
}

expect(req.type).toBe("applicationForm")
expect(req.attributes.requestedProducts).toEqual(["Banking"])
})
})
Loading