question

biteheist avatar image
biteheist asked ismdcf commented

Rounding is not behaving consistently

@Jacob Abrams

Issue: Clover's tax calculation has an issue in rounding it to nearest value, it behaves differently in our below cases:

  • In Row 2 we calculated tax with 4 digit accuracy $33.6158, logically it should round to $33.62, but clover calculate it to $33.61 (its not correct)
  • In Row 13 we calculated tax with 4 digit accuracy $21.7192, logically it should round to $21.72, but clover calculate it to $22.72 here clover work fine
  • In Row 7 we calculated tax with 4 digit accuracy $14.1049, logically it should round to $14.11, but clover calculate it to $14.11 here clover work ok
  • In Row 5 we calculated tax with 4 digit accuracy $11.7147, logically it should round to $11.72, but clover calculate it to $11.71 (its not correct)
Here is the reference doc below.
Taxes
5 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

biteheist avatar image biteheist commented ·

Example of issue.

0 Likes 0 ·
biteheist avatar image biteheist commented ·

Another example

0 Likes 0 ·
img-1165.jpg (352.3 KiB)
biteheist avatar image biteheist commented ·
0 Likes 0 ·
biteheist avatar image biteheist commented ·
0 Likes 0 ·

1 Answer

Jacob Abrams avatar image
Jacob Abrams answered ismdcf commented
Can you provide complete examples with all applicable tax rates? In your spreadsheet you mention 17% tax. However it matters if that 17% is actually composed of more than one tax rate, for example 9% city tax and 6.75% county tax and 1.25% health tax. Each tax is computed independently because each tax authority is paid independently, but on the receipt we show the customer one total tax.

See this example: https://docs.google.com/spreadsheets/d/e/2PACX-1vTHSSrk2ekVu107RgKLLoz2Nc6n7C8UBxXf82wJDKi-qMxkl97NbOxdY41movntZW69QllSUi8erlQq/pubhtml
3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

biteheist avatar image biteheist commented ·

In our demos we posted, we just set one tax rate so we only have 1 calculation. You can see from our examples that the rounding seems to be inconsistent, like our first example:

  • In Row 2 we calculated tax with 4 digit accuracy $33.6158, logically it should round to $33.62, but clover calculate it to $33.61 (its not correct)

With only 1 tax, provided from the sandbox environment, why is it some calculate correctly and some don't. We have clients asking about this so if someone could reachout, that would be great. @Jacob Abrams

0 Likes 0 ·
ismdcf avatar image ismdcf commented ·

Hi @Jacob Abrams,@Jeffrey Blattman,@zgreathouse

We are using the calc jar mentioned here (calc-270.9.jar) to calculate the tax on our API,

We're also facing rounding off issues when comparing TAX values calculated from the calc jar and clover orders placed from the device.

Tax Percentage: 7%

Order Subtotal: $32.25(6.45x5)

Tax from Calc: $2.25

Tax from Clover Device: $2.26


Sample usage of the calc jar can be found in this gist. Can you please point out if there are any issues on how the calc jar was used.

0 Likes 0 ·
ismdcf avatar image ismdcf ismdcf commented ·
0 Likes 0 ·

Welcome to the
Clover Developer Community