nopSolutions / FedEx-plugin-for-nopcommerce

Shipping plugin for FedEx
https://www.nopcommerce.com/
GNU General Public License v3.0
9 stars 15 forks source link

Update FedexService.cs #9

Open borissedov opened 1 year ago

borissedov commented 1 year ago

The existing behaviour leads to XSD scheme validation errors. The dimensions suppose to be passed as Integer values.

c4l3b commented 9 months ago

@borissedov this calculation is technically incorrect. FedEx wants you to round fractions to the nearest whole inch. So 4.4 becomes 4 and 4.5 becomes 5. Your change may result in undersized calculation. https://www.fedex.com/en-us/shipping/packaging/what-is-dimensional-weight.html

borissedov commented 9 months ago

I understand that it may cause rounding issue but the Fedex API doesn’t accept float values for this field. I have found it in our project and want to share the experience.

c4l3b commented 9 months ago

Yes I understand. I would suggest that you do actual rounding using Math.Round() instead of simply casting to an integer. This will make the value correct.