[interchange-cvs] interchange - heins modified lib/Vend/Ship/QueryUPS.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Mon Jun 30 14:10:00 2003


User:      heins
Date:      2003-06-30 18:09:43 GMT
Modified:  lib/Vend/Ship QueryUPS.pm
Log:
(Same concept as ups_query.tag, only log once)

* UPS no longer accepts UK as a country code for shipments to
  Great Britain.

   -- did an exception remap for UK --> GB

   -- Added UPS_COUNTRY_REMAP code so that this type of thing
      can be done elsewhere.

        # Remap Monaco to France for UPS
        Variable  UPS_COUNTRY_REMAP   MC=FR

Revision  Changes    Path
1.3       +15 -1     interchange/lib/Vend/Ship/QueryUPS.pm


rev 1.3, prev_rev 1.2
Index: QueryUPS.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Ship/QueryUPS.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- QueryUPS.pm	18 Jun 2003 17:34:46 -0000	1.2
+++ QueryUPS.pm	30 Jun 2003 18:09:42 -0000	1.3
@@ -1,6 +1,6 @@
 # Vend::Ship::QueryUPS - Interchange shipping code
 # 
-# $Id: QueryUPS.pm,v 1.2 2003/06/18 17:34:46 jon Exp $
+# $Id: QueryUPS.pm,v 1.3 2003/06/30 18:09:42 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -62,6 +62,20 @@
 	}
 
 	$country = uc $country;
+
+    my %exception = ( UK => 'GB');
+
+	if(! $::Variable->{UPS_COUNTRY_REMAP} ) {
+		# do nothing
+	}
+	elsif ($::Variable->{UPS_COUNTRY_REMAP} =~ /=/) {
+		Vend::Util::get_option_hash($::Variable->{UPS_COUNTRY_REMAP}, \%exception);
+	}
+	else {
+		Vend::Util::hash_string($::Variable->{UPS_COUNTRY_REMAP}, \%exception);
+	}
+
+	$country = $exception{$country} if $exception{$country};
 
 	# In the U.S., UPS only wants the 5-digit base ZIP code, not ZIP+4
 	$country eq 'US' and $zip =~ /^(\d{5})/ and $zip = $1;