Class OrderOfferRoundingProperties
- Author:
- Sunny Yu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleaninthashCode()booleanWhether to round the offer discounts at the item unit level instead of the order level for order typed offers.voidsetRoundDiscountsByItemUnit(boolean roundDiscountsByItemUnit) Whether to round the offer discounts at the item unit level instead of the order level for order typed offers.toString()Methods inherited from class com.broadleafcommerce.promotion.offer.service.autoconfigure.properties.OfferRoundingProperties
getRoundingMode, isRoundOfferValues, setRoundingMode, setRoundOfferValues
-
Constructor Details
-
OrderOfferRoundingProperties
public OrderOfferRoundingProperties()
-
-
Method Details
-
isRoundDiscountsByItemUnit
public boolean isRoundDiscountsByItemUnit()Whether to round the offer discounts at the item unit level instead of the order level for order typed offers.For example, if we have an order with an item that is $99.99 and has a quantity of 3 with applied offer of 20% off order, then the 20% off discount would be rounded at the item unit level. That is, $99.99 x 20% = $19.998, after rounding it would be $20 discount per item unit, then $20 x quantity of 3, then the order's total discount would be $60.
Whereas if rounding is done at the order level, it'd be $99.99 x 3 x 20% = $59.994, and after rounding the order's total discount would be $59.99.
Note that the rounding mode used in this example is
RoundingMode.HALF_EVEN, other rounding mode would have different values. -
setRoundDiscountsByItemUnit
public void setRoundDiscountsByItemUnit(boolean roundDiscountsByItemUnit) Whether to round the offer discounts at the item unit level instead of the order level for order typed offers.For example, if we have an order with an item that is $99.99 and has a quantity of 3 with applied offer of 20% off order, then the 20% off discount would be rounded at the item unit level. That is, $99.99 x 20% = $19.998, after rounding it would be $20 discount per item unit, then $20 x quantity of 3, then the order's total discount would be $60.
Whereas if rounding is done at the order level, it'd be $99.99 x 3 x 20% = $59.994, and after rounding the order's total discount would be $59.99.
Note that the rounding mode used in this example is
RoundingMode.HALF_EVEN, other rounding mode would have different values. -
toString
- Overrides:
toStringin classOfferRoundingProperties
-
equals
- Overrides:
equalsin classOfferRoundingProperties
-
canEqual
- Overrides:
canEqualin classOfferRoundingProperties
-
hashCode
public int hashCode()- Overrides:
hashCodein classOfferRoundingProperties
-