cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Custom promotion undo action not triggering Hybris v1808

Former Member
0 Kudos
835

Hi,

I'm currently working on a project (v1808) that requires a custom promotion Action. This action, once fired will modify the cart with a certain value. The problem we are facing is that the undo method is not being called when the promotion condition has been removed. The apply is being set, so we know the promotion action has been setup correctly, but undo never gets called.

I've set this up two ways, one with a coupon code, and one with an order total. Neither removing the coupon code, or setting the order total below the threshold, trigger the undo method.

Is there a step missing? I followed the trail in: https://help.hybris.com/1808/hcd/235755743eaf4da2aec5ac1352f93674.html#loio235755743eaf4da2aec5ac135...

     @Override
     public List<? extends ItemModel> apply(final AbstractRuleActionRAO action)
     {
 
 ...
     order.setInStockFreeShippingThreshold(orderThresholdAction.getThreshold());
 
         getModelService().saveAll(promoResult, order);
         getModelService().refresh(order);
 
         return Collections.singletonList(promoResult);
     }
 
     @Override
     public void undo(final ItemModel item)
     {
         LOG.error("test!");
         if (item instanceof RuleBasedOrderThresholdActionModel)
         {
             final RuleBasedOrderThresholdActionModel action = (RuleBasedOrderThresholdActionModel) item;
             undoInternal(action);
         }
     }
 
     @Override
     protected AbstractOrderModel undoInternal(final RuleBasedOrderThresholdActionModel action)
     {
         final AbstractOrderModel order = super.undoInternal(action);
 
         order.setInStockFreeShippingThreshold(null);
 
         getModelService().save(order);
         getModelService().refresh(order);
 
         return order;
     }

Accepted Solutions (0)

Answers (0)