Jump to content



* * * * * 1 votes

FedEx - Web Services v9


  • Please log in to reply
596 replies to this topic

#581 ONLINE   Roaddoctor

Roaddoctor
  • Members
  • 963 posts
  • Real Name:David Jennings
  • Gender:Not Telling
  • Location:Texas

Posted 04 April 2014 - 01:30 PM

Are you using the Ship-Separate function? this will rate each piece individually rather than by store config.

Also have you experimented with
			 if($ShipmentRateDetail->ShipmentRateDetail->RateType=='PAYOR_LIST_PACKAGE')
//	 if($ShipmentRateDetail->ShipmentRateDetail->RateType==('PAYOR_LIST_PACKAGE' || 'PAYOR_LIST_SHIPMENT')) // try this if having international quoting errors

beyond that, the module was written wiith US as focus. You may need to customize the code.

I noticed recently that numinix is using a fork of this module with Address verification working and using V10 of the WSDL.
https://www.numinix.com/downloads/zen-cart-modules/shipping/fedex-web-services-shipping

If anyone's in the mood to port that over to the osc fork that would be awesome. I keep trying to get to it but real work has me swamped.

Edited by Roaddoctor, 04 April 2014 - 01:34 PM.

-Dave

#582   DriWashSolutions

DriWashSolutions
  • Members
  • 224 posts
  • Real Name:John Skurka
  • Location:Ithaca, NY

Posted 07 April 2014 - 10:21 PM

I've been making mods to the FedEx Label Add-on.  I've got it working, and have passed FedEx Certification (everyone printing labels must now be certified by FedEx).  As soon as I get it working 100%, I plan to give it back to the community.
John Skurka

#583   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 10 April 2014 - 07:12 PM

View PostDriWashSolutions, on 07 April 2014 - 10:21 PM, said:

I've been making mods to the FedEx Label Add-on.  I've got it working, and have passed FedEx Certification (everyone printing labels must now be certified by FedEx).  As soon as I get it working 100%, I plan to give it back to the community.

Sound excellent! :D
Any ETA?
Oh, and can it be used on international shops too (ie. non-US-based)? or only US based vendors in mind?

cheers
M.

Edited by dr_lucas, 10 April 2014 - 07:14 PM.


#584   greasemonkey

greasemonkey
  • Members
  • 290 posts
  • Real Name:Scott
  • Gender:Male

Posted 11 April 2014 - 12:16 PM

@dr_lucas

Quote

Oh, and can it be used on international shops too (ie. non-US-based)? or only US based vendors in mind?

I use this addon in Canada for domestic shipments (shipments within Canada). It does not work for international shipments when a commercial invoice is required (example: Canada to the USA or I presume visa versa).

I know this is possible... But someone would really want to have to update a significant portion of the label module.

#585   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 11 April 2014 - 12:44 PM

View Postgreasemonkey, on 11 April 2014 - 12:16 PM, said:

@dr_lucas

I use this addon in Canada for domestic shipments

Which addon do you refer to? (I was talking about the new addon @DriWashSolutions said he is now making)

#586   greasemonkey

greasemonkey
  • Members
  • 290 posts
  • Real Name:Scott
  • Gender:Male

Posted 11 April 2014 - 12:49 PM

@dr_lucas @DriWashSolutions is updating this addon originally released by me for webservices updated a couple times by others http://addons.oscommerce.com/info/2244

I'm using my original version.

#587   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 11 April 2014 - 02:42 PM

I see. Then yours doesn't work for international vendors (which I already know, as I read your comments in the add-on section. good job, btw), hopefully his new one will, which is the reason for my question a few posts back ;)
by the way, the latest FedEX real-time quotes add-on is also working only for US (maybe CA too), and I had to manually modify some of the code to make it work for me here, as I am out of the USA. Hopefully I won't need to do the same for the upcoming revised labels add-on...

#588   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 14 April 2014 - 01:56 PM

I just uploaded my version 9.5.1 of the FedEX web services module: http://addons.oscommerce.com/info/7977/
Changelog:
Works on MS 2.2 RC2a and up (utf8 encoding is back, no point in removing it).
New in this version:
Works for all vendors, based in or out of the USA (ie. international version).
Added: Debugging option, configurable via the admin
Added: Rates currency conversion option.
Added: Shipping/pickup delay option, as many vendors need several days to process orders

BUG Fixed: When there was only 1 shipping option returned in the response, the shipping rate shown was 0.
BUG Fixed: Commented out old CRE code, that was messing the Order Editor's totals
Fixed: RateRequestTypes was hardcoded on "LIST" rates. Now it's using the correct configured option from the admin (LIST or ACCOUNT rates, as you select).

I know that the currency conversion option can be improved, as it needs to be manually modified regularly to match exchange fluctuations, thus if anyone wants to improve this, that would be cool.
If anyone wants to repackage the files into a full package, with clearer instructions etc., please feel free to do so.

This is NOT a full package. It's just the modified fedexwebservices.php and fedex-common.php5 files.
Thus, uninstall the module, backup the 2 files you already have from the previous version, which are on your server, then copy these 2 files to their correct directories and reinstall the module from the admin.
This is required because the new fedexwebservices.php file has new database entries that it needs to insert.

#589 ONLINE   Roaddoctor

Roaddoctor
  • Members
  • 963 posts
  • Real Name:David Jennings
  • Gender:Not Telling
  • Location:Texas

Posted 14 April 2014 - 09:01 PM

@dr_lucas

Don't know why yet, buy I tried your version and I am getting a 500 internal server error as soon as a quote is requested. boom.
on a fairly clean osc 2.3.3.4
-Dave

#590   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 15 April 2014 - 02:57 AM

Interesting. It works perfectly fine here on RC2a, never tested on 2.3+, but should work fine too.
Error 500 is Apache error. What does your Apache error log show?

#591   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 15 April 2014 - 03:14 AM

Oh, and also what does your php error log show for the same time u get this 500 error?

#592   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 15 April 2014 - 02:51 PM

@greasemonkey
I am a bit confused. In your changelog, you wrote that both fedexdc.php are no longer needed, so I deleted them. Now I am getting errors like:
Warning: require(includes/fedexdc.php) [function.require0]: failed to open stream: No such file or directory in /my/admin-folder/ship_fedex.php on line 42

So I checked /admin/ship_fedex.php and found the below line. Should I comment it out?
require(DIR_WS_INCLUDES . 'fedexdc.php');

Edited by dr_lucas, 15 April 2014 - 02:54 PM.


#593   greasemonkey

greasemonkey
  • Members
  • 290 posts
  • Real Name:Scott
  • Gender:Male

Posted 15 April 2014 - 04:07 PM

@dr_lucas yes, give it a try... I may have messed up the instructions...

#594   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 15 April 2014 - 04:47 PM

ok, commenting out works, thx.
Now testing, getting the "Meter number is not registered" error in the XML response. I know that the number is correct, because I am using it all the time to get quotes and it works fine.
Do you know, by any chance, why I get this error?

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
	<env:Header xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
	<soapenv:Body>
		<v10:ProcessShipmentReply xmlns:v10="http://fedex.com/ws/ship/v10">
			<v10:HighestSeverity>ERROR</v10:HighestSeverity>
			<v10:Notifications>
				<v10:Severity>ERROR</v10:Severity>
				<v10:Source>ship</v10:Source>
				<v10:Code>8001</v10:Code>
				<v10:Message>Meter number is not registered</v10:Message>
				<v10:LocalizedMessage>Meter number is not registered</v10:LocalizedMessage>
			</v10:Notifications>
			<ns1:TransactionDetail xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/ship/v10">
				<ns1:CustomerTransactionId>ORDER ID: 119064</ns1:CustomerTransactionId>
			</ns1:TransactionDetail>
			<ns1:Version xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/ship/v10">
				<ns1:ServiceId>ship</ns1:ServiceId>
				<ns1:Major>10</ns1:Major>
				<ns1:Intermediate>0</ns1:Intermediate>
				<ns1:Minor>0</ns1:Minor>
			</ns1:Version>
		</v10:ProcessShipmentReply>
	</soapenv:Body>
</soapenv:Envelope>

Edited by dr_lucas, 15 April 2014 - 04:48 PM.


#595   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 15 April 2014 - 04:50 PM

by the way, it happens when I am using the ship_fedex.php (action=ship), ie. when trying to book a shipment

#596   greasemonkey

greasemonkey
  • Members
  • 290 posts
  • Real Name:Scott
  • Gender:Male

Posted 15 April 2014 - 08:48 PM

@dr_lucas I don't know for sure... However, I would guess this is on Fedex's end. Give them (I'm sure you know the tech support number) a call an try and book a shipment while on the phone... they should be able to see why you are getting the error (maybe they didn't register the meter number correctly after they approved the lable?)

#597   dr_lucas

dr_lucas
  • Members
  • 285 posts
  • Real Name:Michaela
  • Gender:Female

Posted 16 April 2014 - 02:41 AM

Yeah, I sent them an email. I got the below response from FedEX APAC (Asia Pacific, where I am located) just now:

Quote

Dear Customer

To process shipments in production level, you must get approval from US label team.  We call this process as “Label Certification Process”.  You can find more information from FedEx Web Services > Certification on FedEx Developer Resource Center website (www.fedex.com/us/developer)

For the process, you must provide us a copy of labels (in PDF format) that you create in testing level.  Besides the labels, you need to provide us the following information.  Once we receive the information and labels, we will forward the request US label team.  The process takes about 5 business days.

FedEx 9-Digit Acct Number:
FedEx Ground Acct Number:  <provide only if you have>
FedEx Test Meter Number:
FedEx Production Meter Number:  
Company Name:
Company Contact Name:
Printer Model(s) to be Utilized:
How Many of Each Printer Model:  
Date Anticipated for Move to Production:



Best Regards
FedEx APAC Web Services Team

By the way, I was trying the admin/track_fedex.php file and it wasn't working and was giving me lost of errors, so I went ahead and rewrote the entire file using the new TrackService_v8.wsdl (version 8). Works nicely now, although not fully polished yet.
Here is the code:

<?
/**
 * track_fedex.php
 *
 * This is the updated tracking script to view the tracking status of shipped products. It uses
 * the FedEx Web Service API and requires a production API key to work.
 *
 */
require('includes/application_top.php');

// debugging? 

$debug = 0; // 1 for yes, 0 for no

$action = $HTTP_GET_VARS['action'];
$order = $HTTP_GET_VARS['oID'];
$tracking_number = $HTTP_GET_VARS['num'];

require_once(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'library/fedex-common.php5');
$path_to_wsdl = DIR_FS_CATALOG . DIR_WS_INCLUDES . "wsdl/TrackService_v8.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");

$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information

$request['WebAuthenticationDetail'] = array(
'UserCredential' =>array(
'Key' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY, 
'Password' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD
)
);
$request['ClientDetail'] = array(
'AccountNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM, 
'MeterNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM
);
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Track Request v8 using PHP ***');
$request['Version'] = array(
'ServiceId' => 'trck', 
'Major' => '8', 
'Intermediate' => '0', 
'Minor' => '0'
);
$request['SelectionDetails'] = array(
'CarrierCode' => 'FDXE',
'PackageIdentifier' => array(
'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
'Value' => $tracking_number, // Replace 'XXX' with a valid tracking identifier
)
);

$request['ProcessingOptions'] = 'INCLUDE_DETAILED_SCANS';



try 
{
if(setEndpoint('changeEndpoint'))
{
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
}

$response = $client->track($request);





if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
{
if ($debug) {
echo '<table border="1">';
echo '<tr><th>Tracking Details</th><th>&nbsp;</th></tr>';
trackDetails($response->TrackDetails, '');
echo '</table>';

printSuccess($client, $response);
}
}
else
{
//echo "<!-- " . printError($client, $response) . " -->";
} 


	writeToLog($client);	// Write to log file   
} catch (SoapFault $exception) {
	printFault($exception, $client);
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head> <!-- header //-->
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<?php
  require(DIR_WS_INCLUDES . 'header.php');
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top">
<table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table>
</td>

<!-- body_text //-->
<td width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading">
<?php echo HEADING_TITLE . ($order ? ', ' . ORDER_NUMBER . $order : '') ?>
</td>
<td class="pageHeading" align="right">
<?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?>
</td>
<td class="pageHeading" align="right">
<?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . 'oID=' . $order . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="80%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', 1, 15); ?></td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<?php if ($response -> HighestSeverity == 'FAILURE' || $response -> HighestSeverity == 'ERROR') { ?>
<tr>
<td class="main"><?php echo $response->Notifications->Message; ?></td>
</tr> 
<?php 
} else {

// foreach((array)$response->CompletedTrackDetails->TrackDetails->StatusDetail->Location as $detail) {
$detail = $response->CompletedTrackDetails->TrackDetails->DestinationAddress;
// list destination
$dest_city = $detail->City;
$dest_state = $detail->CountryName;
$dest_zip = $detail->PostalCode; // - not exist
$signed_by = $detail->DeliverySignatureName; // - check what is correct???

// format delivery time
if ($signed_by) {
$delivery_time= strtotime($detail->EstimatedDeliveryTimestamp);
}


?>
<tr>
<td class="main"><b><?php echo PACKAGE_DESTINATION ?></b></td>
</tr>
<tr>
<td class="main"><?php echo $dest_city . ', ' . $dest_state . ' ' . $dest_zip ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', 1, 15); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo PACKAGE_STATUS ?></b></td>
</tr>
<?php if ($signed_by) {

// if left without signature, let them know
// (add more as they appear)
if (strstr($signed_by,'F.RONTDOOR')) {
$signed_by = '<tr><td class="main">' . DELIVERED_FRONTDOOR . '</td></tr>';
}
if (strstr($signed_by,'S.IDEDOOR')) {
$signed_by = '<tr><td class="main">' . DELIVERED_SIDEDOOR . '</td></tr>';
}
if (strstr($signed_by,'G.ARAGE')) {
$signed_by = '<tr><td class="main">' . DELIVERED_GARAGE . '</td></tr>';
}
if (strstr($signed_by,'B.ACKDOOR')) {
$signed_by = '<tr><td class="main">' . DELIVERED_BACKDOOR . '</td></tr>';
}
?>
<tr>
<td class="main">
<?php echo PACKAGE_DELIVERED_ON . date("F j, Y", $delivery_date) . PACKAGE_DELIVERED_AT . date("g:ia", $delivery_date) ?>
</td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', 1, 15); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo PACKAGE_SIGNED_BY ?></b></td>
</tr>
<tr>
<td class="main"><?php echo $signed_by ?></td>
</tr>
<?php  } else { ?>
<tr>
<td class="main"><b><?php echo PACKAGE_IN_TRANSIT ?></b></td>
</tr>
<tr>
<td class="main">
<?php 

foreach((array)$response->CompletedTrackDetails->TrackDetails->Events as $track_event) {
$status_note = $track_event->EventDescription;
$status_city = $track_event->Address->City;
$status_state = $track_event->Address->CountryName;
   if ($status_note != 'Shipment information sent to FedEx') {
   echo "<p>{$status_note} : {$status_city}, {$status_state}</p>";
  }else{
  echo "<p>{$status_note}</p>";
  }
}
?>
</td>
</tr>
<?php } ?>
<?php // } ?>
<?php } ?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td> <!-- body_text_eof //--> 
</tr>
</table> <!-- body_eof //--> 
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--> 
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); 
?>