public Agent( AConnection oDB, ASafeLog oLog, int customerId, long?cashRequestID, long?nlCashRequestID, DateTime?dataAsOf = null ) { this.m_oDB = oDB; this.m_oLog = oLog.Safe(); this.CustomerId = customerId; this.Now = dataAsOf ?? DateTime.UtcNow; Trail = new ReapprovalTrail(customerId, cashRequestID, nlCashRequestID, this.m_oLog); Result = new ReApprovalResult(false, 0); } // constructor
} // GetInputData public void MakeDecision(ReApprovalInputData data) { this.m_oLog.Debug( "Secondary: checking if auto re-approval should take place for customer {0}...", this.CustomerId ); try { Trail.MyInputData.Init(this.Now, data); CheckInit(data); CheckIsFraud(); CheckIsLACRTooOld(); CheckWasRejected(); CheckHasLateLoans(); CheckHasLatePayment(); CheckHasAddedMp(); CheckHasOutstandingLoans(); CheckHasLoanCharges(); SetApprovedAmount((int)data.ReApproveAmount); CheckAvailableFunds(); if (this.m_nApprovedAmount >= Trail.MyInputData.MinLoan) { StepDone <Complete>().Init(this.m_nApprovedAmount, Trail.MyInputData.MinLoan, units: "£"); } else { StepFailed <Complete>().Init(this.m_nApprovedAmount, Trail.MyInputData.MinLoan, units: "£"); } } catch (Exception e) { this.m_oLog.Error(e, "Exception during auto approval."); StepFailed <ExceptionThrown>().Init(e); } // try if (Trail.HasDecided) { Result = new ReApprovalResult(true, this.m_nApprovedAmount); } this.m_oLog.Debug( "Secondary: checking if auto re-approval should take place for customer {0} complete; {1}\n{2}", this.CustomerId, Trail, Result == null ? string.Empty : Result + "." ); } // MakeDecision