Skip to content

USPS: Not calculating packages total correctly when multiple packages #74

@StephenPAdams

Description

@StephenPAdams

Recently had a customer order 9 packages worth of items, essentially this configuration:

  • 8 boxes of 16x16x48 weighing 16 pounds each
  • 1 box of 14x14x6 weighing 2 pounds

...however what ends up coming back from USPS is some really goofy rates. And I believe it's because there's a package that returns Priority Mail and Ground (the 14x14x6 box) and the other packages all return just Ground. You can see the raw formatted XML response here:
https://gist.github.com/StephenPAdams/d3a9ec8c41eea5bbef7acde71ace08c2

Anyways, inside of the USPSProvider's ParseResult, it actually does a join by MailService. So the Ground total ends up being correct. However, you'll see any of the Priority Mail options all with very cheap rates like the Priority Mail 2 Day at $9.75.

The problem is when the rates are returned to the DotNetShipping SDK and then surfaced up...it appears that Priority Mail 2 day for $9.75 is the rate for all 9 packages...which isn't the case. If you look at the XML response, there are multiple top level PACKAGE nodes. But not each Package node has the same MailService in each. I'm guessing it's because some packages are available under certain services.

I think this is a more complicated problem. But a quickie fix would be to make sure that the MailService is available in each returned package. If it's not, it's removed as a rate. Otherwise we'd have to use unique package identifiers and then have the rates broken down by package and then there'd need to be a layer to calculate/tally them appropriately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions