Closed matalek closed 1 year ago
Thanks for your report.
I'm not sure that you are correct. From what I recall - it's been a while since I wrote this - the VAT is applied to the worth and duty. See also the following page from the federal government, which seems to agree with me:
However, I haven't used this tool in a while, as many shops delivering to Switzerland now calculate that price for you. I also didn't read up about this in a long time.
So I'm not saying you're wrong, but I have a hard time judging if you are right. If you can explain the difference between the Post example, and the link I posted above (or maybe tell my why that does not apply), then I'm happy to change to code to your suggestion. I leave it up to you to get to the bottom of this, and I'll gladly change the code if you can.
I'm also happy to take a PR. Note that there is a tests.js
file, that includes a few examples. Those would have to be updated.
You're right that one has to pay VAT also on duties. But from the links I shared it looks like this VAT is not included in the 5 CHF exemption limit. Which makes sense - if you're below the limit there are no duties applied.
I propose to make the logic explicitly follow the logic described on Post FAQ, i.e. compare the value of goods with 65/200 CHF limit. This makes more sense than just checking the computed VAT, because already for 64.65 CHF the rounded 7.7% VAT is 5 CHF, yet, per FAQ, you don't need to pay taxes then.
For the values above the threshold, the current logic will stay the same - we will compute VAT for both value of goods and duties.
I'll send a PR shortly. The tests file is actually currently failing, I'll fix that as well.
As noted in the PR, LGTM.
Thanks for your help!
Consider the following example: Price: 50 CHF Shipping: 0 CHF Courier: Post
For this example the calculator displays Your 7.7% VAT is 5.20., even though 7.7% out of 50 is 3.85 CHF. The VAT should be computed based on the product price, not (product price + fees).
From Post FAQ:
Similarly, in the example specified in this blog post, the VAT is computed based on value of goods.
This makes a big difference especially for small values, since it makes taxes non-zero for lower values than it actually should.
I think the fix would be to change this line to compute
r.vat
only based onr.worth
, notr.worth + r.duty
.