Beispiel #1
0
        }         // GatherAvailableFunds

        /// <summary>
        /// Collects customer data from DB. Can be overridden to provide
        /// specific customer data instead of the current one.
        /// </summary>
        protected virtual void GatherData()
        {
            this.caisAccounts.Clear();

            Cfg.Load();

            DB.ForEachRowSafe(
                ProcessRow,
                "LoadAutoApprovalData",
                CommandSpecies.StoredProcedure,
                new QueryParameter("CustomerID", Args.CustomerID),
                new QueryParameter("Now", Now)
                );

            MetaData.NumOfDefaultAccounts = ExperianConsumerDataExt.FindNumOfPersonalDefaults(
                this.caisAccounts,
                Cfg.Reject_Defaults_Amount,
                Now.AddMonths(-1 * Cfg.Reject_Defaults_MonthsNum)
                );

            OriginationTime.FromExperian(MetaData.IncorporationDate);

            GatherAvailableFunds();

            Trail.MyInputData.FullInit(
                Now,
                Cfg,
                Args,
                MetaData,
                Payments,
                OriginationTime,
                Turnover,
                Funds,
                DirectorNames,
                HmrcBusinessNames
                );

            MetaData.Validate();
        }         // GatherData
Beispiel #2
0
        }         // 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