[ic] Ups interface for Ups Online Tools

Daniel Davenport DDavenport at newagedigital.com
Thu Jul 20 02:11:03 EDT 2006


> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org 
> [mailto:interchange-users-bounces at icdevgroup.org] On Behalf 
> Of Thomas J.M. Burton
> Sent: 2006 July 18 -- Tuesday 1:07 PM
> To: interchange-users at icdevgroup.org
> Subject: Re: [ic] Ups interface for Ups Online Tools
> Daniel Davenport wrote:
> >> -----Original Message-----
> <<SNIP>> [From original maillist archive post]
> >>> I have placed a tarball of my implementation of the Ups Online 
> >>> Tools at http://ic2.paymentonline.com/ups/ups.tar.gz. It is 
> >>> basically a replacement for Business::UPS. It also includes a 
> >>> modified ups-query tag and shipping.asc. I have done some testing
> >>> on it, but it was thrown together fairly quickly.
> <<SNIP>> [Reply from Thomas J.M. Burton]
> >> I found this post searching the archives for info on integrating
> >> the UPS OnLine Tools. The link no longer works and I'm wondering if
> >> this tarball is still available anywhere.
> > 
> > I clicked the link posted in the message, and downloaded the tarball
> > just fine.  Perhaps the server isn't always up, or was 
> having problems
> > when you tried it.
> Well so it does work. I guess the few times I'd tried it, I 
> just caught 
> the server at a bad time. Thanks, Daniel. :)
> >> A client of mine is switching to UPS exclusively for their
> >> shipping, and I need to change from using the internal lookup
> >> method for their shipping rates to either Interchange's online
> >> lookup or the UPS Online Tools lookup.
> >>
> >> The UPS Online Tools would seem to be my best bet as my client is
> >> using Negotiated Rates rather than the standard rates. If I can get
> >> their site to lookup shipping rates directly from UPS with their
> >> account info, that seems like the smoothest way to have accurate
> >> info displayed for their customers.
> > 
> Thanks for the tip. I would assume you'd also need to be passing the 
> various authorization keys and/or a password to UPS's system 
> in addition 
> to the "switch" being "flipped", correct? Are you doing this through 
> Interchange's existing online lookups, or are you custom-coding using 
> the UPS Online Tools?
> Would you be able to share any of what you have set up?

I'm not sure about whether i can share the code...so it'd be better if i
didn't yet.  But i can mention how i'm doing things, since it's quite
likely anyone else who does this will be doing it a similar way.  :)

I'm using Net::UPS (slightly modified, though it would probably work as
is) from CPAN to do the actual lookups, and looked at
Vend::Ship::QueryUPS as a model for building a new lookup module that
talks to it.  As far as i can tell, the module has to in a package named
Vend::Ship::the_name_of_your_module (where that last part can be pretty
much anything....For reference, mine's Vend::Ship::UPSOnline.)  The
"calculate" function in that module appears to be the only required one;
it's what actually returns the looked-up rate.  See Vend::Ship::QueryUPS
for examples of what's in each arg/param to the function.

The user id, password, access key, and probably the account number (for
special rates) have to be provided somehow; i chose to do it via the
Shipping directive, since it seems to have to be there anyway in order
to enable the shipping module.

Shipping UPSOnline <<ENDPARMS
  ups_acct   111h5t2etc
  username   theuser
  password   thepassword
  access_key somebigoldhexnumber
  live       1

though you can use variables, scratch, shipping.asc...or even a text
file sitting in the catalog dir (a Net::UPS config file) if you want.
The shipping module, of course, should pass this info on to Net::UPS as

Note the "live    1".  Net::UPS is in test mode by default; you have to
make it live if you want to talk to the real servers instead of the test
ones.  (This probably matters for special rates, though i haven't been
able to check yet.)  I decided to make use of this and only say
$ups->live(1) if the 'live' option is true.  Makes it easier to test.

In order to enable the lookup module, you'll need a Shipping directive
(that looks something like the above) in catalog.cfg, and your
shipping.asc should have the price for each desired shipping mode as "s
the_name_of_your_module" ("s UPSOnline" in my case).

Daniel Davenport
New Age Digital

More information about the interchange-users mailing list