private bool AddNotes() { AddNoteToHouseholdManager addNoteToHouseholdManager = new AddNoteToHouseholdManager(); ProcessRedemptionOrReversalManager redeemMgr = new ProcessRedemptionOrReversalManager(); DynamicNote dynamicNote = new DynamicNote(); string subFunction = string.Empty; ProductDetails productData; //To get the Redeemed subcategory in the notes instead of the bonus subcategory #5446 fix productData = redeemMgr.GetProduct(Action.ProductId); if (Action.BonusType == "ReloadBonus") { //productData = redeemMgr.GetProductByBonus(Action.ProductId); This method is returning the Bonus product details subFunction = AppConstants.ManageHouseholdNoteCodes.ReloadBonus; } else { //productData = redeemMgr.GetProduct(Action.ProductId); subFunction = AppConstants.ManageHouseholdNoteCodes.LinkBonus; } dynamicNote.CardNumber = Action.LinkedCardNumber; dynamicNote.LoyaltyCardNumber = Action.LoyaltyCardNumber; dynamicNote.CardType = Action.CardType; PromotionBonusAward promotionBonusAward = new PromotionBonusAward(); if (HttpContext.Current.Session["PromotionBonusAward"] != null) { promotionBonusAward = (PromotionBonusAward)HttpContext.Current.Session["PromotionBonusAward"]; dynamicNote.TotalPoints = Convert.ToInt32(promotionBonusAward.EarnValue); } else { dynamicNote.TotalPoints = Convert.ToInt32(productData.UnitsPointsRedemptionCost); } dynamicNote.ProductSubCategory = productData?.ProductSubCategoryDescription; dynamicNote.ProductDescription = productData?.EnglishDescriptionBackOffice; var noteResult = addNoteToHouseholdManager.AddDynamicNoteToHousehold(StaticData.OPEFunction, subFunction, dynamicNote); DBLogging.Info(_logMsg, "1 to 1 Bonus - AddDynamicNoteToHousehold", "Function :" + StaticData.OPEFunction + "SubFunction : " + subFunction + _objIFormatXmlUtility.FormatXMLRequest(dynamicNote), noteResult); return(true); }
/// <summary> /// /// </summary> /// <returns></returns> public bool Run() { if (Action == null) { throw new ArgumentException("No loyalty action found"); } DBLogging.Info(_logMsg, "1 to 1 Bonus - Input", "LoyaltyCardNumber :" + Action.LoyaltyCardNumber + "LinkedCard : " + Action.LinkedCardNumber + "Product Id: " + Action.ProductId.ToString() + "BonusType : " + Action.BonusType + "CardType: " + Action.CardType, ""); bool qualify = Action.QualifyForBonus(); DBLogging.Info(_logMsg, "1 to 1 Bonus - QualifyForBonus", "LoyaltyCardNumber :" + Action.LoyaltyCardNumber + "LinkedCard : " + Action.LinkedCardNumber + "CardType: " + Action.CardType, qualify); bool result = false; if (qualify) { // call Retalix to trigger the bonus var redeemMgr = new ProcessRedemptionOrReversalManager(); string productId = Action.ProductId.ToString(); ServiceResponse <string> serviceResp = redeemMgr.Redeem(Action.LoyaltyCardNumber, productId, "1", null, Action.BonusType); DBLogging.Info(_logMsg, "1 to 1 Bonus - Redeem", "LoyaltyCardNumber :" + Action.LoyaltyCardNumber + "LinkedCard : " + Action.LinkedCardNumber + "Product Id: " + productId + "CardType: " + Action.CardType, serviceResp); // Add Note if (serviceResp.IsSuccess) { result = true; //Update BonusGivenDate bool updateBonusResult = Action.UpdateBonusGivenDate(); DBLogging.Info(_logMsg, "1 to 1 Bonus - UpdateBonusGivenDate", "LoyaltyCardNumber :" + Action.LoyaltyCardNumber + "LinkedCard : " + Action.LinkedCardNumber + "CardType: " + Action.CardType, updateBonusResult); var noteResult = AddNotes(); } } DBLogging.Info(_logMsg, "1 to 1 Bonus - Result", "LoyaltyCardNumber :" + Action.LoyaltyCardNumber + "LinkedCard : " + Action.LinkedCardNumber + "Product Id: " + Action.ProductId.ToString() + "BonusType : " + Action.BonusType + "CardType: " + Action.CardType, result); return(result); }