The value returned from Correios is the sum of "declared value" and the actual shipping cost.

The patch fixes the value returned. You can check using the simulator.

On a side note, the service also seems to change de declared value, discounting 0,50 every time. You can see this while testing an URL for the service and comparing the reponse.

Comments

wasare’s picture

franz,

Thanks for this report, but this bug wasn't confirmed.

I think your trouble is related with this one #880204: Wrong format of "Declared value" causes a incorrect rate returned by correios webservice.

franz’s picture

Sorry, what do you mean by "bug wasn't confirmed" ? Is it not reproducible?

I don't think the issue is the same. The issue i had was clearly the sum of "declared value" + shipping cost, and not a value increased 100x.

I also remember manipulating the service URL to check this issue.

wasare’s picture

franz,

Where the "declared value" is summed with the shipping cost? Show me in the code, please.

Could you give me a example to test in my environment? In your patch i see just a decreasing the "declared value" from the final shipping cost.

franz’s picture

No, there's a misunderstanding.

What I noticed is, when using declared value, the webservice returns the total value which is the sum of the 'declared value' and 'shipping cost'. Thus, the subtraction is intended to return the actual 'shipping cost' only. Summary:

  • Send 'declared value' + 'dimension'
  • Receive a big value (the sum of declared value and shipping cost)
  • shipping cost = value returned from webservice - declared value

I was able to assert this by comparing the results of correios simulator with the same data and directly manipulating the webservice URL (GET) within the browser.

wasare’s picture

StatusFileSize
new2.68 KB

franz,

Now i think understood you.

Your patch make me confusing because the variable ($valor_declarado) stores the total order price and decreasing that from the shipping cost result a free rate (< 0).

I implemented a new option to send or not the total order price as "declared value", when not the module will send always 0, then the shipping cost won't be increased because the "declared value".

franz’s picture

Nice! ;)

wasare’s picture

Status: Needs review » Fixed

changes were commited and released!

wasare’s picture

Status: Fixed » Closed (fixed)