Skip to content

Commit

Permalink
Add ability to request transit information with rate request.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielatdattrixdotcom committed May 25, 2013
1 parent 38fb0d4 commit 01ca994
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions examples/rate_request.py
Expand Up @@ -19,6 +19,10 @@
# We're using the FedexConfig object from example_config.py in this dir.
rate_request = FedexRateServiceRequest(CONFIG_OBJ)

# If you wish to have transit data returned with your request you
# need to uncomment the following
# rate_request.ReturnTransitAndCommit = True

# This is very generalized, top-level information.
# REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER or STATION
rate_request.RequestedShipment.DropoffType = 'REGULAR_PICKUP'
Expand Down
9 changes: 7 additions & 2 deletions fedex/services/rate_service.py
Expand Up @@ -41,6 +41,10 @@ def _prepare_wsdl_objects(self):
This is the data that will be used to create your shipment. Create
the data structure and get it ready for the WSDL request.
"""

# Default behavior is to not request transit information
self.ReturnTransitAndCommit = False

# This is the primary data structure for processShipment requests.
self.RequestedShipment = self.client.factory.create('RequestedShipment')
self.RequestedShipment.ShipTimestamp = datetime.now()
Expand Down Expand Up @@ -107,7 +111,8 @@ def _assemble_and_send_request(self):
ClientDetail=self.ClientDetail,
TransactionDetail=self.TransactionDetail,
Version=self.VersionId,
RequestedShipment=self.RequestedShipment)
RequestedShipment=self.RequestedShipment,
ReturnTransitAndCommit=self.ReturnTransitAndCommit)
return response

def add_package(self, package_item):
Expand All @@ -125,4 +130,4 @@ def add_package(self, package_item):
package_weight = package_item.Weight.Value
self.RequestedShipment.TotalWeight.Value += package_weight
self.RequestedShipment.PackageCount += 1


0 comments on commit 01ca994

Please sign in to comment.