alexeybusygin / ShippingRates

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

Support for kg/cm measures for UPS shipments outside of the US #69

Closed alexeybusygin closed 3 months ago

alexeybusygin commented 3 months ago

Discussed in https://github.com/alexeybusygin/ShippingRates/discussions/67

Originally posted by **ebaj-tech** August 5, 2024 After calling GetRatesAsync(), I receive the following error message: **111057 Invalid Unit of Measurement for the given country** How can the UnitOfMeasurement for packages be set? The following instructions should be possible: **shipment.ShipmentTotalWeight.UnitOfMeasurement.Code = "KGS"; shipment.ShipmentTotalWeight.UnitOfMeasurement.Description = "KILOGRAMS"; shipment.Package.Dimensions.UnitOfMeasurement.Code = "CM"; shipment.Package.Dimensions.UnitOfMeasurement.Description = "CENTIMETERS";** Or when creating the packages: **var package = new Package( 12, 12, 12, 35, 150, "CM", "KGS" );** How can the error be fixed, or how can the correct units be used?
alexeybusygin commented 3 months ago

Starting from v2.2.0, the UPS provider sends kg/cm dimensions for shipments from outside the US. Package dimensions are automatically converted to the necessary system of measurement. Along with the existing Packages class (accepting values for lbs and inches), a new PackageKgCm class is introduced. Both classes can be used for shipments.