alexeybusygin / ShippingRates

.NET wrapper for UPS, FedEx, USPS and DHL shipping rate APIs
MIT License
48 stars 15 forks source link

UPS OAuth token and Commercial/Residential Addresses #64

Open owi2000 opened 4 months ago

owi2000 commented 4 months ago

With the UPS change to use OAuth tokens for their APIs, I'm having trouble with setting the residential flag for delivery addresses. UPS offers the Address Validation API free to it's customers that we've been using to get the residential/commercial status of addresses. The problem is that ShippingRates neither has the AddressValidation API included in it, nor does not allow access to get the OAuth token (it's an internal class). This means in order to access this API, I would need to generate my own token, even though the token acquired using ShippingRates would be valid for any UPS API requests for several hours. (I would prefer not to have to do this, since the goal of using ShippingRates is to simplify our interactions with the different carriers.)

I would like to see either the ShippingRates utilizing the AddressValidation API (so the dev doesn't need to set the Residential flag in requests) or the token be made available to the dev (this would necessarily include the requirement for methods to obtain a new token automatically in the event the current one expired).

I should note that the FedEx also has an Address Validation API, so this could also apply to FedEx. The rates for both services is dependent upon whether or not the address is a residential address, so including these API's in ShippingRates would make sense.

alexeybusygin commented 4 months ago

Sounds like a good idea! Will take this in work.

alexeybusygin commented 3 months ago

The development is halfway done already, but I've discovered that my UPS client ID/client secret does not have permission to access the AddressValidation API. I have no control over the UPS credentials I use for development (and we are no longer using UPS in production), so I can't change them. If you can provide me (via email alexey@busygin.com) with UPS credentials with access to both Rating and AddressValidation, then that would speed things up a lot.