Class PriceRoundingService

java.lang.Object
sk.iway.iwcm.components.basket.rest.PriceRoundingService

public final class PriceRoundingService extends Object
Calculates rounded gross unit prices and allocates VAT rounded per tax rate.
  • Method Details

    • isEnabled

      public static boolean isEnabled()
    • createPriceFormat

      public static DecimalFormat createPriceFormat()
      Creates a validated currency formatter shared by pricing and presentation.
    • roundGross

      public static BigDecimal roundGross(BigDecimal amount)
      Rounds a selling unit price to the current display format's maximum precision.
    • sellingPriceWithVat

      public static BigDecimal sellingPriceWithVat(BigDecimal net, BigDecimal rate)
      Applies VAT and the active selling-price policy to catalog or basket net prices.
    • unroundedPriceWithVat

      public static BigDecimal unroundedPriceWithVat(BigDecimal netPrice, int vatRate)
      Applies an integer VAT rate without rounding the gross price.
    • paymentFeePriceWithVat

      public static BigDecimal paymentFeePriceWithVat(BasketInvoiceItemEntity item)
      Keeps payment fees unrounded before currency conversion, preserving legacy item pricing when disabled.
    • deliveryPriceWithVat

      public static BigDecimal deliveryPriceWithVat(BigDecimal netPrice, Integer vatRate)
      Keeps delivery fees unrounded before currency conversion, preserving legacy two-decimal pricing when disabled.
    • roundLineGross

      public static BigDecimal roundLineGross(BigDecimal grossUnit, int quantity)
      Settles a line in EUR or CZK after multiplying its rounded unit price by quantity.
    • recalculateLinePrice

      public static void recalculateLinePrice(BasketInvoiceItemEntity item)
      Calculates an item's gross unit price in memory after a net price or VAT change.
    • recalculateLinePrice

      public static void recalculateLinePrice(BasketInvoiceItemEntity item, int scale)
    • prepareForSave

      public static void prepareForSave(BasketInvoiceItemEntity item)
      Stores the net equivalent of the agreed gross unit in the existing price column.
    • allocateVat

      public static void allocateVat(List<BasketInvoiceItemEntity> items)
      Allocates each rate's rounded VAT across its lines using largest remainders.