diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 85fac6dd4..b8a78ac09 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -6,6 +6,8 @@ - fixed #11197: Survey Edit Console is not i18n'ed - fixed USPS driver only works on domestic addresses. - fixed Shop is not sending notification emails to the user, or to the notification group. + - Set a minimum package weight of 1 oz for the USPS driver. + - Handle per package errors in USPS response data. 7.8.3 - Rewrote Spectre's workflow queues to prevent it from "forgetting" about some workflows. diff --git a/lib/WebGUI/Shop/ShipDriver/USPS.pm b/lib/WebGUI/Shop/ShipDriver/USPS.pm index 18828d1ff..0d7b88cae 100644 --- a/lib/WebGUI/Shop/ShipDriver/USPS.pm +++ b/lib/WebGUI/Shop/ShipDriver/USPS.pm @@ -74,6 +74,9 @@ sub buildXML { } my $pounds = int($weight); my $ounces = int(16 * ($weight - $pounds)); + if ($pounds == 0 && $ounces == 0 ) { + $ounces = 1; + } my $destination = $package->[0]->getShippingAddress; my $destZipCode = $destination->get('code'); $packageData{ID} = $packageIndex; @@ -199,6 +202,9 @@ sub _calculateFromXML { if ($id < 0 || $id > $#shippableUnits) { WebGUI::Error::Shop::RemoteShippingRate->throw(error => "Illegal package index returned by USPS: $id"); } + if (exists $package->{Error}) { + WebGUI::Error::Shop::RemoteShippingRate->throw(error => $package->{Description}); + } my $unit = $shippableUnits[$id]; if ($unit->[0]->getSku->shipsSeparately) { ##This is a single item due to ships separately. Since in reality there will be