NAME
Fedex - Win32 FedEx Ship Manager API
SYNOPSIS
use Business::Fedex;
my $t = Business::FedEx->new(host=>'127.0.0.1', port=>8190, Debug=>0);
#tracking exaple
$t->set_data(
'UTI' => 5000,
'Sender_FedEx_Express_Account_Number' => '#########',
'Meter_Number' => '#######',
'Tracking_Number'=>'836603877972',
) or die $t->errstr;
# send data to Fedex
$t->transaction() or die $t->errstr;
print $t->lookup('Signed_For');
print $t->lookup('Delivery_Date');
DESCRIPTION
This module will allow transactions to be sent through the FedEx Ship Manager API. The API must be installed and running for this module to work. At this point it is required to run this module in a Win32 environment. The FedEx API is distributed with a DLL "FedExAPIclient.dll" which is called via Win32::API. Please make sure this file is copied into your system32 folder.
Please refer to the FedEx documentation at http://www.fedex.com/globaldeveloper/shipapi/ Here you will find more information about using the FedEx API. You will need to know what UTI to use to send a request.
The Universal Transaction Identifier (UTI) is a unique integral code that has been assigned to a given transaction type. For example, the UTI of the tagged Transaction Type 021 (FedEx Express global Ship a Package Request) is 2016.
I have not included the proxy portion of the module. So this is a Win32 ONLY module. Soon, I will be releasing a version that will talk directly to FedEx's API via HTTP.
COMMON METHODS
The methods described in this section are available for all FedEx
objects.
- $t->set_data(UTI, $hash)
-
This method will accept a valid FedEx UTI number and a hash of values. The first arg must be a valid UTI. Using these values set_data will construct and return a valid FedEx request string.
- $t->required(UTI)
-
Method to return the required fields for a given FedEx UTI.
- $t->transaction()
-
Send transaction to FedEx. Returns the full reply from FedEx
- $t->label('someLabel.png')
-
This method will decode the binary image data from FedEx. If nothing is passed in the binary data string will be returned.
- $t->lookup('tracking_number')
-
This method will return the value for an item returned from FedEx. Refer to the
FedEx::Constant
$FE_RE hash to see all possible values. - $t->rbuf()
-
Returns the undecoded string portion of the FedEx reply.
- $t->hash_ret();
-
Returns a hash of the FedEx reply values
my $stuff= $t->hash_ret;
foreach (keys %$stuff) { print $_. ' => ' . $stuff->{$_} . "\n"; }
EXAMPLE
use Business::FedEx;
my $t = Business::FedEx->new(host=>'127.0.0.1', port=>8190);
$t->set_data(2016, 'Sender_Company' => 'Vermonster LLC', 'Sender_Address_Line_1' => '312 Stuart St', 'Sender_City' => 'Boston', 'Sender_State' => 'MA', 'Sender_Postal_Code' => '02134', 'Recipient_Contact_Name' => 'Jay Powers', 'Recipient_Address_Line_1' => '44 Main Street', 'Recipient_City' => 'Boston', 'Recipient_State' => 'MA', 'Recipient_Postal_Code' => '02116', 'Recipient_Phone_Number' => '6173335555', 'Weight_Units' => 'LBS', 'Sender_Country_Code' => 'US', 'Recipient_Country' => 'US', 'Sender_Phone_Number' => '6175556985', 'Future_Day_Shipment' => 'Y', 'Packaging_Type' => '01', 'Service_Type' => '03', 'Total_Package_Weight' => '1.0', 'Sender_FedEx_Express_Account_Number' => '243454968', 'Meter_Number' => '1147026', 'Label_Type' => '1', 'Label_Printer_Type' => '1', 'Label_Media_Type' => '5', 'Ship_Date' => '20020822', 'Customs_Declared_Value_Currency_Type' => 'USD', 'Package_Total' => 1 ) or die $t->errstr;
$t->transaction() or die $t->errstr;
$t->label("myLabel.png");
$t->lookup('Tracking_Number');
EXPORT
None by default.
AUTHORS
This module was originally developed by PTULLY
using the previous version of the FedEx API. Since FedEx has released their new API this module has been revised by Jay Powers JPOWERS
Patrick Tully, ptully@avatartech.com
Jay Powers, jay@vermonster.com
SEE ALSO
Business::FedEx::Constants Business::FedEx::ShipRequest
http://www.vermonster.com/perl
perl.