public void Init(DateTime dataAsOf, ReApprovalInputData data)
        {
            DataAsOf = dataAsOf;

            if (data == null)
            {
                return;
            }

            FraudStatus                           = data.FraudStatus;
            ManualApproveDate                     = data.ManualApproveDate;
            WasLate                               = data.WasLate;
            WasRejected                           = data.WasRejected;
            MaxLateDays                           = data.MaxLateDays;
            NewDataSourceAdded                    = data.NewDataSourceAdded;
            NumOutstandingLoans                   = data.NumOutstandingLoans;
            HasLoanCharges                        = data.HasLoanCharges;
            ReApproveAmount                       = data.ReApproveAmount;
            AvaliableFunds                        = data.AvaliableFunds;
            AutoReApproveMaxLacrAge               = data.AutoReApproveMaxLacrAge;
            AutoReApproveMaxLatePayment           = data.AutoReApproveMaxLatePayment;
            AutoReApproveMaxNumOfOutstandingLoans = data.AutoReApproveMaxNumOfOutstandingLoans;
            MinLoan                               = data.MinLoan;
            LacrID = data.LacrID;
        }         // Init
Beispiel #2
0
        }         // constructor

        public ReApprovalInputData GetInputData()
        {
            DbHelper dbHelper = new DbHelper(this.m_oDB, this.m_oLog);
            AutoReApprovalInputDataModelDb dbData = dbHelper.GetAutoReApprovalInputData(this.CustomerId);
            AvailableFunds availableFunds         = dbHelper.GetAvailableFunds();

            var model = new ReApprovalInputData {
                AutoReApproveMaxLacrAge               = dbData.AutoReApproveMaxLacrAge,
                AutoReApproveMaxLatePayment           = dbData.AutoReApproveMaxLatePayment,
                AutoReApproveMaxNumOfOutstandingLoans = dbData.AutoReApproveMaxNumOfOutstandingLoans,
                AvaliableFunds      = availableFunds.Available - availableFunds.Reserved,
                HasLoanCharges      = dbData.HasLoanCharges,
                FraudStatus         = (FraudStatus)dbData.FraudStatus,
                ManualApproveDate   = dbData.ManualApproveDate,
                MaxLateDays         = dbData.MaxLateDays,
                NewDataSourceAdded  = dbData.NewDataSourceAdded,
                NumOutstandingLoans = dbData.NumOutstandingLoans,
                ReApproveAmount     = dbData.ApprovedAmount - dbData.TookLoanAmount + dbData.RepaidPrincipal,
                WasLate             = dbData.WasLate,
                WasRejected         = dbData.WasRejected,
                MinLoan             = dbData.MinLoan,
                LacrID = dbData.LacrID,
            };

            this.m_oLog.Debug(
                "AutoReApprovalInputDataModelDb: {0}, {1}, {2}, {3}",
                dbData.ApprovedAmount,
                dbData.TookLoanAmount,
                dbData.RepaidPrincipal,
                dbData.SetupFee
                );
            this.m_oLog.Debug("ReApprovalInputData = {0}", model.Serialize());

            return(model);
        }         // GetInputData
Beispiel #3
0
        }         // 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
Beispiel #4
0
        }         // SetApprovedAmount

        private void CheckInit(ReApprovalInputData oData)
        {
            var oErrors = new List <string>();

            if (!oData.ManualApproveDate.HasValue)
            {
                oErrors.Add("last approved cash request time not filled");
            }

            if (oErrors.Count == 0)
            {
                StepDone <InitialAssignment>().Init(oErrors);
            }
            else
            {
                StepFailed <InitialAssignment>().Init(oErrors);
            }
        }         // CheckInit