Shopify/active_shipping

UPS > get_delivery_date_estimates > need one more tag called TotalPackagesInShipment

Opened this issue · 2 comments

Hi,

As I was playing with the UPS testing API, specifically the ups.get_delivery_date_estimates.
Error was returned to me saying "weight is invalid." I later discover that this was due to the fact, if no TotalPackagesInShipment tag was given, it is by default assuming that the shipment only contains one package.
So in the ups.rb file, under function build_delivery_dates_request:

I added for the request to be valid.

If you think this is a valid issue, please modify and update the gem please.

        xml.Weight([value.round(3), 0.1].max)
      end

#################
xml.TotalPackagesInShipment(packages.count)
####################
if packages.any? {|package| package.value.present?}

Thank you.

Jimmy

Hey @FantasticJimmy. Thanks for the insight - up until recently we hadn't handled cases where shipments could have multiple packages, hence the missing xml.TotalPackagesInShipment.

Your change is pretty straightforward and does the job, so if you would like to raise a PR, feel free to do so.

Thank you for bringing this up. I have been trying to fix this problem for a while now and couldnt figure it out until i saw this post.