Closed iepuzaur closed 6 months ago
Looks like it's a bug in the API. I did a few tests with differently formatted requests (including not sending the declaredValue field).
It always returns tarrif = 0 if the declared value is 0. If the declared value is at least 0.1, it returns valid tarrif value.
I will leave this issue open for now and will try to contact them about the problem.
Looks like the problem only manifests when the requests are done as x-www-form-urlencoded.
There is a bug in the client that sends the requests that caused JSON requests to fail (why I used x-www-form-urlencoded).
I am working on the bug right now and will have an update by the end of the day.
After checking with updated version 2.0.4 it still does not return a valid data['tarrif'] on all the requests. Example: service 'Standard' and no option sent (i.e. epod or Saturday delivery) or empty option value. This returns tarrif 0.
Apparently the way they made it makes the response dependent on the account and options. Apparently, it can return 0 if it's a contract based account and the payment type is sender.
I recommend always setting a declared value, even if it's set to 0.1 as that way it should always return a valid tariff value.
This is weird (at least), as such issue had no occurence on the previous version of the API (which returns the cost correctly creating the AWB - same account / options). Setting a declared value of 0.1 reflects also on the printed AWB, which is not an option. A workaround would have been to use the GetCosts option as backup, but the return values look different than data['tarrif'].
When creating an AWB, according to docs (official and library) setting a shipping declared value (setDeclaredValue) is optional. However when the declared values is set and is not 0, the response returns valid data['tarrif'] (the cost of the shipment). If declared value is not set or is set to 0, data['tarrif'] returns 0. On V1 of the API this was working correctly, it looks rather related to API.