Looking for some help about pennies that seems to stem from rounding and the computation of sales tax.

Willing to provide more details as needed, but here's where I think my issue is.
I have a total base price amount '1999' so $19.99
Total discounts of '1009.9' so -$10.10
Sales tax of 7.5% on the difference comes to '74.1825' or $0.74

So far on the price calculation rules we've kept it set to 'do not round', but at the end when calculating commerce_order_component_total it has a little:
$order_wrapper->commerce_order_total->amount = round($amount);

From here with my current setup:
We take the price, hoist it off to authnet and toss it to the ERP, where it errors because the value booked on the card doesn't match what the ERP expects.

Our ERP is expecting the sales tax to be $0.75, because it really enjoys tenths of pennies. It likes to ceil(74.1825) for its 75.

----
That's the issue, literally a penny.
We can do some things to fix this, but I'm seeing if anyone knows other fixes.

Options available to me currently:

  • Add a rounding type that uses ceil() on line-item taxes, but this leads to overcharging pennies since Drupal Commerce rounds up always then totals so each quantity item has more pennies; however the credit card booking is higher than the charge, so all accountants are happy.
  • Tell the accountants to manually clear the pennies, which costs more than pennies.
  • Manipulate the authnet figures to book an additional penny.

While trying other in Drupal hooks I also tried changing the round($amount) above to ceil($amount), just for grins, which added the penny to the total (as expected) but didn't change the sales tax value.

Comments

bojanz’s picture

Status: Active » Closed (outdated)