The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Shipment::FedEx

VERSION

version 3.10

SYNOPSIS

  use Shipment::FedEx;
  use Shipment::Address;
  use Shipment::Package;

  my $shipment = Shipment::FedEx->new(
    from_address => Shipment::Address->new( ... ),
    to_address => Shipment::Address->new( ... ),
    packages => [ Shipment::Package->new( ... ), ],
  );

  foreach my $service ( $shipment->all_services ) {
    print $service->id . "\n";
  }

  $shipment->rate( 'express' );
  print $shipment->service->cost . "\n";

  $shipment->ship( 'ground' );
  $shipment->get_package(0)->label->save;

NAME

Shipment::FedEx - Interface to FedEx Shipping Web Services

ABOUT

This class provides an interface to the FedEx Web Services for Shipping.

For code examples, see https://github.com/pullingshots/Shipment/tree/master/eg

You must sign up for a developer test key in order to make use of this module.

https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=techresources/index.html

See related modules for documentation on options and how to access rates and labels:

Shipment::Base - common attributes and methods for all interfaces

Shipment::Address - define an from or to address

Shipment::Package - define package details, weight, dimensions, etc

Shipment::Service - access information about a service, rate, etd, etc

Shipment::Label - access the label file

It makes extensive use of SOAP::WSDL in order to create/decode xml requests and responses. The Shipment::FedEx::WSDL interface was created primarily using the wsdl2perl.pl script from SOAP::WSDL.

Class Attributes

meter, key, password

Credentials required to access FedEx Web Services

proxy_domain

This determines whether you will use the FedEx Web Services Testing Environment or the production (live) environment * wsbeta.fedex.com:443 (testing) * ws.fedex.com:443 (live)

shipment_special_service_types

special services offered by FedEx, for example SATURDAY_DELIVERY

residential_address

Flag the ship to address as residential.

Default is false.

label_stock_type

The label dimensions/type.

Default: 4x6

Type Maps

Shipment::Base type maps

Shipment::Base provides abstract types which need to be mapped to FedEx codes (i.e. bill_type of "sender" maps to FedEx "SENDER")

Collect billing

FedEx offers collect billing (without the need for a billing account #)

custom package types

FedEx provides package types in addition to the defaults in Shipment::Base * FEDEX_10KG_BOX * FEDEX_25KG_BOX

default currency

The default currency is USD

Class Methods

_build_services

This calls getRates from the Rate Services API

Each Service that is returned is added to services

The following service mapping is used: * ground => FEDEX_GROUND or GROUND_HOME_DELIVERY or INTERNATIONAL_GROUND * express => FEDEX_2_DAY or INTERNATIONAL_ECONOMY * priority => PRIORITY_OVERNIGHT or INTERNATIONAL_PRIORITY

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 getRates from the Rate Services API

ship

This method calls processShipment from the Ship Services API

cancel

This method calls deleteShipment from the Ship Services API

If the tracking id is greater than 12 digits, it assumes that it is a Ground shipment.

Currently only supports deleting one package (tracking id) at a time - DeletionControl = 'DELETE_ONE_PACKAGE'

returns "SUCCESS" if successful

track

This method calls track from the Tracking Services API

Currently only supports tracking using a valid tracking number: Type => 'TRACKING_NUMBER_OR_DOORTAG'

Result is added to $self->activities, accessible using $self->status

Also sets $self->ship_date

end_of_day

This method calls groundClose from the Close Services API

The manifest is a plain text file intended to be printed off on standard letter paper

AUTHOR

Andrew Baerg @ <andrew at pullingshots dot ca>

http://pullingshots.ca/

BUGS

Issues can be submitted at https://github.com/pullingshots/Shipment/issues

COPYRIGHT

Copyright (C) 2016 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) 2018 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.