What I can figure out this far is that the method RetailSalesOrderCalculator uses methods in RetailPricingDataManager class for the pricing adjustments: findPriceAdjustments, getPriceAdjustmentsForItems and then it builds a container with method: buildRetailDiscountContainer.
I have added my 2 new fields everywhere discPct is referenced. I also modified RetailDiscountLineOffer.applydiscount() to include the calculations needed for the new discount methods I added.
****
if (discountOffer)
{
switch (this.DiscountMethod)
{
case RetailDiscountOfferLineDiscMethodBase::AmountOff: return decRound(_price - this.DiscAmount,2);
case RetailDiscountOfferLineDiscMethodBase::PercentOff: return decRound(_price - (_price * this.DiscPct /100),2);
// <Begin Custom - add the logic for the markup>
case RetailDiscountOfferLineDiscMethodBase::TMC_MarkupAmount: return decRound(_price + this.MarkupAmount,2);
case RetailDiscountOfferLineDiscMethodBase::TMC_MarkupPercentage: return decRound(_price + (_price * this.MarkupPerc /100),2);
// </End custom>
case RetailDiscountOfferLineDiscMethodBase::Price: return decRound(this.OfferPrice,2);
case RetailDiscountOfferLineDiscMethodBase::PriceInclTax: return decRound(this.OfferPriceInclTax,2);
}
}
****
I did do an incremental CIL compile.
I stepped through the code and the PriceAdjustment container does pick up the new discountMethod with its value.
Now here is where I am stuck.
It makes use of the RetailPricingEngineHelper. This seems to use a DLL: Microsoft.Dynamics.Commerce.Runtime.Services.PricingEngine.dll
How can I view the code that makes up this DLL to see if I need to change something in here?
I REALLY REALLY would prefer not to touch the DLL. Has anybody ever had to modify price adjustments and can tell me what I need to change for it to pick up RetailDiscountLineOffer.applydiscount() method?