using System; using System.Collections.Generic; using System.Linq; using LCU.API.Collections.CollectionsApiLib.Models; using LCU.API.Collections.RepoApi.Services; using LCU.Shared.Collections.RepoApiLib.Models; using Serilog; namespace LCU.API.Collections.RepoApi.Domain { public class RedemptionExpiredDateCalculator : IRedemptionExpiredDateCalculator { public DateTime? CalculateAsync(TemenosCase temenosCase, IReadOnlyCollection letters) { try { // !!!!! 04/15/2021, Bill and Kyle don't want to check for letters, they just want to use the date. // var redemptionLettersWi = letters.Where(x => x.ActionCode == "LTR35" || x.ActionCode == "LTR34" ).ToList(); // var redemptionLettersIl = letters.Where(x => x.ActionCode == "703" || x.ActionCode == "701").ToList(); // if (redemptionLettersIl.Any() && redemptionLettersWi.Any()) // { // return null; // } if (temenosCase.RedemptionExpiredDateWi != null) { // redemptionLettersWi.Any())} return temenosCase.RedemptionExpiredDateWi; } if( temenosCase.RedemptionExpiredDateIl != null) { // redemptionLettersIl.Any())} return temenosCase.RedemptionExpiredDateIl; } } catch (Exception ex) { Log.Error(ex, $"Failed To Get Redemption Exp. Date. TemenosCaseID: {temenosCase.CaseId}", temenosCase); } return null; } } }