Vulnerability in EPiServer.Forms
How Can I retrieve the following Information about coupons/vouchers?
Coupons have been redeemed.
Order Number where the coupon was redeemed.
I am on Latest Commerce Version.
The coupon code does exist for the save PO in OrderFormEx.
SELECT * FROM OrderFormEx where Epi_CouponCodes IS NOT NULL
So we can retrieve the PO + Coupon Codes with this way:
var pos = _orderRepository.Load<IPurchaseOrder>(CustomerContext.Current.CurrentContactId);
var couponsWithOrders = new Dictionary<string, string>();
foreach (var po in pos)
List<string> couponList = new List<string>();
foreach (var form in po.Forms)
couponsWithOrders.Add(po.OrderNumber, string.Join(",", couponList.Select(x=>x)?.ToList()));
I am quite sure this is one of the recipe in my second book that you purchased :)
It was the very custom thing I guess, IContentLoader, IPromotionService and PromotionInformationRepository helped, but I had to record Coupon Usages my self