I'm not sure I see the (API level) issue. Having the promotion engine split line items to separate line items that got a promotion applied seems risky!
I think it's rather a presentational angle to the issue. We know how many times the promotion applied (redemptioncount), so we could write somewhere that this promotion applied once but not more. I mean, ultimately it's up to you to display your prices. If you for example display the price as red as soon as it has any reduction, you might create this confusion, having the customer thinking they got X% on all the items.
One solution could also be showing the original price for the line item, then calculating the difference and showing it as a summary combined with which promotions were applied. Like so:
The behavior is indeed as designed, the discount is distributed to all "affected" lineitems, and that's consistent with the old promotion system. There are several reasons for that, I can't remember all of them now, except for the one Joel mentioned, it's very complicated and risky to split the lineitem for that purpose.
But remember for each RewardDescription you will have a list of RedemptionDescription which gives you information of how many times that promotion was applied, and on which code/what quantity. That should be enough for you to display if you want to.
I see both of your points. But since it is possible to add a discount only targeting one instance within the line item, it seems strange to mix them (since they no longer share the data, or more precisely the EntryAmount).
That being said, I'm a rookie when it comes to Episerver Commerce. So I might see things differently than if I had more knowledge.
All in all, I will look into the RedemptionDescription and the count and see if I can use this information. It might end up with changing the way we present the line items and discount price, as suggested by Joel.
Thank you very much for your inputs, both of you.
There seems to be an issue when calculating discount with IPromotionEngine.Run where the discount is only valid for one item and quantity is more than one. The way I see it, IPromotionEngine should have split the line item into one that gets the discount and quantity equal to one and one without discount and a quantity one less than the original. Instead the discount is made for the entire line item. The price is correct, but it looks like every instance in the line item got a discount equal to actual discount / quantity.
Has anybody found a good solution to this issue?