Class PriceRoundingService
java.lang.Object
sk.iway.iwcm.components.basket.rest.PriceRoundingService
Calculates rounded gross unit prices and allocates VAT rounded per tax rate.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidallocateVat(List<BasketInvoiceItemEntity> items) Allocates each rate's rounded VAT across its lines using largest remainders.static DecimalFormatCreates a validated currency formatter shared by pricing and presentation.static BigDecimaldeliveryPriceWithVat(BigDecimal netPrice, Integer vatRate) Keeps delivery fees unrounded before currency conversion, preserving legacy two-decimal pricing when disabled.static booleanstatic BigDecimalKeeps payment fees unrounded before currency conversion, preserving legacy item pricing when disabled.static voidStores the net equivalent of the agreed gross unit in the existing price column.static voidCalculates an item's gross unit price in memory after a net price or VAT change.static voidrecalculateLinePrice(BasketInvoiceItemEntity item, int scale) static BigDecimalroundGross(BigDecimal amount) Rounds a selling unit price to the current display format's maximum precision.static BigDecimalroundLineGross(BigDecimal grossUnit, int quantity) Settles a line in EUR or CZK after multiplying its rounded unit price by quantity.static BigDecimalsellingPriceWithVat(BigDecimal net, BigDecimal rate) Applies VAT and the active selling-price policy to catalog or basket net prices.static BigDecimalunroundedPriceWithVat(BigDecimal netPrice, int vatRate) Applies an integer VAT rate without rounding the gross price.
-
Method Details
-
isEnabled
public static boolean isEnabled() -
createPriceFormat
Creates a validated currency formatter shared by pricing and presentation. -
roundGross
Rounds a selling unit price to the current display format's maximum precision. -
sellingPriceWithVat
Applies VAT and the active selling-price policy to catalog or basket net prices. -
unroundedPriceWithVat
Applies an integer VAT rate without rounding the gross price. -
paymentFeePriceWithVat
Keeps payment fees unrounded before currency conversion, preserving legacy item pricing when disabled. -
deliveryPriceWithVat
Keeps delivery fees unrounded before currency conversion, preserving legacy two-decimal pricing when disabled. -
roundLineGross
Settles a line in EUR or CZK after multiplying its rounded unit price by quantity. -
recalculateLinePrice
Calculates an item's gross unit price in memory after a net price or VAT change. -
recalculateLinePrice
-
prepareForSave
Stores the net equivalent of the agreed gross unit in the existing price column. -
allocateVat
Allocates each rate's rounded VAT across its lines using largest remainders.
-