Open tongtian0925 opened 1 month ago
take a deep investigation, there are many issues for the usps integration
for example:
auth is not working because client id and secret is not passed to login https://github.com/karrioapi/karrio/blob/main/modules/connectors/usps/karrio/providers/usps/utils.py#L50
USPS API document has been changed ,all the proxy apis are changed, USPS add a prefix to that. get rate API, in the code we have url=f"{self.settings.server_url}/v3/total-rates/search", but the actually API has been changed to https://api.usps.com/**prices**/v3/total-rates/search
some API auth Bearer token + payment auth token, X-Payment-Authorization-Token
USPS API reference: https://developer.usps.com/apis
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
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
Desktop (please complete the following information):
Additional context Add any other context about the problem here.