lob / lob-typescript-sdk

MIT License
10 stars 7 forks source link

Add valid address value to US Address Verification response object #251

Closed mattalline closed 1 year ago

mattalline commented 1 year ago

Summary

When using the latest version of the published lob-typescript-sdk it appears that the valid_address component of the API response is not exposed.

Expected Behavior

Using the SDK provided here, when requesting a US Verification an attribute exists on the response object that maps back to valid_address if the call and JSON response were parsed directly.

Current Behavior

Attributes of the response are not mapped in the response object.

Possible Solution

https://github.com/lob/lob-typescript-sdk/blob/main/models/us-verification.ts#L26

The linked file is updated to expose a valid_address attribute mapped to the appropriate response field.

Steps to Reproduce

Example Request 1 (Curl)

curl --location --request POST 'https://api.lob.com/v1/us_verifications?case=proper' \
--header 'Authorization: [[redacted]]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "primary_line": "4858 Mian Street",
    "secondary_line": "",
    "city": "Yorba Linda",
    "state": "CA",
    "zip_code": "92886"
}'

Example Response 1

{
    "id": "us_ver_ec58dd2daa6d418b976d",
    "recipient": "",
    "primary_line": "4858 Main St",
    "secondary_line": "",
    "urbanization": "",
    "last_line": "Yorba Linda CA 92886",
    "deliverability": "undeliverable",
    "valid_address": true,
    "components": {
        "primary_number": "4858",
        "street_predirection": "",
        "street_name": "Main",
        "street_suffix": "St",
        "street_postdirection": "",
        "secondary_designator": "",
        "secondary_number": "",
        "pmb_designator": "",
        "pmb_number": "",
        "extra_secondary_designator": "",
        "extra_secondary_number": "",
        "city": "Yorba Linda",
        "state": "CA",
        "zip_code": "92886",
        "zip_code_plus_4": "",
        "zip_code_type": "standard",
        "delivery_point_barcode": "",
        "address_type": "",
        "record_type": "",
        "default_building_address": false,
        "county": "Orange",
        "county_fips": "06059",
        "carrier_route": "C025",
        "carrier_route_type": "city_delivery",
        "latitude": 33.8904,
        "longitude": -117.813659
    },
    "deliverability_analysis": {
        "dpv_confirmation": "N",
        "dpv_cmra": "",
        "dpv_vacant": "",
        "dpv_active": "",
        "dpv_footnotes": [
            "AA",
            "M3"
        ],
        "ews_match": false,
        "lacs_indicator": "",
        "lacs_return_code": "",
        "suite_return_code": ""
    },
    "lob_confidence_score": {
        "score": null,
        "level": ""
    },
    "object": "us_verification"
}

Example Request 2 (curl)

curl --location --request POST 'https://api.lob.com/v1/us_verifications?case=proper' \
--header 'Authorization: [[redacted]]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "primary_line": "1234123412344858 Mian Street",
    "secondary_line": "",
    "city": "Yorba Linda",
    "state": "CA",
    "zip_code": "92886"
}'

Example Response 2

{
    "id": "us_ver_e60c0411e54e48b483ef",
    "recipient": "",
    "primary_line": "1234123412344858 Mian Street",
    "secondary_line": "",
    "urbanization": "",
    "last_line": "Yorba Linda CA 92886",
    "deliverability": "undeliverable",
    "valid_address": false,
    "components": {
        "primary_number": "1234123412344858",
        "street_predirection": "",
        "street_name": "Mian",
        "street_suffix": "Street",
        "street_postdirection": "",
        "secondary_designator": "",
        "secondary_number": "",
        "pmb_designator": "",
        "pmb_number": "",
        "extra_secondary_designator": "",
        "extra_secondary_number": "",
        "city": "Yorba Linda",
        "state": "CA",
        "zip_code": "92886",
        "zip_code_plus_4": "",
        "zip_code_type": "standard",
        "delivery_point_barcode": "",
        "address_type": "",
        "record_type": "",
        "default_building_address": false,
        "county": "Orange",
        "county_fips": "06059",
        "carrier_route": "",
        "carrier_route_type": "",
        "latitude": null,
        "longitude": null
    },
    "deliverability_analysis": {
        "dpv_confirmation": "",
        "dpv_cmra": "",
        "dpv_vacant": "",
        "dpv_active": "",
        "dpv_footnotes": [
            "A1"
        ],
        "ews_match": false,
        "lacs_indicator": "N",
        "lacs_return_code": "",
        "suite_return_code": ""
    },
    "lob_confidence_score": {
        "score": null,
        "level": ""
    },
    "object": "us_verification"
}

Context (Environment)

Having this exposed will allow responses where the deliverability state is undeliverable to still be utilized by consumers. The use case being addresses of new construction for example.

BennyKitchell commented 1 year ago

Hey @mattalline,

Apologies for missing this, I think it got lost in my holiday emails. I will look into this and make it a priority to get a new version out. Thanks for the patience!

BennyKitchell commented 1 year ago

@mattalline The newest version can be found here this includes a solution to the issue above. Thanks!