python-fedex-devs / python-fedex

A light wrapper around FedEx's SOAP API.
http://python-fedex.readthedocs.org
BSD 3-Clause "New" or "Revised" License
156 stars 139 forks source link

International Time in Transit - FedexAvailabilityCommitmentRequest #113

Open Helix31522 opened 5 years ago

Helix31522 commented 5 years ago

Hi all,

Thanks in advance for your help. What am I missing here? I can return time in transit for ground shipments, but I am having no luck with International time in transit.

            avc_request = FedexAvailabilityCommitmentRequest(CONFIG_OBJ)
            avc_request.Origin.PostalCode = sender_postal
            avc_request.Origin.CountryCode = sender_country
            avc_request.Destination.PostalCode = receiver_postal
            avc_request.Destination.CountryCode = receiver_country
            avc_request.CarrierCode = 'FDXE'
            avc_request.ShipDate = shipment_date

            avc_request.send_request()
            print(avc_request.response)
            print('----start------')
            for option in avc_request.response.Options:
                if hasattr(option, 'TransitTime'):
                    print(option.Service)
                    print(option.TransitTime)
            print('----end------')

avc_request.response prints the following, but there is no transit time to pull for each service:

(reply){
   HighestSeverity = "SUCCESS"
   Notifications[] = 
      (Notification){
         Severity = "SUCCESS"
         Source = "vacs"
         Code = "000"
         Message = "SUCCESS"
         LocalizedMessage = "SUCCESS"
      },
   Version = 
      (VersionId){
         ServiceId = "vacs"
         Major = 4
         Intermediate = 0
         Minor = 0
      }
   Options[] = 
      (ServiceAvailabilityOption){
         Service = "INTERNATIONAL_PRIORITY"
         DestinationStationId = "MNLA "
         DestinationAirportId = "MNL"
      },
      (ServiceAvailabilityOption){
         Service = "INTERNATIONAL_ECONOMY"
         DestinationStationId = "MNLA "
         DestinationAirportId = "MNL"
      },
      (ServiceAvailabilityOption){
         Service = "INTERNATIONAL_PRIORITY_FREIGHT"
         DestinationStationId = "MNLA "
         DestinationAirportId = "MNL"
      },
      (ServiceAvailabilityOption){
         Service = "INTERNATIONAL_ECONOMY_FREIGHT"
         DestinationStationId = "MNLA "
         DestinationAirportId = "MNL"
      },
      (ServiceAvailabilityOption){
         Service = "INTERNATIONAL_PRIORITY_DISTRIBUTION"
      },
      (ServiceAvailabilityOption){
         Service = "INTERNATIONAL_DISTRIBUTION_FREIGHT"
      },
 }
jeenal-gajjar commented 5 years ago

I am also getting the same Issue. I also got issue during international shipment for the commodities. error: fedex.base_service.FedexError: Commodities are required (Error code: 6065) Can you help me into this issue?

radzhome commented 4 years ago

If you get it working please add an example for international shipment. Thanks.

skiv23 commented 3 years ago

I am also getting the same Issue. I also got issue during international shipment for the commodities. error: fedex.base_service.FedexError: Commodities are required (Error code: 6065) Can you help me into this issue?

If anyone else comes here with this question, here's the code sample for commodities

commodity = shipment.create_wsdl_object_of_type('Commodity')
commodity.NumberOfPieces = 1
commodity.Description = '123'
commodity.CountryOfManufacture = 'US'
commodity.Quantity = 1
commodity.QuantityUnits = 'EA'
commodity.Weight.Units = 'LB'
commodity.Weight.Value = 1.0
commodity.UnitPrice.Currency = 'USD'
commodity.UnitPrice.Amount = 1.0
commodity.CustomsValue.Currency = 'USD'
commodity.CustomsValue.Amount = 1.0

shipment.RequestedShipment.CustomsClearanceDetail.Commodities = [commodity]
shipment.RequestedShipment.CustomsClearanceDetail.CustomsValue.Currency = "USD"
shipment.RequestedShipment.CustomsClearanceDetail.CustomsValue.Amount = 1.0
shipment.RequestedShipment.CustomsClearanceDetail.DutiesPayment.PaymentType = 'SENDER'
shipment.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.AccountNumber = self.CONFIG_OBJ.account_number

More info about these fields can be found in their PDF.

Regarding Time in transit - Issue still exists, but I believe it's in the API itself. Developer PDF has a US->BR ServiceAvailabilityRequest example in xml, it doesn't have any extra data, but it doesn't show transit time anyway. Tried both ways - this library and postman.

radzhome commented 3 years ago

You want to add the example as a PR?

MatinF commented 3 years ago

The new international shipment example may also be useful here.