Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEDEX] API not returning transit_days or esimated_delivery #739

Open
vangelow opened this issue Dec 15, 2024 · 3 comments
Open

[FEDEX] API not returning transit_days or esimated_delivery #739

vangelow opened this issue Dec 15, 2024 · 3 comments

Comments

@vangelow
Copy link

Describe the bug
Whatever API request I try I never get transit_days and/or estimated_delivery when using Fedex API integration and not Fedex WS (with this one I always get transit days)

To Reproduce
Steps to reproduce the behavior:

  1. Make a POST request to /v1/proxy/rates while having a Fedex API (not WS) carrier setup
  2. Check for transit_days or estimated_delivery

Expected behavior
Any information about an estimated delivery or transit days is part of the response.

Screenshots
API response example below

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Here you can see that there is not information at all about transit_days - This is one item from the "rates" key of the response

    {
      "id": "rat_de158d436c324b358a8fae1e414c8967",
      "object_type": "rate",
      "carrier_name": "fedex",
      "carrier_id": "fedex",
      "currency": "SEK",
      "service": "fedex_international_priority",
      "total_charge": 141.95,
      "extra_charges": [
        {
          "name": "Base Charge",
          "amount": 1005.16,
          "currency": "SEK"
        },
        {
          "name": "Discounts",
          "amount": 0,
          "currency": "SEK"
        },
        {
          "name": "Fuel Surcharge",
          "amount": 27.64,
          "currency": "SEK"
        },
        {
          "name": "Demand Surcharge",
          "amount": 10.97,
          "currency": "SEK"
        },
        {
          "name": "Other",
          "amount": 17.43,
          "currency": "SEK"
        }
      ],
      "meta": {
        "service_name": "FEDEX INTERNATIONAL PRIORITY",
        "ext": "fedex",
        "carrier": "fedex",
        "rate_provider": "fedex",
        "carrier_connection_id": "car_b4eb51669e4c4fadaa9cdf43f3efc577"
      },
      "test_mode": false
    },

@danh91 Please if there is some idea to trigger the transit days to be returned, because I read something about that being part of the request also give us a sign.

@danh91
Copy link
Member

danh91 commented Dec 16, 2024

Hi @vangelow ,
There is a current implementation to retrieve the transit_days from the rates that seem to work with other services.

estimated_delivery = lib.to_date(getattr(rate.operationalDetail, "commitDate", None), "%Y-%m-%dT%H:%M:%S")
shipping_date = lib.to_date(ctx.get("shipment_date") or datetime.datetime.now())
transit_day_list = lib.identity(
(shipping_date + datetime.timedelta(x + 1) for x in range((estimated_delivery.date() - shipping_date.date()).days))
if estimated_delivery is not None
else None
)
transit_days = lib.identity(
sum(1 for day in transit_day_list if day.weekday() < 5)
if transit_day_list is not None
else None
)

I suspect it might be an issue related to FedEx International priority
I will try reproducing it with international shipments leaving the US and another leaving CA, but if you can share the API Logs > Timeline tab response you get from FedEx, it will help improve the transit days parsing

@vangelow
Copy link
Author

@danh91 As part of our investigation, fedex responded that they recreated the same request your /v1/proxy/rates does, but also added the description in customsClearenceDetail under commodities and it seems that this way it returns rates.

image

They said without that description the API does not respond with transit times, without it the transit time is none

@vangelow
Copy link
Author

@danh91 I also tested this with sending the the description and it worked, deliveryDate is returned in the json response.

        "requestedShipment": {
            "customsClearanceDetail": {
                "commodities": [
                    {
                        "customsValue": {"amount": 1, "currency": "USD"},
                        "description": "Personal documents",
                        "numberOfPieces": 1,
                        "partNumber": "0000",
                        "quantity": 1,
                        "quantityUnits": "PCS",
                        "unitPrice": {"amount": 1, "currency": "USD"},
                        "weight": {"units": "KG", "value": 1},
                    }
                ],
                "dutiesPayment": {
                    "paymentType": "SENDER",
                    "payor": {
                        "responsibleParty": {"accountNumber": {"value": "203392999"}}
                    },
                },
            },

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants