Have the USPS shipping driver accept ZIP+4, even if USPS doesn't.
This commit is contained in:
parent
ddf3fa108f
commit
cc0cc0ba64
3 changed files with 58 additions and 4 deletions
|
|
@ -25,7 +25,7 @@ use WebGUI::Test; # Must use this before any other WebGUI modules
|
|||
use WebGUI::Session;
|
||||
use WebGUI::Shop::ShipDriver::USPS;
|
||||
|
||||
plan tests => 66;
|
||||
plan tests => 69;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -232,6 +232,13 @@ my $wucAddress = $addressBook->addAddress({
|
|||
city => 'Madison', state => 'WI', code => '53703',
|
||||
country => 'United States',
|
||||
});
|
||||
my $zip4Address = $addressBook->addAddress({
|
||||
label => 'work-zip4',
|
||||
organization => 'Plain Black Corporation',
|
||||
address1 => '1360 Regent St. #145',
|
||||
city => 'Madison', state => 'WI', code => '53715-1255',
|
||||
country => 'United States',
|
||||
});
|
||||
$cart->update({shippingAddressId => $workAddress->getId});
|
||||
|
||||
cmp_deeply(
|
||||
|
|
@ -826,6 +833,48 @@ SKIP: {
|
|||
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Test ZIP+4 format domestic code
|
||||
#
|
||||
#######################################################################
|
||||
$cart->update({shippingAddressId => $zip4Address->getId});
|
||||
|
||||
my $xmlData = XMLin($driver->buildXML($cart, @shippableUnits),
|
||||
KeepRoot => 1,
|
||||
ForceArray => ['Package'],
|
||||
);
|
||||
cmp_deeply(
|
||||
$xmlData,
|
||||
{
|
||||
RateV3Request => {
|
||||
USERID => $userId,
|
||||
Package => [
|
||||
{
|
||||
ID => 0,
|
||||
ZipDestination => '53715', ZipOrigination => '97123',
|
||||
Pounds => '1', Ounces => '8.0',
|
||||
Size => 'REGULAR', Service => 'PRIORITY',
|
||||
Machinable => 'true',# Container => 'VARIABLE',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
'buildXML: removed plus4 part of zipcode'
|
||||
);
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip 'No userId for testing', 2 unless $hasRealUserId;
|
||||
|
||||
my $cost = eval { $driver->calculate($cart); };
|
||||
my $e = Exception::Class->caught();
|
||||
ok( ! ref $e, 'no exception thrown for zip+4 address');
|
||||
cmp_deeply($cost, num(10,9.99), 'zip+4 address returns a valid cost');
|
||||
|
||||
}
|
||||
|
||||
$cart->update({shippingAddressId => $workAddress->getId});
|
||||
#######################################################################
|
||||
#
|
||||
# Check for throwing an exception
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue