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

Limit itemCode to 50 characters #127

Open
ericsaupe opened this issue Jun 10, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@ericsaupe
Copy link
Contributor

commented Jun 10, 2019

While investigating an issue with our tax responses coming back as bad we received this in the response. We should limit the itemCode field to 50 characters as requested. We should also look into any other fields that have limits.

{
    "error" => {
           "code" => "ModelStateInvalid",
        "message" => "Field 'itemCode' has an invalid length.",
         "target" => "HttpRequest",
        "details" => [
            [0] {
                       "code" => "MaxStringLengthError",
                     "number" => 14,
                    "message" => "Field 'itemCode' has an invalid length.",
                "description" => "Field 'itemCode' must be no more than 50 characters in length.",
                  "faultCode" => "Client",
                   "helpLink" => "http://developer.avalara.com/avatax/errors/MaxStringLengthError",
                   "severity" => "Error"
            }
        ]
    }
}

Affected lines

@dhonig

This comment has been minimized.

Copy link

commented Jun 10, 2019

Interesting to know what field you used that was longer than 50 chars? Is it safe to limit this to substr(0,49) or do we need to do something else?

@ericsaupe

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2019

For us it was the shipping_method.name. We display the name on the frontend so it allows editing more easily than having it hard coded. Changing to shipping_method.internal_name would have resolved it for us but may still not for others. I used truncate in the patch for our site but that can interfere with items that may be set specifically in AvaTax that are taxing based on itemCode instead of relying on the category.

I think substr or truncate are fine the issue is just to get it down to 50 characters to be in compliance of their API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.