NAME

Business::Shipping - Rates and tracking for UPS and USPS

VERSION

Version 3.1.0

SYNOPSIS
Rate request example

use Business::Shipping;

     my $rate_request = Business::Shipping->rate_request(
         shipper   => 'UPS_Offline',
         service   => 'Ground Residential',
         from_zip  => '98683',
         to_zip    => '98270',
         weight    =>  5.00,
     );    
 
     $rate_request->execute() or die $rate_request->user_error();
 
     print $rate_request->rate();

FEATURES

Business::Shipping currently supports three shippers:

UPS_Offline: United Parcel Service

UPS_Online: United Parcel Service using UPS OnLine Tools

         my $rr_shop = Business::Shipping->rate_request( 
             service      => 'shop',    
             shipper      => 'UPS_Online',
             from_zip     => '98682',
             to_zip       => '98270',
             weight       => 5.00,
             user_id      => '',
             password     => '',
             access_key   => '',
         );
 
         $rr_shop->execute() or die $rr_shop->user_error();
 
         foreach my $shipper ( @$results ) {
             print "Shipper: $shipper->{name}\n\n";
             foreach my $rate ( @{ $shipper->{ rates } } ) {
                 print "  Service:  $rate->{name}\n";
                 print "  Charges:  $rate->{charges_formatted}\n";
                 print "  Delivery: $rate->{deliv_date_formatted}\n" 
                     if $rate->{ deliv_date_formatted };
                 print "\n";
             }
         }
                cod            => 1,
                cod_value      => 400.00,
                cod_funds_code => 0,

USPS_Online: United States Postal Service

INSTALLATION

perl -MCPAN -e 'install Bundle::Business::Shipping'

See INSTALL.

REQUIRED MODULES

     Any::Moose (any)
     Config::IniFiles (any)
     Log::Log4perl (any)

See INSTALL.

OPTIONAL MODULES

For UPS offline rate estimation:

Business::Shipping::DataFiles (any)

The following modules are used by online rate estimation and tracking. See INSTALL.

     CHI (0.39)
     Crypt::SSLeay (any)
     LWP::UserAgent (any)
     XML::DOM (any)
     XML::Simple (2.05)

GETTING STARTED

Be careful to read, understand, and comply with the terms of use for the shipping service that you will use.

UPS_Offline: For United Parcel Service (UPS) offline rate requests No signup required. "Business::Shipping::DataFiles" has all of rate tables, which are usually updated only once per year.

We recommend that you run the following script to update your fuel surcharge every first monday of the month.

bin/Business-Shipping-UPS_Offline-update-fuel-surcharge.pl

UPS_Online: For United Parcel Service (UPS) Online XML: Free signup

USPS_Online: For United States Postal Service (USPS): Free signup

ERROR/DEBUG HANDLING

Log4perl is used for logging error, debug, etc. messages. For simple manipulation of the current log level, use the Business::Shipping->log_level() class method (below). For more advanced logging/debugging options, see config/log4perl.conf.

Preloading Modules

To preload all modules, call Business::Shipping with this syntax:

use Business::Shipping { preload => 'All' };

To preload the modules for just one shipper:

use Business::Shipping { preload => 'USPS_Online' };

Without preloading, some modules will be loaded at runtime. Normally, runtime loading is the best mode of operation. However, there are some circumstances when preloading is advantagous. For example:

METHODS
$obj->init()
Generic attribute setter.

$obj->user_error()
Log and store errors that should be visibile to the user.

$obj->validate()
Confirms that the object is valid. Checks that required attributes are set.

$self->get_grouped_attrs( $attribute_name ) $obj->rate_request()
This method is used to request shipping rate information from online providers or offline tables. A hash is accepted as input. The acceptable values are determined by the shipper class, but the following are common to all:

There are some additional common values:

Business::Shipping->log_level()
Simple alternative to editing the config/log4perl.conf file. Sets the log level for all Business::Shipping objects.

Takes a scalar that can be 'trace', 'debug', 'info', 'warn', 'error', or 'fatal'.

SEE ALSO

Important modules that are related to Business::Shipping:

Other Perl modules that are similar to Business::Shipping:

Use of this software

Please let the author know how you are using Business::Shipping.

WEBSITE

Source code repository: <https://github.com/danielbr/Business--Shipping>

CPAN web site: <http://search.cpan.org/~dbrowning/Business-Shipping/>

Backpan (old releases):
<http://backpan.cpan.org/authors/id/D/DB/DBROWNING/>

Author homepage: <http://www.kavod.com/Business-Shipping/>

SUPPORT

This module is supported by the author. Please report any bugs or feature requests to "bug-business-shipping@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. The author will be notified, and then you'll automatically be notified of progress on your bug as the author makes changes.

CREDITS

Many people have contributed to this software, please see the "CREDITS" file.

AUTHOR

Daniel Browning, db@kavod.com, <http://www.kavod.com/>

COPYRIGHT AND LICENCE

Copyright 2003-2011 Daniel Browning <db@kavod.com>. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. See LICENSE for more info.