[interchange-cvs] interchange - heins modified code/UserTag/ups_query.tag

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


User:      heins
Date:      2003-06-30 18:07:20 GMT
Modified:  code/UserTag ups_query.tag
Log:
* 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.7       +17 -0     interchange/code/UserTag/ups_query.tag


rev 1.7, prev_rev 1.6
Index: ups_query.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/ups_query.tag,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ups_query.tag	19 Jun 2003 18:21:19 -0000	1.6
+++ ups_query.tag	30 Jun 2003 18:07:20 -0000	1.7
@@ -29,9 +29,26 @@
 
 	$country = uc $country;
 
+    my %exception;
+
+	$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;
 
+#::logDebug("calling with: " . join("|", $mode, $origin, $zip, $weight, $country));
 	my $cache;
 	my $cache_code;
 	my $db;