NAME
Shipment::UPS
VERSION
version 2.00
SYNOPSIS
use Shipment::UPS;
use Shipment::Address;
use Shipment::Package;
my $shipment = Shipment::UPS->new(
from_address => Shipment::Address->new( ... ),
to_address => Shipment::Address->new( ... ),
packages => [ Shipment::Package->new( ... ), ],
);
foreach my $service ( $shipment->all_services ) {
print $service->id . " (" . $service->cost . ")\n";
}
$shipment->rate( 'express' );
print $shipment->service->cost . "\n";
$shipment->ship( 'ground' );
$shipment->get_package(0)->label->save;
NAME
Shipment::UPS - Interface to UPS Shipping Web Services
ABOUT
This class provides an interface to the UPS Online Tools. You must sign up for a developer access key in order to make use of this module.
https://www.ups.com/upsdeveloperkit
It is an extension of Shipment::Base.
It makes extensive use of SOAP::WSDL in order to create/decode xml requests and responses. The Shipment::UPS::WSDL interface was created primarily using the wsdl2perl.pl script from SOAP::WSDL.
Class Attributes
username, password, key
Credentials required to access UPS Online Tools.
proxy_domain
This determines whether you will use the UPS Customer Integration Environment (for development) or the production (live) environment * wwwcie.ups.com (development) * onlinetools.ups.com (production)
negotiated_rates
Turn negotiated rates on or off.
The Shipper Account/UserID used must be qualified to receive negotiated rates. You will most likely need to contact UPS to have set this up.
If the Shipper Account/UserID is not qualified, the published rates will be used instead and a notice set.
Default is off.
residential_address
Flag the ship to address as residential.
Default is false.
address_validation
Turn address validation on or off. When on, ship will fail if the address does not pass UPS address validation
Default is on.
label_height
The label height. Can be either 6" or 8". The label width is fixed at 4".
control_log_receipt
In certain cases (i.e. for shipments with declared value over $999), UPS will return a control log receipt which must be printed off along with the label.
type: Shipment::Label
carbon_neutral
Set the Carbon Neutral Indicator - http://www.ups.com/content/us/en/resources/ship/carbonneutral/shipping.html
type: Bool
Type Maps
service_map
UPS returns service codes without descriptions. This is mapped here so that we can display 'UPS Ground' instead of '03'.
Shipment::Base type maps
Shipment::Base provides abstract types which need to be mapped to UPS codes (i.e. bill_type of "sender" maps to UPS "BillShipper")
custom package types
UPS provides package types in addition to the defaults in Shipment::Base * 25kg_box * 10kg_box * pallet * small_express_box * medium_express_box * large_express_box
custom printer types
UPS does not offer a pdf option for labels, so the default printer type is image (gif).
UPS does offer additional thermal options: * ZPL * SPL * STARPL
default currency
The default currency is USD
surepost
Enable UPS SurePost
Class Methods
_build_services
This calls ProcessRate from the Rating API with RequestOption => 'Shop'
Each RatedShipment that is returned is added to services
The following service mapping is used: * ground => 03 (UPS Ground) or 11 (UPS Standard) * express => 02 (UPS Second Day Air) * priority => 01 (UPS Next Day Air)
This method ignores what is in $self->packages and uses a single package weighing 1 pound for rating. The idea is to list what services are available, but for accurate rate comparisons, the rate method should be used.
rate
This calls ProcessRate from the Rating API with RequestOption => 'Rate'
ship
This method calls ProcessShipment from the Shipping API
return
This method calls ProcessShipment from the Shipping API with ReturnService => Code => 9 which provides the return label to be printed off.
This method has only been implemented for the purpose of obtaining certification with UPS. It has not been fully tested and does not offer some core options (such as the ability to email the return label).
It assumes that you are first creating an outgoing shipment and creating the return shipment at the same time. Because of this, it uses the "to_address" as the origin and the "from_address" as the destination.
cancel
This method calls ProcessVoid from the Shipping API
It uses $self->tracking_id for the shipment identification number in order to void a single package shipment.
It will use all package tracking id's to void one or more packages within a multi-package shipment.
returns "Voided" if successful
AUTHOR
Andrew Baerg @ <andrew at pullingshots dot ca>
http://pullingshots.ca/
BUGS
Please contact me directly.
COPYRIGHT
Copyright (C) 2010 Andrew J Baerg, All Rights Reserved
NO WARRANTY
Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Andrew Baerg <baergaj@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Andrew Baerg.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.