The PricingHelper function helps you perform pricing-related operations such as apply rounding and updating the Price Method for line items. To get the instance of IPricingHelper, you must call GetPricingHelper(), which provides the following methods:
Methods
decimal? ApplyRounding(decimal? value, int precision, RoundingMode roundingMode);
void UpdatePrice(ILineItemModel lineItemModel);
public decimal? ApplyRounding(decimal? value, int precision, RoundingMode roundingMode);
public decimal? ApplyRounding(decimal? value, int? currencyPrecision = null);
public void UpdatePrice(ILineItemModel lineItemModel);
public bool AddPricePointAdjustmentValueToPriceWaterfall(ILineItemModel lineItem, IPricePointAdjustmentValue newPricePointAdjValue, int? index = null);
public IPricePointAdjustmentValue CreatePricePointAdjustmentValue();
public void RecalculatePriceWaterfall(ILineItemModel lineItem);
public bool RemoveAddedAdjFromPriceWaterfall(ILineItemModel lineItem, bool recalculate, string pricePoint, PricePointAdjustmentType type, string name, string sourceId);
public IConfigSystemProperties GetSystemProperties();
public Task<IList<T>> GetRecordsAsync<T>(IQueryObject queryObject);
public IQueryObject CreateQueryObject();
public T CreateEntity<T>() where T : IBaseEntity;
CODE
Example
var pricingHelper = GetPricingHelper();
var logHelper = GetLogHelper();
var roundedValue = pricingHelper.ApplyRounding(1.657m,2,RoundingMode.DOWN);
logHelper.LogDebug(roundedValue);
roundedValue = pricingHelper.ApplyRounding(1.657m,2,RoundingMode.UP);
logHelper.LogDebug(roundedValue);