karrioapi / karrio

Programmable Shipping API (self-hosted)
https://karrio.io
Apache License 2.0
542 stars 99 forks source link

USPS broken after official Rest API upgrade #709

Open tongtian0925 opened 3 weeks ago

tongtian0925 commented 3 weeks ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to shipments create a new one
  2. enter sender and receiver
  3. get rates returns error
  4. { "messages": [ { "carrier_id": "Pz7NrWjQhkEWU8dbP8uJUKmWu0iWGsOj", "carrier_name": "usps", "code": "SHIPPING_SDK_INTERNAL_ERROR", "message": "'str' object has no attribute 'get'" } ] }

curl:

curl 'https://xxxx.syminno.com/v1/proxy/rates' \ -H 'accept: application/json, text/plain, /' \ -H 'accept-language: en-US,en;q=0.9,zh-TW;q=0.8,zh-CN;q=0.7,zh;q=0.6' \ -H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzMxMjAzMzIyLCJpYXQiOjE3Mjg2MTEzMjIsImp0aSI6ImIzZGZmNGY3OGVhOTRjZTk5MTAxZDgwMzljMmQ4MmJlIiwidXNlcl9pZCI6MSwiaXNfdmVyaWZpZWQiOnRydWV9.5ODf-k3Q8EpIRDJyyPzG0foIB07W30RmAnZNR2RcVhE' \ -H 'content-type: application/json' \ -H 'origin: https://xxxx.syminno.com' \ -H 'priority: u=1, i' \ -H 'referer: https://xxxx.syminno.com/' \ -H 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Windows"' \ -H 'sec-fetch-dest: empty' \ -H 'sec-fetch-mode: cors' \ -H 'sec-fetch-site: same-site' \ -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \ -H 'x-test-mode: true' \ --data-raw '{"shipper":{"person_name":"Matt","address_line1":"602 Surf Ave","country_code":"US","postal_code":"11224","city":"Brooklyn","state_code":"NY"},"recipient":{"country_code":"US","address_line1":"145 Brooklyn Ave","city":"Brooklyn","postal_code":"11213","state_code":"NY","person_name":"Zack"},"parcels":[{"weight":1,"width":33.7,"height":18.2,"length":10,"is_document":false,"packaging_type":"your_packaging","weight_unit":"KG","dimension_unit":"CM","items":[]}],"options":{"shipping_date":"2024-10-10T21:55"},"payment":{"paid_by":"sender"},"label_type":"PDF"}'

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

tongtian0925 commented 2 weeks ago

take a deep investigation, there are many issues for the usps integration

for example:

USPS API reference: https://developer.usps.com/apis