Format oz in the USPS shipping driver to the nearest tenth of an oz. Change the minimum to be 0.1 oz

This commit is contained in:
Colin Kuskie 2009-11-05 12:38:56 -08:00
parent 2c5c2ea5ee
commit 63b797c875
3 changed files with 18 additions and 18 deletions

View file

@ -6,7 +6,7 @@
- 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. - Set a minimum package weight of 0.1 oz for the USPS driver.
- Handle per package errors in USPS response data. - Handle per package errors in USPS response data.
7.8.3 7.8.3

View file

@ -73,9 +73,9 @@ sub buildXML {
$weight += $itemWeight; $weight += $itemWeight;
} }
my $pounds = int($weight); my $pounds = int($weight);
my $ounces = int(16 * ($weight - $pounds)); my $ounces = sprintf '%3.1f', (16 * ($weight - $pounds));
if ($pounds == 0 && $ounces == 0 ) { if ($pounds == 0 && $ounces eq '0.0' ) {
$ounces = 1; $ounces = 0.1;
} }
my $destination = $package->[0]->getShippingAddress; my $destination = $package->[0]->getShippingAddress;
my $destZipCode = $destination->get('code'); my $destZipCode = $destination->get('code');

View file

@ -334,7 +334,7 @@ cmp_deeply(
{ {
ID => 0, ID => 0,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8', Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PARCEL', Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true', Machinable => 'true',
}, },
@ -414,14 +414,14 @@ cmp_deeply(
{ {
ID => 0, ID => 0,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '2', Ounces => '0', Pounds => '2', Ounces => '0.0',
Size => 'REGULAR', Service => 'PARCEL', Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true', Machinable => 'true',
}, },
{ {
ID => 1, ID => 1,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8', Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PARCEL', Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true', Machinable => 'true',
}, },
@ -445,7 +445,7 @@ SKIP: {
{ {
ID => 0, ID => 0,
ZipOrigination => ignore(), ZipDestination => ignore(), ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 0, Machinable => ignore(), Ounces => '0.0',
Pounds => 2, Size => ignore(), Pounds => 2, Size => ignore(),
Zone => ignore(), Zone => ignore(),
Postage => { Postage => {
@ -457,7 +457,7 @@ SKIP: {
{ {
ID => 1, ID => 1,
ZipOrigination => ignore(), ZipDestination => ignore(), ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 8, Machinable => ignore(), Ounces => '8.0',
Pounds => 1, Size => ignore(), Pounds => 1, Size => ignore(),
Zone => ignore(), Zone => ignore(),
Postage => { Postage => {
@ -545,21 +545,21 @@ cmp_deeply(
{ {
ID => 0, ID => 0,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '2', Ounces => '0', Pounds => '2', Ounces => '0.0',
Size => 'REGULAR', Service => 'PARCEL', Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true', Machinable => 'true',
}, },
{ {
ID => 1, ID => 1,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8', Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PARCEL', Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true', Machinable => 'true',
}, },
{ {
ID => 2, ID => 2,
ZipDestination => '53703', ZipOrigination => '97123', ZipDestination => '53703', ZipOrigination => '97123',
Pounds => '12', Ounces => '0', Pounds => '12', Ounces => '0.0',
Size => 'REGULAR', Service => 'PARCEL', Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true', Machinable => 'true',
}, },
@ -583,7 +583,7 @@ SKIP: {
{ {
ID => 0, ID => 0,
ZipOrigination => ignore(), ZipDestination => ignore(), ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 0, Machinable => ignore(), Ounces => '0.0',
Pounds => 2, Size => ignore(), Pounds => 2, Size => ignore(),
Zone => ignore(), Zone => ignore(),
Postage => { Postage => {
@ -595,7 +595,7 @@ SKIP: {
{ {
ID => 1, ID => 1,
ZipOrigination => ignore(), ZipDestination => ignore(), ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 8, Machinable => ignore(), Ounces => '8.0',
Pounds => 1, Size => ignore(), Pounds => 1, Size => ignore(),
Zone => ignore(), Zone => ignore(),
Postage => { Postage => {
@ -607,7 +607,7 @@ SKIP: {
{ {
ID => 2, ID => 2,
ZipOrigination => ignore(), ZipDestination => 53703, ZipOrigination => ignore(), ZipDestination => 53703,
Machinable => ignore(), Ounces => 0, Machinable => ignore(), Ounces => '0.0',
Pounds => 12, Size => ignore(), Pounds => 12, Size => ignore(),
Zone => ignore(), Zone => ignore(),
Postage => { Postage => {
@ -650,7 +650,7 @@ cmp_deeply(
{ {
ID => 0, ID => 0,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8', Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PRIORITY', Size => 'REGULAR', Service => 'PRIORITY',
Machinable => 'true', Container => 'FLAT RATE BOX', Machinable => 'true', Container => 'FLAT RATE BOX',
}, },
@ -715,7 +715,7 @@ cmp_deeply(
{ {
ID => 0, ID => 0,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8', Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'EXPRESS', Size => 'REGULAR', Service => 'EXPRESS',
Machinable => 'true', Machinable => 'true',
}, },
@ -779,7 +779,7 @@ cmp_deeply(
{ {
ID => 0, ID => 0,
ZipDestination => '53715', ZipOrigination => '97123', ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8', Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PRIORITY', Size => 'REGULAR', Service => 'PRIORITY',
Machinable => 'true',# Container => 'VARIABLE', Machinable => 'true',# Container => 'VARIABLE',
}, },