public override UpdateCartLineResult Execute(IUnitOfWork unitOfWork, UpdateCartLineParameter parameter, UpdateCartLineResult result) { //update piricing for Volume group CustomerOrder cart = result.GetCartLineResult.GetCartResult.Cart; CartLineDto cartLineDto = parameter.CartLineDto; if (cartLineDto == null) { return(result); } OrderLine orderLine = unitOfWork.GetRepository <OrderLine>().Get(cartLineDto.OrderLineId); if (orderLine == null) { return(this.CreateErrorServiceResult <UpdateCartLineResult>(result, SubCode.NotFound, MessageProvider.Current.Cart_OrderLineNotFound)); } if (result.GetCartLineResult.BreakPrices.Count > 1) { string QtyBrkCls = unitOfWork.GetRepository <Product>().GetTable().FirstOrDefault(x => x.Id == orderLine.ProductId).PriceBasis; orderLine.ConfigurationViewModel = "true"; if (!string.IsNullOrEmpty(QtyBrkCls)) { CartHelper_Brasseler helper = new CartHelper_Brasseler(this.pricingPipeline); //update cartline with updated volume grp price & promotion result.GetCartLineResult.GetCartResult.Cart = helper.UpdateVolumeGrpPricing(cart, QtyBrkCls, unitOfWork); } } //Common promotion recalculate logic - BUSA-683 result.GetCartLineResult.GetCartResult.Cart.RecalculatePromotions = true; result.GetCartLineResult.GetCartResult.Cart.RecalculateTax = true; this.PromotionEngine.ApplyPromotions(result.GetCartLineResult.GetCartResult.Cart); return(this.NextHandler.Execute(unitOfWork, parameter, result)); }
public override AddCartLineResult Execute(IUnitOfWork unitOfWork, AddCartLineParameter parameter, AddCartLineResult result) { // Calculate Volume Group discount CustomerOrder cart = result.GetCartResult.Cart; OrderLine orderLine = result.GetCartLineResult.CartLine; if (orderLine == null) { return(this.CreateErrorServiceResult <AddCartLineResult>(result, SubCode.NotFound, MessageProvider.Current.Cart_OrderLineNotFound)); } // BUSA-636 : pricing 2018 Starts. Differentiate between legacy and volume group contract. if (result.GetCartLineResult.BreakPrices.Count > 1) { orderLine.ConfigurationViewModel = "true"; string QtyBrkCls = unitOfWork.GetRepository <Product>().GetTable().FirstOrDefault(x => x.Id == orderLine.ProductId).PriceBasis; if (!string.IsNullOrEmpty(QtyBrkCls)) { CartHelper_Brasseler helper = new CartHelper_Brasseler(this.pricingPipeline); result.GetCartResult.Cart = helper.UpdateVolumeGrpPricing(cart, QtyBrkCls, unitOfWork); // BUSA-683 : Volume Discount Promotion -Issue when user cart qualifies add free product promotion & volume discount group. this.PromotionEngine.ClearPromotions(result.GetCartResult.Cart); result.GetCartResult.Cart.RecalculatePromotions = true; this.PromotionEngine.ApplyPromotions(result.GetCartResult.Cart); unitOfWork.Save(); } } // BUSA-636 : pricing 2018 Ends. Differentiate between legacy and volume group contract. return(this.NextHandler.Execute(unitOfWork, parameter, result)); }
public override RemoveCartLineResult Execute(IUnitOfWork unitOfWork, RemoveCartLineParameter parameter, RemoveCartLineResult result) { string QtyBrkCls = unitOfWork.GetRepository <Product>().GetTable().FirstOrDefault(x => x.Id == result.ProductId).PriceBasis; CartHelper_Brasseler helper = new CartHelper_Brasseler(this.pricingPipeline); CustomerOrder cart = result.GetCartResult.Cart; //update cartline with updated volume grp price & promotion result.GetCartResult.Cart = helper.UpdateVolumeGrpPricing(cart, QtyBrkCls, unitOfWork); result.GetCartResult.Cart.RecalculatePromotions = true; this.PromotionEngine.ApplyPromotions(result.GetCartResult.Cart); return(this.NextHandler.Execute(unitOfWork, parameter, result)); }