Clip lowside weight at 0.1 lbs. Otherwise UPS will gripe at you.
This commit is contained in:
parent
8bcacc8316
commit
fe63bccea9
2 changed files with 39 additions and 6 deletions
|
|
@ -129,12 +129,14 @@ sub buildXML {
|
|||
$weight += $skuWeight;
|
||||
}
|
||||
next PACKAGE unless $weight;
|
||||
$weight = sprintf "%.1f", $weight;
|
||||
$weight = '0.1' if $weight == 0;
|
||||
my $options = {
|
||||
PackagingType => [ {
|
||||
Code => [ '02' ],
|
||||
} ],
|
||||
PackageWeight => [ {
|
||||
Weight => [ sprintf "%.1f", $weight ], ##Required formatting from spec
|
||||
Weight => [ $weight ], ##Required formatting from spec
|
||||
} ],
|
||||
};
|
||||
push @{ $packHash }, $options;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ $session->user({user => $user});
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $tests = 40;
|
||||
my $tests = 41;
|
||||
plan tests => 1 + $tests;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -93,6 +93,20 @@ my $nivBible = $bible->setCollateral('variantsJSON', 'variantId', 'new',
|
|||
}
|
||||
);
|
||||
|
||||
my $feather = $home->addChild({
|
||||
className => 'WebGUI::Asset::Sku::Product',
|
||||
isShippingRequired => 1, title => 'Feathers',
|
||||
shipsSeparately => 0,
|
||||
});
|
||||
|
||||
my $blueFeather = $feather->setCollateral('variantsJSON', 'variantId', 'new',
|
||||
{
|
||||
shortdesc => 'blue feather', price => 1.00,
|
||||
varSku => 'blue', weight => 0.001,
|
||||
quantity => 999999,
|
||||
}
|
||||
);
|
||||
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
|
||||
|
|
@ -385,8 +399,6 @@ my $xmlRate = XMLin($xmlR,
|
|||
KeepRoot => 1,
|
||||
);
|
||||
|
||||
diag Dumper $xmlRate;
|
||||
|
||||
cmp_deeply(
|
||||
$xmlRate, {
|
||||
RatingServiceSelectionRequest => {
|
||||
|
|
@ -463,6 +475,8 @@ $xmlRate = XMLin( $xmlR,
|
|||
ForceArray => ['Package'],
|
||||
);
|
||||
|
||||
diag Dumper $xmlRate;
|
||||
|
||||
cmp_deeply(
|
||||
$xmlRate, {
|
||||
RatingServiceSelectionRequest => {
|
||||
|
|
@ -475,13 +489,13 @@ cmp_deeply(
|
|||
Address => { PostalCode => 97123, CountryCode => 'us', },
|
||||
},
|
||||
ShipTo => {
|
||||
Address => { PostalCode => 53715, CountryCode => 'us', },
|
||||
Address => { PostalCode => 53715, CountryCode => 'us', ResidentialAddressIndicator => {}, },
|
||||
},
|
||||
Service => { Code => '03', },
|
||||
Package => bag(
|
||||
{
|
||||
PackagingType => { Code => '02', },
|
||||
PackageWeight => { Weight => '1.5', },
|
||||
PackageWeight => { Weight => '3.0', },
|
||||
},
|
||||
{
|
||||
PackagingType => { Code => '02', },
|
||||
|
|
@ -509,6 +523,23 @@ SKIP: {
|
|||
|
||||
ok($driver->getEditForm(), 'getEditForm');
|
||||
|
||||
$cart->empty;
|
||||
$feather->addToCart($feather->getCollateral('variantsJSON', 'variantId', $blueFeather));
|
||||
$xml = $driver->buildXML($cart, $driver->_getShippableUnits($cart));
|
||||
($xmlA, $xmlR) = split /\n(?=<\?xml)/, $xml;
|
||||
|
||||
$xmlRate = XMLin( $xmlR,
|
||||
KeepRoot => 1,
|
||||
ForceArray => ['Package'],
|
||||
);
|
||||
|
||||
is (
|
||||
$xmlRate->{RatingServiceSelectionRequest}->{Shipment}->{Package}->[0]->{PackageWeight}->{Weight},
|
||||
'0.1',
|
||||
'Weight is clipped at 0.1 pounds.'
|
||||
);
|
||||
|
||||
$cart->empty;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue