Money priceToUse = getBasePrice();
if (priceToUse != null) {
if (offer.getDiscountType().equals(OfferDiscountType.AMOUNT_OFF)) {
discountedAmount = BroadleafCurrencyUtils.getMoney(offer.getValue(), promotableFulfillmentGroup.getFulfillmentGroup().getOrder().getCurrency());
} else if (offer.getDiscountType().equals(OfferDiscountType.FIX_PRICE)) {
discountedAmount = priceToUse.subtract(BroadleafCurrencyUtils.getMoney(offer.getValue(), promotableFulfillmentGroup.getFulfillmentGroup().getOrder().getCurrency()));
} else if (offer.getDiscountType().equals(OfferDiscountType.PERCENT_OFF)) {
discountedAmount = priceToUse.multiply(offer.getValue().divide(new BigDecimal("100")));
}
if (discountedAmount.greaterThan(priceToUse)) {
discountedAmount = priceToUse;