I am trying to have custom logic determining which price the promotion engine will use when calculating the discount for a promotion. The site has both anonymous B2C users and logged in B2B users.
I have followed Erik Norbergs suggestion of implementing my own IPriceService. I am able to hit my service when calling GetPrices(MarketId market, DateTime validOn, IEnumerable<CatalogKey> catalogKeys, PriceFilter filter) elsewhere in my solution, so my custom service is registered correctly and intercepted as expected.
However, during _promotionEngine.Run I never hit my custom implementation of GetDefaultPrice which I was under the impression would be the price used by the promotion engine.
Currently we have a huge cluttered piece of logic using inmemoryordergroups which I would like to move away from if possible. These are the requirements that I am trying to implement.
If a promotion does not have coupon code: The discount should be calculated from the list price. (AllCustomer price) I assume this is the standard functionality.
If a promotion has coupon code: The discount should be calculated from the customer specific price.
I want to keep the rest of the promotion engine logic like redemptions, exclusions etc.
Out of the box functionality which works just fine.
Any input is welcome.
I think you may need to create a custom implemementation for the ILineItemcalcultor, in your case propably the GetDiscountedPrice method. If I remember correctly the promotionengine uses the calculators and not the priceservice directly