@Override
public void applyAllOrderOffers(List<PromotableCandidateOrderOffer> orderOffers, PromotableOrder promotableOrder) {
// If order offer is not combinable, first verify order adjustment is zero, if zero, compare item discount total vs this offer's total
Iterator<PromotableCandidateOrderOffer> orderOfferIterator = orderOffers.iterator();
while (orderOfferIterator.hasNext()) {
PromotableCandidateOrderOffer orderOffer = orderOfferIterator.next();
if (promotableOrder.canApplyOrderOffer(orderOffer)) {
applyOrderOffer(promotableOrder, orderOffer);
if (orderOffer.isTotalitarian() || promotableOrder.isTotalitarianItemOfferApplied()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Totalitarian Order Offer Applied. Comparing order and item offers for best outcome.");
}
compareAndAdjustOrderAndItemOffers(promotableOrder);
// We continue because this could be the first offer and marked as totalitarian, but not as good as an
// item offer. There could be other order offers that are not totalitarian that also qualify.
continue;
}
if (!orderOffer.isCombinable()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Non-Combinable Order Offer Applied with id=[" + orderOffer.getOffer().getId() +"]. No other order offers can be applied");
}
break;
}
}