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

Only consider an address valid if coordinates are returned #25

Merged
merged 1 commit into from Jan 5, 2021
Merged

Only consider an address valid if coordinates are returned #25

merged 1 commit into from Jan 5, 2021

Conversation

benface
Copy link
Contributor

@benface benface commented Dec 23, 2020

When entering an invalid ZIP code (e.g. 99999), Avatax's address validation API responds with something like this:

{
    "address": {
        "textCase": "Mixed",
        "line1": "123 Pratt St",
        "city": "Durham",
        "region": "AK",
        "country": "US",
        "postalCode": "99999"
    },
    "validatedAddresses": [
        {
            "addressType": "UnknownAddressType",
            "line1": "123 Pratt St",
            "line2": "",
            "line3": "",
            "city": "Durham",
            "region": "AK",
            "country": "US",
            "postalCode": "99999"
        }
    ],
    "resolutionQuality": "External",
    "messages": [
        {
            "summary": "Address not geocoded.",
            "details": "Address cannot be geocoded.",
            "refersTo": "Address",
            "severity": "Error",
            "source": "Avalara.AvaTax.Common"
        },
        {
            "summary": "The city could not be determined.",
            "details": "The city could not be found or determined from postal code.",
            "refersTo": "Address.City",
            "severity": "Error",
            "source": "Avalara.AvaTax.Common"
        }
    ]
}

...which is currently considered valid by this plugin, but I don't think it should be. I'm suggesting changing the condition that determines whether an address is valid to require an entry in validatedAddresses AND have coordinates (latitude and longitude), instead of OR.

@imagehat imagehat merged commit ed6a848 into surprisehighway:master Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants