using System; using System.Collections.Generic; using System.Linq; using LCU.API.Collections.RepoApi.Domain.Processing; using LCU.Shared.Collections.RepoApiLib.Models; namespace LCU.API.Collections.RepoApi.Domain.AlertChecker { public class RedemptionEndedNoTitleOrderedChecker : IAlertChecker { private const string RepoStatus = "REPO"; private const int RedemptionExpiredDaysToWait = 7; public List CheckForAlert(RepoAccountProcessingSlip slip) { if (slip.UpdatedRepoAccount.Status.ToUpper() == RepoStatus && DateTime.Now.Date > slip.UpdatedRepoAccount.RedemptionExpiredDate?.AddDays(RedemptionExpiredDaysToWait) && slip.UpdatedRepoAccount.Collaterals.FirstOrDefault(x => x.RetitledInLandmarkName == null) != null) { return new List { new EventAlert() { RepoId = slip.UpdatedRepoAccount.RepoId, AccountNo = slip.UpdatedRepoAccount.AccountNo, Message = "Redemption Ended No Title Ordered", CreatedBy = "Batch", DateAdded = DateTime.Now } }; } return null; } } }