I was trying to follow this topic and develop a REST service that would build an order and get back the offers that should apply to that order along with the price after offers are applied.
viewtopic.php?f=12&t=479&p=1443&hilit=buildOfferListForOrder#p1443
So I am able to invoke the two methods mentioned (buildOfferListForOrder and applyOffersToOrder) after constructing a dummy Customer, Order, and DiscreteOrderItem. The REST service takes in a productId which is used to lookup the item to add to the order. The product is retrieved using the "blCatalogService". When I loop through the offers that were applied there aren't any. However I believe one offer should be applied. The offer is applied to any target item where the "Item Name" starts with "Magazine". The name on the SKU is "Magazine". The offer has no other restrictions.
Here is the shortened version of what my code does.
List<Offer> offers = offerService.buildOfferListForOrder(order);
offerService.applyOffersToOrder(offers, order);
List<DiscreteOrderItem> orderItems = order.getDiscreteOrderItems();
for(DiscreteOrderItem oi : orderItems)
{
for (CandidateItemOffer o : oi.getCandidateItemOffers())
{
wrapperList.add(o.getOffer());
}
}
Is there a way to "debug" this to see what might be going wrong? And which method (either on the order, discrete order item is the discounted price found?
This forum is in readonly mode and serves as an archive of old information. All posting, registration and commenting abilities have been turned off. To get help, the Broadleaf team reguarly monitors the broadleaf-commerce tag on Stack Overflow so please ask your questions there.