November Happy Hour will be moved to Thursday December 5th.

Impossible obsolete suggestion in EntryPromotionProcessorBase in Commerce 12?

Vote:
 

Hi,

I would probably report this as a bug, but I'm locked out of that system for whatever reason (will look into that later) and we might have missed something.

My colleage updated a project to Commerce 12.latest from 11 and this introduced the following warning

[Obsolete("This method is no longer used. Use the RedemptionLimits.GetRemainingRedemptions(PromotionData) instead. This method will remain at least until October 2019.")]
    EntryPromotionProcessorBase<TEntryPromotion>.GetMaxRedemptions(RedemptionLimitsData redemptions)

We got this warning because we have built a custom gift promotion that has a custom logic for getting redemptions.

However, I don't see how it is possible to do, I can't follow the suggestions from the Obsolete warning and I can't find any other way other than reflection or fetching things from the database again to achieve this: I want to know how many redemptions that I maximum can redeem in the promotion processor.

The RedemptionLimits is a data class, so I can't inject this to access the method "GetRemianingRedemptions". The method is not static either, because again it is a data class, with calculated data. I can't access the already calculated RedemptionLimits class, even though it exists on PromotionProcessorContext, because on PromotionProcessorContext it is internal.

I can't see anything else I can use instead, I can probably inject an IRedemptionLimitService to calculate and create a new RedemptionLimits object, but the promotion engine has already created one and put it on the context, but again that is internal. I don't want to do the same calculation and possibly database fetch twice.

Am I missing something or is this a bug? :D 

#200780
Jan 24, 2019 15:41
Vote:
 

Unless I misunderstood your question, then that method is not used anywhere in the framework. We can't just remove the method, so we have to obsolete it

#200785
Jan 24, 2019 18:03
Vote:
 

For future visistors: Joel and I discussed on other channel and I agree that the problem mentioned in the original post should be addressed. How and when is up to question, but we will look into it.

#200862
Jan 29, 2019 13:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.