Fix several countries whose addresses were rejected by the USPS International ship driver. Fixes bug #11359.

Also, update two countries in Form::Country
This commit is contained in:
Colin Kuskie 2010-01-18 19:59:50 -08:00
parent 97338ffefe
commit d04d457d44
3 changed files with 48 additions and 13 deletions

View file

@ -11,6 +11,7 @@
- fixed #11353: shop - sales - error - fixed #11353: shop - sales - error
- fixed #11355: Duplicate template error - fixed #11355: Duplicate template error
- fixed #11347: copy forum - fixed #11347: copy forum
- fixed #11359: USPS International shipping does not work on United Kingdom
7.8.9 7.8.9
- fixed #11235: wiki search - fixed #11235: wiki search

View file

@ -116,18 +116,18 @@ sub getCountries {
'Cayman Islands', 'Central African Republic', 'Cayman Islands', 'Central African Republic',
'Chad', 'Chile', 'Chad', 'Chile',
'China', 'Christmas Island', 'China', 'Christmas Island',
'Cocos (Keeling) Islands', 'Colombia', 'Christmas Island (Kiribati)', 'Cocos (Keeling) Islands',
'Comoros', 'Congo', 'Colombia', 'Comoros',
'Congo, the Democratic Republic of the', 'Cook Islands', 'Congo', 'Congo, the Democratic Republic of the',
'Costa Rica', 'Cote d\'Ivoire', 'Cook Islands', 'Costa Rica',
'Croatia', 'Cyprus', 'Cote d\'Ivoire', 'Croatia',
'Czech Republic', 'Denmark', 'Cyprus', 'Czech Republic',
'Djibouti', 'Dominica', 'Denmark', 'Djibouti',
'Dominican Republic', 'East Timor', 'Dominica', 'Dominican Republic',
'Ecuador', 'Egypt', 'East Timor', 'Ecuador',
'El Salvador', 'England', 'Egypt', 'El Salvador',
'Equatorial Guinea', 'Eritrea', 'England', 'Equatorial Guinea',
'Espana', 'Estonia', 'Eritrea', 'Estonia',
'Ethiopia', 'Falkland Islands', 'Ethiopia', 'Falkland Islands',
'Faroe Islands', 'Fiji', 'Faroe Islands', 'Fiji',
'Finland', 'France', 'Finland', 'France',

View file

@ -80,7 +80,7 @@ sub buildXML {
} }
$value = sprintf '%.2f', $value; $value = sprintf '%.2f', $value;
my $destination = $package->[0]->getShippingAddress; my $destination = $package->[0]->getShippingAddress;
my $country = $destination->get('country'); my $country = $self->correctCountry($destination->get('country'));
$packageData{ID} = $packageIndex; $packageData{ID} = $packageIndex;
$packageData{Pounds} = [ $pounds ]; $packageData{Pounds} = [ $pounds ];
$packageData{Ounces} = [ $ounces ]; $packageData{Ounces} = [ $ounces ];
@ -228,6 +228,40 @@ sub _calculateFromXML {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 correctCountry ( $country )
Correct country names to be compliant with USPS International's ICL.
=cut
sub correctCountry {
my $self = shift;
my $country = shift;
return $country eq q{United Kingdom} ? q{United Kingdom (Great Britain)}
: $country eq q{Congo, the Democratic Republic of the} ? q{Congo, Democratic Republic of the}
: $country eq q{Cocos (Keeling) Islands} ? q{Cocos Island (Australia)}
: $country eq q{Congo} ? q{Congo, Republic of the}
: $country eq q{Christmas Island} ? q{Christmas Island (Australia)}
: $country eq q{Georgia} ? q{Georgia, Republic of}
: $country eq q{Heard and Mc Donald Islands} ? q{Australia}
: $country eq q{Korea (South)} ? q{South Korea}
: $country eq q{Korea, Republic of} ? q{Democratic People's Republic of Korea}
: $country eq q{Lao People's Democratic Republic} ? q{Laos}
: $country eq q{Macedonia} ? q{Macedonia, Republic of}
: $country eq q{Moldova, Republic of} ? q{Moldova}
: $country eq q{Pitcairn} ? q{Pitcairn Island}
: $country eq q{Russian Federation} ? q{Russia}
: $country eq q{Slovakia} ? q{Slovak Republic}
: $country eq q{Tokelau} ? q{Tokelau (Union) Group (Western Samoa)}
: $country eq q{Trinidad} ? q{Trinidad and Tobago}
: $country eq q{Vatican City State (Holy See)} ? q{Vatican City}
: $country eq q{Viet Nam} ? q{Vietnam}
: $country eq q{Virgin Islands (U.S.)} ? q{Virgin Islands U.S.}
: $country;
}
#-------------------------------------------------------------------
=head2 definition ( $session ) =head2 definition ( $session )
This subroutine returns an arrayref of hashrefs, used to validate data put into This subroutine returns an arrayref of hashrefs, used to validate data put into