Retrofit UPS to use Locales instead of Locales::Country. Fixes bug #11221
Updated tests, module, gotcha.txt, and testEnvironment.pl
This commit is contained in:
parent
15ce7b56cc
commit
f3e699e9a7
5 changed files with 41 additions and 54 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
- fixed #11245: send stats
|
- fixed #11245: send stats
|
||||||
- fixed #11247: Survey edit screen broken
|
- fixed #11247: Survey edit screen broken
|
||||||
- fixed #11246: Image.pm - Validation error
|
- fixed #11246: Image.pm - Validation error
|
||||||
|
- fixed #11221: wrong version of Locales::Country in testEnvironment
|
||||||
|
|
||||||
7.8.4
|
7.8.4
|
||||||
- Fixed a compatibility problem between WRE and new Spectre code.
|
- Fixed a compatibility problem between WRE and new Spectre code.
|
||||||
|
|
|
||||||
|
|
@ -9,30 +9,33 @@ save you many hours of grief.
|
||||||
|
|
||||||
7.8.5
|
7.8.5
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
* WebGUI now requires Locales 0.10 or higher, to replace the deprecated
|
||||||
|
modules Locales::Country.
|
||||||
|
|
||||||
* Users, no matter if they are created via anonymous registration,
|
* Users, no matter if they are created via anonymous registration,
|
||||||
via the Admin Console Users screen, or via code, now always get
|
via the Admin Console Users screen, or via code, now always get
|
||||||
their default values from the Profile Fields instead of via
|
their default values from the Profile Fields instead of via
|
||||||
the Visitor account. Previously, based on how the user was created,
|
the Visitor account. Previously, based on how the user was created,
|
||||||
they would get default values from different places.
|
they would get default values from different places.
|
||||||
|
|
||||||
* The following style templates have been cleaned up by the TWG:
|
* The following style templates have been cleaned up by the TWG:
|
||||||
- WebGUI 6 Blank Style, Style 01; Style 02, Style 03:
|
- WebGUI 6 Blank Style, Style 01; Style 02, Style 03:
|
||||||
- no structural changes
|
- no structural changes
|
||||||
- Fail safe:
|
- Fail safe:
|
||||||
- added new CSS that is more robust and validates (in external file: style.css);
|
- added new CSS that is more robust and validates (in external file: style.css);
|
||||||
- it was also necessary to update the css to work with the new navigation templates
|
- it was also necessary to update the css to work with the new navigation templates
|
||||||
- changed the markup and the order of the home/login/user/admin controls at the bottom
|
- changed the markup and the order of the home/login/user/admin controls at the bottom
|
||||||
- All of the above templates:
|
- All of the above templates:
|
||||||
- added a link tag to wg-base.css
|
- added a link tag to wg-base.css
|
||||||
- added conditional comments at the top and bottom of the body tag to be able to target
|
- added conditional comments at the top and bottom of the body tag to be able to target
|
||||||
IE versions easily with css
|
IE versions easily with css
|
||||||
|
|
||||||
* Added wg-base.css, which is linked to in each style template. This stylesheet is for css that
|
* Added wg-base.css, which is linked to in each style template. This stylesheet is for css that
|
||||||
is used in more than one tempalte, like pagination inline icons etc. Inline styles that are
|
is used in more than one tempalte, like pagination inline icons etc. Inline styles that are
|
||||||
removed from templates, will be replaced with styles in wg-base.css (and example is RFE 11182).
|
removed from templates, will be replaced with styles in wg-base.css (and example is RFE 11182).
|
||||||
Elements that are styled in wg-base.css have a classname that starts with "wg-".
|
Elements that are styled in wg-base.css have a classname that starts with "wg-".
|
||||||
|
|
||||||
wg-base.css replaces webgui.css, which will be removed from the site.
|
wg-base.css replaces webgui.css, which will be removed from the site.
|
||||||
|
|
||||||
7.8.4
|
7.8.4
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use WebGUI::Exception::Shop;
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
use LWP;
|
use LWP;
|
||||||
use Tie::IxHash;
|
use Tie::IxHash;
|
||||||
use Locales::Country qw/ en /;
|
use Locales;
|
||||||
use Class::InsideOut qw/ :std /;
|
use Class::InsideOut qw/ :std /;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ sub buildXML {
|
||||||
$xmlAcc->{AccessLicenseNumber} = [ $self->get('licenseNo') ];
|
$xmlAcc->{AccessLicenseNumber} = [ $self->get('licenseNo') ];
|
||||||
$xmlAcc->{UserId} = [ $self->get('userId') ];
|
$xmlAcc->{UserId} = [ $self->get('userId') ];
|
||||||
$xmlAcc->{Password} = [ $self->get('password') ];
|
$xmlAcc->{Password} = [ $self->get('password') ];
|
||||||
my $localizedCountry = Locales::Country->new('en');
|
my $localizedCountry = Locales->new('en');
|
||||||
my $xml = XMLout(\%xmlHash,
|
my $xml = XMLout(\%xmlHash,
|
||||||
KeepRoot => 1,
|
KeepRoot => 1,
|
||||||
NoSort => 1,
|
NoSort => 1,
|
||||||
|
|
@ -95,14 +95,14 @@ sub buildXML {
|
||||||
$xmlRate->{Shipment} = {
|
$xmlRate->{Shipment} = {
|
||||||
Shipper => {
|
Shipper => {
|
||||||
Address => [ {
|
Address => [ {
|
||||||
PostalCode => [ $self->get('sourceZip' ) ],
|
PostalCode => [ $self->get('sourceZip') ],
|
||||||
CountryCode => [ $localizedCountry->country2code($self->get('sourceCountry'), 'alpha2') ],
|
CountryCode => [ $localizedCountry->get_code_from_territory($self->get('sourceCountry')) ],
|
||||||
}, ],
|
}, ],
|
||||||
},
|
},
|
||||||
ShipTo => {
|
ShipTo => {
|
||||||
Address => [ {
|
Address => [ {
|
||||||
PostalCode => [ $destination->get('code') ],
|
PostalCode => [ $destination->get('code') ],
|
||||||
CountryCode => [ $localizedCountry->country2code($destination->get('country'), 'alpha2') ],
|
CountryCode => [ $localizedCountry->get_code_from_territory($destination->get('country')) ],
|
||||||
} ],
|
} ],
|
||||||
},
|
},
|
||||||
Service => {
|
Service => {
|
||||||
|
|
@ -301,9 +301,9 @@ sub definition {
|
||||||
$customerClassification{'03'} = $i18n->get('customer classification 03');
|
$customerClassification{'03'} = $i18n->get('customer classification 03');
|
||||||
$customerClassification{'04'} = $i18n->get('customer classification 04');
|
$customerClassification{'04'} = $i18n->get('customer classification 04');
|
||||||
|
|
||||||
my $localizedCountries = Locales::Country->new('en'); ##Note, for future i18n change the locale
|
my $localizedCountries = Locales->new('en'); ##Note, for future i18n change the locale
|
||||||
tie my %localizedCountries, 'Tie::IxHash';
|
tie my %localizedCountries, 'Tie::IxHash';
|
||||||
%localizedCountries = map { $_ => $_ } grep { !ref $_ } $localizedCountries->all_country_names();
|
%localizedCountries = map { $_ => $_ } grep { !ref $_ } $localizedCountries->get_territory_names();
|
||||||
|
|
||||||
tie my %fields, 'Tie::IxHash';
|
tie my %fields, 'Tie::IxHash';
|
||||||
%fields = (
|
%fields = (
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ checkModule("CSS::Minifier::XS", "0.03" );
|
||||||
checkModule("JavaScript::Minifier::XS", "0.05" );
|
checkModule("JavaScript::Minifier::XS", "0.05" );
|
||||||
checkModule("Readonly", "1.03" );
|
checkModule("Readonly", "1.03" );
|
||||||
checkModule("Business::PayPal::API", "0.62" );
|
checkModule("Business::PayPal::API", "0.62" );
|
||||||
checkModule("Locales::Country", "0.05" );
|
checkModule("Locales", "0.10" );
|
||||||
|
|
||||||
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,14 @@ use Test::More;
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use Locales::Country qw/en/;
|
|
||||||
|
|
||||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
use WebGUI::Shop::ShipDriver::UPS;
|
||||||
|
use Locales;
|
||||||
|
#my $locales = Locales->new('en');
|
||||||
|
#diag Dumper [ $locales->get_territory_names() ];
|
||||||
|
#diag $locales->get_code_from_territory('United States');
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Init
|
# Init
|
||||||
|
|
@ -35,16 +39,13 @@ $session->user({user => $user});
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
my $tests = 41;
|
plan tests => 41;
|
||||||
plan tests => 1 + $tests;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# put your tests here
|
# put your tests here
|
||||||
|
|
||||||
my $loaded = use_ok('WebGUI::Shop::ShipDriver::UPS');
|
|
||||||
|
|
||||||
my $storage;
|
my $storage;
|
||||||
my ($driver, $cart);
|
my ($driver);
|
||||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||||
|
|
||||||
my $home = WebGUI::Asset->getDefault($session);
|
my $home = WebGUI::Asset->getDefault($session);
|
||||||
|
|
@ -108,11 +109,7 @@ my $blueFeather = $feather->setCollateral('variantsJSON', 'variantId', 'new',
|
||||||
);
|
);
|
||||||
|
|
||||||
$versionTag->commit;
|
$versionTag->commit;
|
||||||
WebGUI::Test->tagsToRollback($versionTag);
|
addToCleanup($versionTag);
|
||||||
|
|
||||||
SKIP: {
|
|
||||||
|
|
||||||
skip 'Unable to load module WebGUI::Shop::ShipDriver::UPS', $tests unless $loaded;
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
|
|
@ -190,6 +187,7 @@ $driver = WebGUI::Shop::ShipDriver::UPS->create($session, {
|
||||||
enabled => 1,
|
enabled => 1,
|
||||||
shipType => 'PARCEL',
|
shipType => 'PARCEL',
|
||||||
});
|
});
|
||||||
|
addToCleanup($driver);
|
||||||
|
|
||||||
eval { $driver->calculate() };
|
eval { $driver->calculate() };
|
||||||
$e = Exception::Class->caught();
|
$e = Exception::Class->caught();
|
||||||
|
|
@ -258,21 +256,22 @@ cmp_deeply(
|
||||||
'... checking error message',
|
'... checking error message',
|
||||||
);
|
);
|
||||||
|
|
||||||
$cart = WebGUI::Shop::Cart->newBySession($session);
|
my $cart = WebGUI::Shop::Cart->newBySession($session);
|
||||||
|
addToCleanup($cart);
|
||||||
my $addressBook = $cart->getAddressBook;
|
my $addressBook = $cart->getAddressBook;
|
||||||
my $workAddress = $addressBook->addAddress({
|
my $workAddress = $addressBook->addAddress({
|
||||||
label => 'work',
|
label => 'work',
|
||||||
organization => 'Plain Black Corporation',
|
organization => 'Plain Black Corporation',
|
||||||
address1 => '1360 Regent St. #145',
|
address1 => '1360 Regent St. #145',
|
||||||
city => 'Madison', state => 'WI', code => '53715',
|
city => 'Madison', state => 'WI', code => '53715',
|
||||||
country => 'USA',
|
country => 'United States',
|
||||||
});
|
});
|
||||||
my $wucAddress = $addressBook->addAddress({
|
my $wucAddress = $addressBook->addAddress({
|
||||||
label => 'wuc',
|
label => 'wuc',
|
||||||
organization => 'Madison Concourse Hotel',
|
organization => 'Madison Concourse Hotel',
|
||||||
address1 => '1 W Dayton St',
|
address1 => '1 W Dayton St',
|
||||||
city => 'Madison', state => 'WI', code => '53703',
|
city => 'Madison', state => 'WI', code => '53703',
|
||||||
country => 'USA',
|
country => 'United States',
|
||||||
});
|
});
|
||||||
$cart->update({shippingAddressId => $workAddress->getId});
|
$cart->update({shippingAddressId => $workAddress->getId});
|
||||||
|
|
||||||
|
|
@ -517,8 +516,6 @@ SKIP: {
|
||||||
my $xmlData = XMLin($response->content, ForceArray => [qw/RatedPackage/],);
|
my $xmlData = XMLin($response->content, ForceArray => [qw/RatedPackage/],);
|
||||||
ok($xmlData->{Response}->{ResponseStatusCode}, '... responseCode is successful');
|
ok($xmlData->{Response}->{ResponseStatusCode}, '... responseCode is successful');
|
||||||
ok($xmlData->{RatedShipment}->{TotalCharges}->{MonetaryValue}, '... total charges returned');
|
ok($xmlData->{RatedShipment}->{TotalCharges}->{MonetaryValue}, '... total charges returned');
|
||||||
#diag $xmlData->{RatedShipment}->{TotalCharges}->{MonetaryValue};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ok($driver->getEditForm(), 'getEditForm');
|
ok($driver->getEditForm(), 'getEditForm');
|
||||||
|
|
@ -540,17 +537,3 @@ is (
|
||||||
);
|
);
|
||||||
|
|
||||||
$cart->empty;
|
$cart->empty;
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
if (defined $driver && $driver->isa('WebGUI::Shop::ShipDriver')) {
|
|
||||||
$driver->delete;
|
|
||||||
}
|
|
||||||
if (defined $cart && $cart->isa('WebGUI::Shop::Cart')) {
|
|
||||||
my $addressBook = $cart->getAddressBook();
|
|
||||||
$addressBook->delete if $addressBook;
|
|
||||||
$cart->delete;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue