public void Process(LoanApplication application) { if (application is null) { throw new ArgumentNullException(nameof(application)); } if (application.GetApplicantSalary() < MinimumSalary) { application.Decline(); return; } if (application.GetApplicantAge() < MinimumAge) { application.Decline(); return; } _identityVerifier.Initialize(); var isValidIdentity = _identityVerifier.Validate(application.GetApplicantName(), application.GetApplicantAge(), application.GetApplicantAddress()); if (!isValidIdentity) { application.Decline(); return; } try { _creditScorer.CalculateScore(application.GetApplicantName(), application.GetApplicantAddress()); } catch { application.Decline(); return; } _creditScorer.Count++; if (_creditScorer.ScoreResult.ScoreValue.Score < MinimumCreditScore) { application.Decline(); return; } application.Accept(); }
public void Process(LoanApplication application) { if (application.GetApplicantSalary() < MinimumSalary) { application.Decline(); return; } if (application.GetApplicantAge() < MinimumAge) { application.Decline(); return; } _identityVerifier.Initialize(); //var isValidIdentity = _identityVerifier.Validate(application.GetApplicantName(), // application.GetApplicantAge(), // application.GetApplicantAddress()); //_identityVerifier.Validate(application.GetApplicantName(), // application.GetApplicantAge(), // application.GetApplicantAddress(), // out var isValidIdentity); //if (!isValidIdentity) //{ // application.Decline(); // return; //} IdentityVerificationStatus status = null; _identityVerifier.Validate(application.GetApplicantName(), application.GetApplicantAge(), application.GetApplicantAddress(), ref status); if (!status.Passed) { application.Decline(); return; } //_creditScorer.CalculateScore(application.GetApplicantName(), // application.GetApplicantAddress()); //if (_creditScorer.Score < MinimumCreditScore) //{ // application.Decline(); // return; //} application.Accept(); }
public void Process(LoanApplication application) { if (application.GetApplicantSalary() < MinimumSalary) { application.Decline(); return; } if (application.GetApplicantAge() < MinimumAge) { application.Decline(); return; } _identityVerifier.Initialize(); var isValidIdentity = _identityVerifier.Validate(application.GetApplicantName(), application.GetApplicantAge(), application.GetApplicantAddress()); if (!isValidIdentity) { application.Decline(); return; } _creditScorer.CalculateScore(application.GetApplicantName(), application.GetApplicantAddress()); if (_creditScorer.ScoreResult.ScoreValue.Score < MinimumCreditScore) { application.Decline(); return; } application.Accept(); }
public void Process(LoanApplication application) { if (application.GetApplicantSalary() < MinimumSalary) { application.Decline(); return; } if (application.GetApplicantAge() < MinimumAge) { application.Decline(); return; } _identityVerifier.Initialize(); // 1. Overload with only applicant params var isValidIdentity = _identityVerifier.Validate(application.GetApplicantName(), application.GetApplicantAge(), application.GetApplicantAddress()); // 2. Overload with out param for identity validation //_identityVerifier.Validate(application.GetApplicantName(), // application.GetApplicantAge(), // application.GetApplicantAddress(), // out var isValidIdentity); if (!isValidIdentity) { application.Decline(); return; } // 3. Overload with ref param for identity validation //IdentityVerificationStatus status = null; //_identityVerifier.Validate(application.GetApplicantName(), // application.GetApplicantAge(), // application.GetApplicantAddress(), // ref status); //if (!status.Passed) //{ // application.Decline(); // return; //} _creditScorer.CalculateScore(application.GetApplicantName(), application.GetApplicantAddress()); _creditScorer.Count++; //if (_creditScorer.Score < MinimumCreditScore) if (_creditScorer.ScoreResult.ScoreValue.Score < MinimumCreditScore) { application.Decline(); return; } application.Accept(); }
public void Process(LoanApplication application) { if (application.GetApplicantSalary() < MinimumSalary) { application.Decline(); return; } if (application.GetApplicantAge() < MinimumAge) { application.Decline(); return; } _identityVerifier.Initialize(); var isValidIdentity = _identityVerifier.Validate(application.GetApplicantName(), application.GetApplicantAge(), application.GetApplicantAddress()); // With Out Type //_identityVerifier.Validate(application.GetApplicantName(), // application.GetApplicantAge(), // application.GetApplicantAddress(), // out var isValidIdentity); if (!isValidIdentity) { application.Decline(); return; } //With Ref Type //IdentityVerificationStatus status = null; //_identityVerifier.Validate(application.GetApplicantName(), // application.GetApplicantAge(), // application.GetApplicantAddress(), // ref status); //if (!status.Passed) //{ // application.Decline(); // return; //} try { _creditScorer.CalculateScore(application.GetApplicantName(), application.GetApplicantAddress()); } catch (Exception) { application.Decline(); return; } _creditScorer.Count++; //if (_creditScorer.Score < MinimumCreditScore) //{ // application.Decline(); // return; //} // Mocking hierarchies if (_creditScorer.ScoreResult.ScoreValue.Score < MinimumCreditScore) { application.Decline(); return; } application.Accept(); }