Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Impossible obsolete suggestion in EntryPromotionProcessorBase in Commerce 12?

$
0
0

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 


Viewing all articles
Browse latest Browse all 9076

Trending Articles