public CreditCardApplicationDecision Evaluate(CreditCardApplication application)
        {
            if (_fraudLookup != null && _fraudLookup.IsFraudRisk(application))
            {
                return(CreditCardApplicationDecision.ReferredToHumanFraudRisk);
            }

            if (application.GrossAnnualIncome >= HighIncomeThreshold)
            {
                return(CreditCardApplicationDecision.AutoAccepted);
            }

            if (_validator.ServiceInformation.License.LicenseKey == "EXPIRED")
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }

            _validator.ValidationMode = application.Age >= 30 ? ValidationMode.Detailed : ValidationMode.Quick;

            bool isFrequentFlyerNumber;

            try
            {
                isFrequentFlyerNumber = _validator.IsValid(application.FrequentFlyerNumber);
            }
            catch (Exception)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }


            if (!isFrequentFlyerNumber)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }

            if (application.Age <= AutoReferralMaxAge)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }
            if (application.GrossAnnualIncome < LowIncomeThreshold)
            {
                return(CreditCardApplicationDecision.AutoDeclined);
            }

            return(CreditCardApplicationDecision.ReferredToHuman);
        }
Exemplo n.º 2
0
        public CreditCardApplicationDecision Evaluate(CreditCardApplication application)
        {
            //Todo: 08 - Valido la edad
            _validator.ValidationMode = application.Age >= 30 ? ValidationMode.Detailed :
                                        ValidationMode.Quick;
            if (application.GrossAnnualIncome >= HighIncomeThreshhold)
            {
                return(CreditCardApplicationDecision.AutoAccepted);
            }



            var isValidFrequentFlyerNumber =
                _validator.IsValid(application.FrequentFlyerNumber);

            if (!isValidFrequentFlyerNumber)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }

            //TODO:03 - Agrego un validador por la LicenseKey
            //if (_validator.LicenseKey == "EXPIRED")
            //{
            //    return CreditCardApplicationDecision.ReferredToHuman;
            //}

            //TODO: 05 - Utilizo la nueva propiedad

            if (_validator.ServiceInformation.License.LicenseKey == "EXPIRED")
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }


            if (application.Age <= AutoReferralMaxAge)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }

            if (application.GrossAnnualIncome < LowIncomeThreshhold)
            {
                return(CreditCardApplicationDecision.AutoDeclined);
            }

            return(CreditCardApplicationDecision.ReferredToHuman);
        }
Exemplo n.º 3
0
        public CreditCardApplicationDecision Evaluate(CreditCardApplication application)
        {
            if (application.GrossAnnualIncome >= HighIncomeThreshold)
            {
                return(CreditCardApplicationDecision.AutoAccepted);
            }

            var isValidFrequentFlyerNumber = _validator.IsValid(application.FrequentFlyerNumber);

            if (!isValidFrequentFlyerNumber)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }
            if (application.Age <= AutoReferralMaxAge)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }
            if (application.GrossAnnualIncome < LowIncomeThreshold)
            {
                return(CreditCardApplicationDecision.AutoDeclined);
            }
            return(CreditCardApplicationDecision.ReferredToHuman);
        }
        public CreditCardApplicationDecision Evaluate(CreditCardApplication application)
        {
            _validator.ValidationMode = application.Age >= 30 ? ValidationMode.Detailed :
                                        ValidationMode.Quick;

            if (application.GrossAnnualIncome >= HighIncomeThreshhold)
            {
                return(CreditCardApplicationDecision.AutoAccepted);
            }
            if (_validator.ServiceInformation.License.LicenseKey == "EXPIRED")
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }


            var isValidFrequentFlyerNumber =
                _validator.IsValid(application.FrequentFlyerNumber);

            if (!isValidFrequentFlyerNumber)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }



            if (application.Age <= AutoReferralMaxAge)
            {
                return(CreditCardApplicationDecision.ReferredToHuman);
            }

            if (application.GrossAnnualIncome < LowIncomeThreshhold)
            {
                return(CreditCardApplicationDecision.AutoDeclined);
            }

            return(CreditCardApplicationDecision.ReferredToHuman);
        }