active_shipping icon indicating copy to clipboard operation
active_shipping copied to clipboard

UPS > get_delivery_date_estimates > need one more tag called TotalPackagesInShipment

Open FantasticJimmy opened this issue 8 years ago • 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

FantasticJimmy avatar Jan 18 '17 19:01 FantasticJimmy

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.

jonathankwok avatar Jan 20 '17 16:01 jonathankwok

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.

AdnanTheExcellent avatar Jul 07 '17 16:07 AdnanTheExcellent