Sparticuz / usps-webtools-promise

USPS Web Tools API wrapper
14 stars 4 forks source link

Multiple validator #25

Closed derek-watson14 closed 11 months ago

derek-watson14 commented 11 months ago

Added the function verifyMultiple which allows users to pass up to five addresses to be validated in a single request. Documentation for this feature is here, on page 4:

https://www.usps.com/business/web-tools-apis/address-information-api.pdf

Under the section "AddressValidateRequest / Address /", which states: "Up to 5 address verifications can be included per transaction."

I have already written tests for the new functionality which pass, and updated the readme to reflect the new method.

I also had to add dotenv to the dev dependencies to run tests locally.

derek-watson14 commented 11 months ago

Pressed the button without writing a description first, please see above for details!

Sparticuz commented 11 months ago

This is great! I'll look at this soon! Thank you!

derek-watson14 commented 11 months ago

Looks like the tests are failing because the USPS userId isnt being read properly from the environment. I was getting the same message locally which is why I added the dotenv package to dev dependencies which resolved it. Let me know if there is anything I need to change so the tests can run on your end!

derek-watson14 commented 11 months ago

Tried dropping the dotenv package from the environment because I think it was conflicting with GitHub environment variables and causing the tests to fail. Hopefully.

Sparticuz commented 11 months ago

Got it loaded and the tests passed. My only note would be to run the lint and fix the errors and warnings. You can turn off the no-param-reassign for that page / those lines, whichever (unless you want to fix it 😄 ), and I think? "Error" in addresses[0]! will fix the no-prototype-builtins? not sure.

I think it's not loading the Github secrets because it's running from a fork.

Thanks! I'll merge once the linting is good

derek-watson14 commented 11 months ago

Should be good to go with the linting errors! Thanks for taking a look

Sparticuz commented 11 months ago

lgtm, thank you !