using System.Collections.Generic; using LCU.API.Collections.CollectionsApiLib.Models; using LCU.API.Collections.RepoApi.Exceptions; using LCU.Shared.Collections.RepoApiLib.Models; using LCU.Shared.Collections.RepoApiLib.Models.Consumer; using LCU.Shared.Collections.RepoApiLib.Models.Producer; using LCU.Shared.Collections.RepoApiLib.Models.Settings; namespace LCU.API.Collections.RepoApi.Domain.Processing { /** * This class represents everything you need to do a logical update or creation of a RepoAccount */ public class RepoAccountProcessingSlip { public ProcessingItem RequestedBy { get; set; } public string AccountNo { get; set; } public int CaseId { get; set; } public TemenosAccount RecoveryAccount { get; set; } public TemenosCase RecoveryCase { get; set; } public RepoAccount ExistingRepoAccount { get; set; } public RepoAccount UpdatedRepoAccount { get; set; } public Settings CurrentSettings { get; set; } public IReadOnlyCollection TransactionHistory { get; set; } public MemberDetail Member { get; set; } public LoanDetail Loan { get; set; } public IReadOnlyCollection AuctionAssignments { get; set; } public IReadOnlyCollection Letters { get; set; } public void AssertReadyForPreChecks() { if (RequestedBy == null) { throw new MissingRequirementException("Processing Item", $"RepoAccount Processing Slip requires a processing item."); } if (RecoveryAccount == null) { throw new MissingRequirementException("Recovery Account", $"{RequestedBy.AccountNo} did not have account."); } if (CurrentSettings == null) { throw new MissingRequirementException("Settings", $"RepoAccount Processing Slip requires settings."); } } public void AssertReadyForFullProcessing() { AssertReadyForPreChecks(); if (RecoveryCase == null) { throw new MissingRequirementException("Recovery Case", $"{RecoveryAccount.AccountId} did not have case {CaseId}."); } if (Loan == null) { throw new MissingRequirementException("Loan", "Loan required to process."); } if (Letters == null) { throw new MissingRequirementException("Letters", "Letters required to process."); } } public void AssertReadyForAlertChecks() { AssertReadyForFullProcessing(); if (TransactionHistory == null && ExistingRepoAccount.ReferenceStatus != "Chargeoff") { throw new MissingRequirementException("Transactions", "Transactions required to process alerts."); } if (Member == null) { throw new MissingRequirementException("Member", "Member required to process alerts."); } if (AuctionAssignments == null) { throw new MissingRequirementException("Auction Assignments", "Auction Assignments required to process alerts."); } } } }