Cleanup previous attempt at insurance. Begin new attempt.

Add a field to the driver where the user can enter in insurance data with i18n.
Add a method to calculate the cost of insurance for all packages.
This commit is contained in:
Colin Kuskie 2009-09-29 19:28:07 -07:00
parent 2b4bfb8eec
commit e81ec9718c
3 changed files with 50 additions and 59 deletions

View file

@ -757,63 +757,15 @@ SKIP: {
$properties = $driver->get();
$properties->{addInsurance} = 1;
$properties->{insuranceTable} = <<EOTABLE;
5:1.00
10:2.00
15:3.00
20:4.00
25:50.00
EOTABLE
$driver->update($properties);
$xml = $driver->buildXML($cart, @shippableUnits);
my $xmlData = XMLin($xml,
KeepRoot => 1,
ForceArray => ['Package'],
);
cmp_deeply(
$xmlData,
{
RateV3Request => {
USERID => $userId,
Package => [
{
ID => 0,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8',
Size => 'REGULAR', Service => 'PRIORITY',
Machinable => 'true', ValueOfContents => 7.50,
},
],
}
},
'buildXML: contains ValueOfContents when insurance is requested'
);
like($xml, qr/RateV3Request USERID.+?Package ID=.+?Service.+?ZipOrigination.+?ZipDestination.+?Pounds.+?Ounces.+?Size.+?Machinable/, '... and tag order');
SKIP: {
skip 'No userId for testing', 2 unless $hasRealUserId;
my $response = $driver->_doXmlRequest($xml);
ok($response->is_success, '... _doXmlRequest to USPS successful');
my $xmlData = XMLin($response->content, ForceArray => [qw/Package/],);
diag $response->content;
# cmp_deeply(
# $xmlData,
# {
# Package => [
# {
# ID => 0,
# ZipOrigination => ignore(), ZipDestination => ignore(),
# Ounces => ignore(), Pounds => ignore(),
# Size => ignore(), Zone => ignore(),
# Postage => {
# CLASSID => ignore(),
# MailService => ignore(),
# Rate => num(8,8), ##A number around 10...
# }
# },
# ],
# },
# '... returned data from USPS in correct format. If this test fails, the driver may need to be updated'
# );
}
#----------------------------------------------------------------------------
# Cleanup