} // GetRejectionInputData /// <summary> /// Main logic flow function to determine weather to auto reject the customer or not /// </summary> /// <param name="data">rejection input data</param> public void MakeDecision(RejectionInputData data) { Trail.Init(data); this.log.Debug("Secondary: checking if auto reject should take place for customer {0}...", this.customerId); try { CheckRejectionExceptions(); Trail.LockDecision(); CheckRejections(); } catch (Exception e) { this.log.Error(e, "Exception during auto rejection."); StepNoDecision <ExceptionThrown>().Init(e); } // try Trail.HasApprovalChance = (!this.lowPersonalScore || !this.lowBusinessScore) && !this.unresolvedPersonalDefaults && !this.companyTooYoung; Trail.DecideIfNotDecided(); this.log.Debug( "Secondary: checking if auto reject should take place for customer {0} complete; {1}", this.customerId, Trail ); } // MakeDecision
} // constructor /// <summary> /// Retrieves customer's rejection input data /// </summary> /// <param name="dataAsOf">optional parameter to retrieve historical data for rejection</param> /// <returns></returns> public RejectionInputData GetRejectionInputData(DateTime?dataAsOf) { DateTime now = dataAsOf ?? DateTime.UtcNow; var model = new RejectionInputData(); AutoRejectionInputDataModelDb dbData = this.db.FillFirst <AutoRejectionInputDataModelDb>( "AV_GetRejectionData", CommandSpecies.StoredProcedure, new QueryParameter("@CustomerId", this.customerId) ); var originationTime = new OriginationTime(this.log); this.db.ForEachRowSafe( originationTime.Process, "LoadCustomerMarketplaceOriginationTimes", CommandSpecies.StoredProcedure, new QueryParameter("CustomerId", this.customerId) ); originationTime.FromExperian(dbData.IncorporationDate); double days = originationTime.Since.HasValue ? (now - originationTime.Since.Value).TotalDays : 0; CaisStatusesCalculation consumerCaisStatusesCalculation = new CaisStatusesCalculation(this.db, this.log); List <CaisStatus> consumerCais = consumerCaisStatusesCalculation.GetConsumerCaisStatuses(this.customerId); ConsumerLatesModel lates = consumerCaisStatusesCalculation.GetLates( this.customerId, now, this.configs.RejectionLastValidLate, this.configs.Reject_LateLastMonthsNum, consumerCais ); var consumerDefaults = consumerCaisStatusesCalculation.GetDefaults( this.customerId, now, this.configs.Reject_Defaults_Amount, this.configs.Reject_Defaults_MonthsNum, consumerCais ); var businessCais = this.dbHelper.GetBusinessCaisStatuses(this.customerId); var businessDefaults = consumerCaisStatusesCalculation.GetDefaults( this.customerId, now, this.configs.Reject_Defaults_CompanyAmount, this.configs.Reject_Defaults_CompanyMonthsNum, businessCais ); RejectionTurnover turnover = GetTurnoverForRejection(now); var data = new RejectionInputData { IsBrokerClient = dbData.IsBrokerClient, CustomerStatus = dbData.CustomerStatus, ConsumerScore = dbData.ExperianScore, BusinessScore = dbData.CompanyScore, WasApproved = dbData.WasApproved, NumOfDefaultConsumerAccounts = consumerDefaults.NumOfDefaults, NumOfDefaultBusinessAccounts = businessDefaults.NumOfDefaults, DefaultAmountInConsumerAccounts = consumerDefaults.DefaultsAmount, DefaultAmountInBusinessAccounts = businessDefaults.DefaultsAmount, HasMpError = dbData.HasErrorMp, HasCompanyFiles = dbData.HasCompanyFiles, BusinessSeniorityDays = (int)days, AnnualTurnover = turnover.Annual, QuarterTurnover = turnover.Quarter, NumOfLateConsumerAccounts = lates.NumOfLates, ConsumerLateDays = lates.LateDays, ConsumerDataTime = dbData.ConsumerDataTime, }; model.Init(now, data, this.configs); return(model); } // GetRejectionInputData
} // constructor public void Init(RejectionInputData data) { MyInputData.Init(data.DataAsOf, data, data); } // Init