Re-work rounding strategy in calculators

Fixed in

EPiServer.Commerce 13.0.0

Created

Feb 07, 2018

Updated

Mar 29, 2019

Area

Core

State

Closed, Acceptance tests pass


Description

Changes in this story:
• A new API that converts the currency of a Money type and returns full precision value:

Mediachase.Commerce.Shared.CurrencyFormatter.ConvertCurrencyWithFullPrecision(money, currency)

• Removes intermediate rounding from the default implementation of calculators. So, it rounds only at the highest level (order group calculator).
CalculateXXX() methods in the default implementation of calculators, which are protected, now return full precision values.
• Stores full precision values for discount amounts on line items and shipments. This behavior is a breaking change.
• Adds a new global configuration on the promotion engine: a Boolean setting, named ApplyPromotionUnitIndividually. You can change this setting in the appSettings.
If set to true, the promotion engine takes the percentage discount for an individual unit and, from then on, works like an “amount off” discount.

If set to false, the setting works as it does currently in Commerce 12. That is, the promotion engine does not take the percentage discount for an individual unit, but for a whole line item (so it takes the quantity of line item into account).