Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add company field to identity validation #379

Merged
merged 4 commits into from
Aug 19, 2022
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
16 changes: 8 additions & 8 deletions docs/index.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: string

description: The name of the company or firm.

nullable: true

maxLength: 500
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: string

description: The name of the person whose identity is being validated.

nullable: true

maxLength: 500
14 changes: 7 additions & 7 deletions resources/identity_validation/identity_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ post:
content:
application/json:
schema:
$ref: "./models/multi_line_address.yml"
$ref: "./models/identity_validation_writable.yml"
example:
recipient: "Lob.com"
company: "Lob.com"
primary_line: "210 King St."
secondary_line: ""
city: "San Francisco"
Expand All @@ -25,9 +25,9 @@ post:

application/x-www-form-urlencoded:
schema:
$ref: "./models/multi_line_address.yml"
$ref: "./models/identity_validation_writable.yml"
example:
recipient: "Lob.com"
company: "Lob.com"
primary_line: "210 King St."
secondary_line: ""
city: "San Francisco"
Expand All @@ -36,9 +36,9 @@ post:

multipart/form-data:
schema:
$ref: "./models/multi_line_address.yml"
$ref: "./models/identity_validation_writable.yml"
example:
recipient: "Lob.com"
company: "Lob.com"
primary_line: "210 King St."
secondary_line: ""
city: "San Francisco"
Expand All @@ -57,7 +57,7 @@ post:
source: |
curl https://api.lob.com/v1/identity_validation \
-u <YOUR_LIVE_API_KEY>: \
-d "recipient=Lob.com" \
-d "company=Lob.com" \
-d "primary_line=210 King St" \
-d "secondary_line=" \
-d "urbanization=" \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
allOf:
- anyOf:
- title: Address with `recipient`
- title: Addresss with `company`

- type: object

properties:
id:
$ref: "../attributes/identity_validation_id.yml"

company:
$ref: "../attributes/identity_validation_company.yml"

primary_line:
$ref: "../../../shared/attributes/address/primary_line_us.yml"

secondary_line:
$ref: "../../../shared/attributes/address/secondary_line.yml"

urbanization:
$ref: "../../../shared/attributes/address/urbanization.yml"

last_line:
type: string
description: |
Combination of the following applicable `components`:
* City (`city`)
* State (`state`)
* ZIP code (`zip_code`)
* ZIP+4 (`zip_code_plus_4`)

score:
type: number
nullable: true
format: float
description: >
A numerical score between 0 and 100 that represents the likelihood the provided
name is associated with a physical address.
default: null
minimum: 0
maximum: 100

confidence:
type: string
enum:
- high
- medium
- low
- ""
description: |
Indicates the likelihood the recipient name and address match based on our custom internal calculation. Possible values are:
- `high` — Has a Lob confidence score greater than 70.
- `medium` — Has a Lob confidence score between 40 and 70.
- `low` — Has a Lob confidence score less than 40.
- `""` — No tracking data exists for this address.

object:
type: string
description: Value is resource type.
enum:
- id_validation
default: id_validation
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
allOf:
- anyOf:
- title: Address with `city` and `state`
required:
- city
- state
- title: Address with `zip_code`
required:
- zip_code

- type: object
required:
- company
- primary_line

properties:
company:
$ref: "../attributes/identity_validation_company.yml"

primary_line:
$ref: "../../../shared/attributes/address/primary_line_us.yml"

secondary_line:
$ref: "../../../shared/attributes/address/secondary_line.yml"

urbanization:
$ref: "../../../shared/attributes/address/urbanization.yml"

city:
allOf:
- $ref: "../../../shared/attributes/address/city/city_no_description.yml"
- type: string
description: >-
The name of the city. `city` and `state` are required if no `zip_code` is passed.

state:
type: string
description: >-
The <a href="https://en.wikipedia.org/wiki/ISO_3166-2:US" target="_blank">ISO 3166-2</a> two letter code or subdivision name for
the state. `city` and `state` are required if no `zip_code` is passed.
maxLength: 50

zip_code:
allOf:
- type: string
description: >-
Required if `city` and `state` are not passed in.
If included, must be formatted as a US ZIP or ZIP+4 (e.g. `94107`,
`941072282`, `94107-2282`).
- $ref: "../../../shared/attributes/address/zip_code.yml"
61 changes: 3 additions & 58 deletions resources/identity_validation/models/identity_validation.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,3 @@
type: object

properties:
id:
$ref: "../attributes/identity_validation_id.yml"

recipient:
$ref: "../../../shared/attributes/address/recipient.yml"

primary_line:
$ref: "../../../shared/attributes/address/primary_line_us.yml"

secondary_line:
$ref: "../../../shared/attributes/address/secondary_line.yml"

urbanization:
$ref: "../../../shared/attributes/address/urbanization.yml"

last_line:
type: string
description: |
Combination of the following applicable `components`:
* City (`city`)
* State (`state`)
* ZIP code (`zip_code`)
* ZIP+4 (`zip_code_plus_4`)

score:
type: number
nullable: true
format: float
description: >
A numerical score between 0 and 100 that represents the likelihood the provided
name is associated with a physical address.
default: null
minimum: 0
maximum: 100

confidence:
type: string
enum:
- high
- medium
- low
- ""
description: |
Indicates the likelihood the recipient name and address match based on our custom internal calculation. Possible values are:
- `high` — Has a Lob confidence score greater than 70.
- `medium` — Has a Lob confidence score between 40 and 70.
- `low` — Has a Lob confidence score less than 40.
- `""` — No tracking data exists for this address.

object:
type: string
description: Value is resource type.
enum:
- id_validation
default: id_validation
oneOf:
- $ref: "recipient_identity_validation.yml"
- $ref: "company_identity_validation.yml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
oneOf:
- $ref: "recipient_multi_line_address.yml"
- $ref: "company_multi_line_address.yml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
allOf:
- anyOf:
- title: Address with `recipient`
- title: Addresss with `company`

- type: object

properties:
id:
$ref: "../attributes/identity_validation_id.yml"

recipient:
$ref: "../attributes/identity_validation_recipient.yml"

primary_line:
$ref: "../../../shared/attributes/address/primary_line_us.yml"

secondary_line:
$ref: "../../../shared/attributes/address/secondary_line.yml"

urbanization:
$ref: "../../../shared/attributes/address/urbanization.yml"

last_line:
type: string
description: |
Combination of the following applicable `components`:
* City (`city`)
* State (`state`)
* ZIP code (`zip_code`)
* ZIP+4 (`zip_code_plus_4`)

score:
type: number
nullable: true
format: float
description: >
A numerical score between 0 and 100 that represents the likelihood the provided
name is associated with a physical address.
default: null
minimum: 0
maximum: 100

confidence:
type: string
enum:
- high
- medium
- low
- ""
description: |
Indicates the likelihood the recipient name and address match based on our custom internal calculation. Possible values are:
- `high` — Has a Lob confidence score greater than 70.
- `medium` — Has a Lob confidence score between 40 and 70.
- `low` — Has a Lob confidence score less than 40.
- `""` — No tracking data exists for this address.

object:
type: string
description: Value is resource type.
enum:
- id_validation
default: id_validation
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ allOf:

properties:
recipient:
$ref: "../../../shared/attributes/address/recipient.yml"
$ref: "../attributes/identity_validation_recipient.yml"

primary_line:
$ref: "../../../shared/attributes/address/primary_line_us.yml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ content:
$ref: "../models/identity_validation.yml"
example:
id: id_validation_8a013f3e
recipient: LOB.COM
company: LOB.COM
primary_line: 210 KING ST.
secondary_line: ""
urbanization: ""
Expand Down
33 changes: 30 additions & 3 deletions tests/identity_validation_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Prism = require("./setup.js");

// test specific data
const resource_endpoint = "/identity_validation",
recipient = "Lob.com",
company = "Lob HQ",
primary_line = "210 King St",
secondary_line = "",
city = "San Francisco",
Expand All @@ -22,7 +22,7 @@ test("validate recipient and address", async function (t) {
client.post(
resource_endpoint,
{
recipient: recipient,
recipient: company,
primary_line: primary_line,
secondary_line: secondary_line,
city: city,
Expand All @@ -43,7 +43,34 @@ test("validate recipient and address", async function (t) {
}
});

test("absent recipient", async function (t) {
test("validate company and address", async function (t) {
try {
const response = await prism.setup().then((client) =>
client.post(
resource_endpoint,
{
company: company,
primary_line: primary_line,
secondary_line: secondary_line,
city: city,
state: state,
zip_code: zip_code,
},
{ headers: prism.authHeader }
)
);

t.assert(response.status === 200);
} catch (prismError) {
if (Object.keys(prismError).length > 0) {
t.fail(JSON.stringify(prismError, null, 2));
} else {
t.fail(prismError.toString());
}
}
});

test("absent recipient and company", async function (t) {
try {
const response = await prism.setup({ errors: false }).then((client) =>
client.post(
Expand Down