示例#1
0
 private bool IsDataVerified(CreditRequest creditRequest)
 {
     return(IsPersonalDataValid(creditRequest.Requester) &&
            AreNamesCorrect(creditRequest.Requester) &&
            IsEmployed(creditRequest.Requester) &&
            IsProperIncome(creditRequest.Requester));
 }
示例#2
0
        private bool IsRiskEstimatedOk(CreditRequest creditRequest)
        {
            switch (creditRequest.RiskOfInvestment)
            {
            case RiskLevel.Low:
            {
                return(creditRequest.Amount <= 500000 && creditRequest.Percentage >= 6.0 && creditRequest.TimeInMonths >= 12);
            }

            case RiskLevel.Normal:
            {
                return(creditRequest.Amount <= 250000 && creditRequest.Percentage >= 10.0 && creditRequest.TimeInMonths >= 24);
            }

            case RiskLevel.High:
            {
                return(creditRequest.Amount <= 100000 && creditRequest.Percentage >= 12.0 && creditRequest.TimeInMonths >= 24);
            }

            case RiskLevel.VeryHigh:
            {
                return(creditRequest.Amount <= 75000 && creditRequest.Percentage >= 15.0 && creditRequest.TimeInMonths >= 36);
            }

            default:
            {
                return(false);
            }
            }
        }
示例#3
0
 public void Process(CreditRequest creditRequest, ref string returnMessage)
 {
     if (IsDataVerified(creditRequest) && _nextStage != null)
     {
         _nextStage.Process(creditRequest, ref returnMessage);
     }
     else
     {
         returnMessage = "Verifier failed";
     }
 }
示例#4
0
 public void Process(CreditRequest creditRequest, ref string returnMessage)
 {
     if (IsAnalysisFine(creditRequest) && _nextStage != null)
     {
         _nextStage.Process(creditRequest, ref returnMessage);
     }
     else
     {
         returnMessage = "Analyzer failed";
     }
 }
示例#5
0
        public bool IsAnalysisFine(CreditRequest creditRequest)
        {
            int points = 0;

            points += GetPointsForEmployment(creditRequest.Requester.EmploymentType);
            points += GetPointsForIncome(creditRequest.Requester.MonthIncome);
            points += GetPointsForAge(creditRequest.Requester.Age);
            points += GetPointsForCreditHistory(creditRequest.Requester.CreditHistory);
            points += GetPointsForCreditStatus(creditRequest.Requester.HasAlreadyCredit);

            return(points > 8);
        }
示例#6
0
        public void Process(CreditRequest creditRequest, ref string returnMessage)
        {
            if (IsRiskEstimatedOk(creditRequest))
            {
                returnMessage = "Credit acquired";
            }
            else
            {
                returnMessage = "RiskEstimator failed";
            }

            if (_nextStage != null)
            {
                _nextStage.Process(creditRequest, ref returnMessage);
            }
        }