diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 0e10adf00..2906a2f7c 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -11,6 +11,7 @@ - fixed #11353: shop - sales - error - fixed #11355: Duplicate template error - fixed #11347: copy forum + - fixed #11359: USPS International shipping does not work on United Kingdom 7.8.9 - fixed #11235: wiki search diff --git a/lib/WebGUI/Form/Country.pm b/lib/WebGUI/Form/Country.pm index 420f2c604..a71f54aca 100644 --- a/lib/WebGUI/Form/Country.pm +++ b/lib/WebGUI/Form/Country.pm @@ -116,18 +116,18 @@ sub getCountries { 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island', - 'Cocos (Keeling) Islands', 'Colombia', - 'Comoros', 'Congo', - 'Congo, the Democratic Republic of the', 'Cook Islands', - 'Costa Rica', 'Cote d\'Ivoire', - 'Croatia', 'Cyprus', - 'Czech Republic', 'Denmark', - 'Djibouti', 'Dominica', - 'Dominican Republic', 'East Timor', - 'Ecuador', 'Egypt', - 'El Salvador', 'England', - 'Equatorial Guinea', 'Eritrea', - 'Espana', 'Estonia', + 'Christmas Island (Kiribati)', 'Cocos (Keeling) Islands', + 'Colombia', 'Comoros', + 'Congo', 'Congo, the Democratic Republic of the', + 'Cook Islands', 'Costa Rica', + 'Cote d\'Ivoire', 'Croatia', + 'Cyprus', 'Czech Republic', + 'Denmark', 'Djibouti', + 'Dominica', 'Dominican Republic', + 'East Timor', 'Ecuador', + 'Egypt', 'El Salvador', + 'England', 'Equatorial Guinea', + 'Eritrea', 'Estonia', 'Ethiopia', 'Falkland Islands', 'Faroe Islands', 'Fiji', 'Finland', 'France', diff --git a/lib/WebGUI/Shop/ShipDriver/USPSInternational.pm b/lib/WebGUI/Shop/ShipDriver/USPSInternational.pm index 4d52983c3..62cf7c7b2 100644 --- a/lib/WebGUI/Shop/ShipDriver/USPSInternational.pm +++ b/lib/WebGUI/Shop/ShipDriver/USPSInternational.pm @@ -80,7 +80,7 @@ sub buildXML { } $value = sprintf '%.2f', $value; my $destination = $package->[0]->getShippingAddress; - my $country = $destination->get('country'); + my $country = $self->correctCountry($destination->get('country')); $packageData{ID} = $packageIndex; $packageData{Pounds} = [ $pounds ]; $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 ) This subroutine returns an arrayref of hashrefs, used to validate data put into