Refactor and remove the weight/measurement methods with params on Package and PackageItem
Opened this issue · 3 comments
Both the Package
and PackageItem
classes have methods to return weight and dimensions in all kinds of units. Moreover, those methods accept options hashes and parameters to modify the return values of those methods.
The latter is bad practice. But now with using measured
we can actually remove all of those methods I believe. Replace them with simply weight
and other methods for volumetric and dimensional calculations. Then have them return measured
objects which understand how to convert to different units by themselves.
Should make the files much much much simpler, and easier to work with.
Volumetric/Dimensional weight can't be calculated generically - it depends on the carrier's (and possibly their service's) density factor constant.
Canada Post has it different by service: 6000 for Expedited/Regular Parcel and 5000 for everything else
These functions are generally useless (I know we don't use it at all, instead opting to manually calculate it external to ActiveShipping), and potentially misleading. I'll start by removing them and re-implement them in a carrier-specific context.
Semi-related: the money parsing per carrier issue. I think solving this will provide a solution for this as well.
I'm really good with pushing these into the carrier implementations, and maybe having a default globally if it makes sense.
I'm going to remove this item from the 2.0 milestone, for now.