alexeybusygin / ShippingRates

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

UPS CustomerClassification is ignored #81

Closed ebaj-tech closed 1 month ago

ebaj-tech commented 1 month ago

Any setting of the property UPSProviderConfiguration.CustomerClassification is ignored if shipment.OriginAddress.CountryCode is not "US". Could you please check the method Build() in the class UpsRatingRequestBuilder? The following lines of code are only executed if shipFromUS is true:

var code = ((int)customerClassification).ToString("D2");
request.RateRequest.CustomerClassification = new CustomerClassification() { Code = code };

In my opinion, there should always be a new object of CustomerClassification() { Code = code }. If I ignore the value of shipFromUS, then the response is correct.

alexeybusygin commented 1 month ago

That's what UPS has in the documentation: image

Do I understand you correctly that API processes CustomerClassification even if the sender's country is not the US?

ebaj-tech commented 1 month ago

Yes, that's correct. And I can see now that it's described differently in the documentation. But in the old API interface I always had to set the value for CustomerClassification to "53". This gave us the standard list prices. Without this value "53" the prices are too low. This seems to be the same for the ShippingRates Nuget package. For example, if the origin address and the delivery address are in Germany, then it makes a big price difference whether I set CustomerClassification to "53" or not.

ebaj-tech commented 1 month ago

If the UPS documentation was correct, it would mean that there would only be standard rates for the US. That doesn't seem to be correctly described to me.

ebaj-tech commented 1 month ago

Here's something else interesting. The API also gives me the correct standard list price in the following configuration: UseNegotiatedRates = false, CustomerClassification = "00" But currently the value for CustomerClassification can only be set within US shipping if(shipFromUS == true). I hope that helps you.

alexeybusygin commented 1 month ago

Could you please check the latest version 2.2.3? It should now pass CustomerClassification for all shipments.

ebaj-tech commented 1 month ago

It works just fine! Thank you for implementing this feature!