Shopify / active_shipping

ActiveShipping is a simple shipping abstraction library extracted from Shopify
http://shopify.github.io/active_shipping
MIT License
812 stars 546 forks source link

Fix CanadaPostPWS#find_rates not sending dimensions #538

Closed maartenvg closed 7 years ago

maartenvg commented 7 years ago

Problem

Currently the common interface for find_rates is def find_rates(origin, destination, packages, options = {}). This is the case for all carriers, except CanadaPost and CanadaPostPWS. They use def find_rates(origin, destination, line_items = [], options = {}, package = nil, services = []) where line_items supposedly is an array of PackageItems. This then bubbles down via build_rate_request to parcel_node. There it takes package for the dimensions and package or line items for the weight.

Because the interface for CanadaPostPWS deviates from the others, any user that wants to send a consistent set of params to the carriers ends up sending packages to something that is called line_items on canada post, and leaves package nil. Which then results in a parcel_node with no package and only line items. This results in a parcel XML node that only contains the weight (from the sum of the line items) and no dimensions.

Solution

In this PR I'm changing a few things at once

maartenvg commented 7 years ago

Closing since this is going to be solved elsewhere (outside of this repo)