Set a minimum package weight for USPS shipments. Handle per package errors.

This commit is contained in:
Colin Kuskie 2009-11-05 09:05:00 -08:00
parent 977f0273f9
commit ad2376fe4e
2 changed files with 8 additions and 0 deletions

View file

@ -6,6 +6,8 @@
- fixed #11197: Survey Edit Console is not i18n'ed - fixed #11197: Survey Edit Console is not i18n'ed
- fixed USPS driver only works on domestic addresses. - fixed USPS driver only works on domestic addresses.
- fixed Shop is not sending notification emails to the user, or to the notification group. - 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 7.8.3
- Rewrote Spectre's workflow queues to prevent it from "forgetting" about some workflows. - Rewrote Spectre's workflow queues to prevent it from "forgetting" about some workflows.

View file

@ -74,6 +74,9 @@ sub buildXML {
} }
my $pounds = int($weight); my $pounds = int($weight);
my $ounces = int(16 * ($weight - $pounds)); my $ounces = int(16 * ($weight - $pounds));
if ($pounds == 0 && $ounces == 0 ) {
$ounces = 1;
}
my $destination = $package->[0]->getShippingAddress; my $destination = $package->[0]->getShippingAddress;
my $destZipCode = $destination->get('code'); my $destZipCode = $destination->get('code');
$packageData{ID} = $packageIndex; $packageData{ID} = $packageIndex;
@ -199,6 +202,9 @@ sub _calculateFromXML {
if ($id < 0 || $id > $#shippableUnits) { if ($id < 0 || $id > $#shippableUnits) {
WebGUI::Error::Shop::RemoteShippingRate->throw(error => "Illegal package index returned by USPS: $id"); 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]; my $unit = $shippableUnits[$id];
if ($unit->[0]->getSku->shipsSeparately) { if ($unit->[0]->getSku->shipsSeparately) {
##This is a single item due to ships separately. Since in reality there will be ##This is a single item due to ships separately. Since in reality there will be