64 lines
2.3 KiB
C#
64 lines
2.3 KiB
C#
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 DocumentNotFoundChecker : IAlertChecker
|
|
{
|
|
private readonly string _document;
|
|
private readonly string _ilActionCode;
|
|
private readonly string _status;
|
|
private readonly string _wiActionCode;
|
|
private const string StateWisconsin = "WI";
|
|
private const string StateIllinois = "IL";
|
|
|
|
public DocumentNotFoundChecker(string document, string wiActionCode, string ilActionCode = null,
|
|
string status = null)
|
|
{
|
|
_document = document;
|
|
_wiActionCode = wiActionCode.Trim().ToUpper();
|
|
_ilActionCode = ilActionCode?.Trim().ToUpper();
|
|
_status = status?.Trim().ToUpper();
|
|
}
|
|
|
|
public List<EventAlert> CheckForAlert(RepoAccountProcessingSlip slip)
|
|
{
|
|
if (slip.Letters == null || slip.Member?.Address == null ||
|
|
(_status != null && slip.UpdatedRepoAccount.Status != _status ||
|
|
slip.UpdatedRepoAccount.Bankruptcy != null))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var isLetterMissing = false;
|
|
if (slip.Member.Address.State == StateWisconsin)
|
|
{
|
|
isLetterMissing = slip.Letters.ToList().Find(x => x.ActionCode == _wiActionCode) == null;
|
|
}
|
|
else if (_ilActionCode != null && slip.Member.Address.State == StateIllinois)
|
|
{
|
|
isLetterMissing = slip.Letters.ToList().Find(x => x.ActionCode == _ilActionCode) == null;
|
|
}
|
|
|
|
if (isLetterMissing)
|
|
{
|
|
return new List<EventAlert>
|
|
{
|
|
new EventAlert()
|
|
{
|
|
RepoId = slip.UpdatedRepoAccount.RepoId,
|
|
AccountNo = slip.UpdatedRepoAccount.AccountNo,
|
|
Message = _document + " Not Found",
|
|
CreatedBy = "Batch",
|
|
DateAdded = DateTime.Now
|
|
}
|
|
};
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |