Posts

Showing posts from June, 2017

Few best practises while working with orders

Validate the status of line item (at required stage in sale flow) to make sure the product is active, within the valid date range, and that the catalog entry is available in the current market.Validate the status of line item (at required stage in sale flow) to make sure business does not lose money.It is important to add coupons to the IOrderForm before running apply discounts(cart.ApplyDiscount method)Avoid saving carts unnecessarily and repeatedly.You should avoid casting back and forth between concrete Order classes (OrderGroup, OrderForm, etc.) and the new abstraction interfaces (IOrderGroup, IOrderForm, etc.).
For example, from the time you load the cart or purchase order until you save it, only use one API. While this is not always possible, doing it whenever possible helps avoid hidden problems when casting.Do not use Math.Round() for rounding. The following methods return a value with the correct number of decimals, which is determined by the input currency.
- Currency.Round()
-…