Set a minimum package weight for USPS shipments. Handle per package errors.
This commit is contained in:
parent
977f0273f9
commit
ad2376fe4e
2 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue