using System; using System.Collections.Generic; using LCU.API.Collections.RepoApi.Domain.Extensions; using LCU.API.Collections.RepoApi.Domain.Processing; using LCU.API.Collections.RepoApi.Extensions; using LCU.Shared.Collections.RepoApiLib.Models; namespace LCU.API.Collections.RepoApi.Domain.AlertChecker { public class SkipNotPaidChecker : IAlertChecker { private readonly int _dayCount; private readonly int _repeatDayCount; private const string O4RStatus = "O4R"; private const string RepoSubStatusPaidSkip = "PSKP"; public SkipNotPaidChecker(int dayCount = 30, int repeatDayCount = 0) { _dayCount = dayCount; _repeatDayCount = repeatDayCount; } public List CheckForAlert(RepoAccountProcessingSlip slip) { var days = slip.UpdatedRepoAccount.GetDaysInStatus(O4RStatus); if (slip.UpdatedRepoAccount.Status == O4RStatus && days >= _dayCount && slip.UpdatedRepoAccount.IsCurrentlySkipClaim()) { if (!string.IsNullOrWhiteSpace(slip.UpdatedRepoAccount.SubStatus) && slip.UpdatedRepoAccount.SubStatus.Trim().ToUpper() == RepoSubStatusPaidSkip) { return null; } if ((days == _dayCount) || days >= _dayCount && ((days - _dayCount) % _repeatDayCount == 0)) { return new List { new EventAlert() { RepoId = slip.UpdatedRepoAccount.RepoId, AccountNo = slip.UpdatedRepoAccount.AccountNo, Message = "Skip Not Paid", CreatedBy = "Batch", DateAdded = DateTime.Now } }; } } return null; } } }