Пример #1
0
        public override void MakeAndVerifyDecision()
        {
            AutomationCalculator.AutoDecision.AutoRejection.RejectionAgent oSecondary = null;
            try {
                RunPrimary();

                oSecondary = RunSecondary();

                if (Trail.HasApprovalChance == oSecondary.Trail.HasApprovalChance)
                {
                    Trail.Negative <SameApprovalChance>(false)
                    .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
                    oSecondary.Trail.Negative <SameApprovalChance>(false)
                    .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
                }
                else
                {
                    Trail.Affirmative <SameApprovalChance>(false)
                    .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
                    oSecondary.Trail.Affirmative <SameApprovalChance>(false)
                    .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
                }                 // if

                WasMismatch = !Trail.EqualsTo(oSecondary.Trail);
            } catch (Exception e) {
                Log.Error(e, "Exception during auto rejection.");
                StepNoReject <ExceptionThrown>().Init(e);
            }             // try

            Trail.Save(DB, oSecondary == null ? null : oSecondary.Trail);
        }         // MakeAndVerifyDecision
Пример #2
0
        }         // Init

        public override void MakeAndVerifyDecision()
        {
            try {
                RunPrimary();

                AutomationCalculator.AutoDecision.AutoReApproval.Agent oSecondary = RunSecondary();

                WasMismatch = !Trail.EqualsTo(oSecondary.Trail);

                Log.Debug("Auto re-approval matching result: {0}match.", WasMismatch ? "mis" : string.Empty);

                if (!WasMismatch && Trail.HasDecided)
                {
                    Log.Debug("Match and approved.");

                    if (ApprovedAmount == oSecondary.Result.ReApproveAmount)
                    {
                        Log.Debug("Auto re-approval: match and approved and same amount of {0}.", ApprovedAmount);

                        Trail.Affirmative <SameAmount>(false).Init(ApprovedAmount);
                        oSecondary.Trail.Affirmative <SameAmount>(false).Init(oSecondary.Result.ReApproveAmount);
                    }
                    else
                    {
                        Log.Debug(
                            "Auto re-approval: match and approved but different amounts: {0} primary vs {1} secondary.",
                            ApprovedAmount,
                            oSecondary.Result.ReApproveAmount
                            );

                        Trail.Negative <SameAmount>(false).Init(ApprovedAmount);
                        oSecondary.Trail.Negative <SameAmount>(false).Init(oSecondary.Result.ReApproveAmount);

                        WasMismatch = true;
                    }             // if
                }                 // if

                Output.ApprovedAmount = ApprovedAmount;

                Trail.Save(DB, oSecondary.Trail);
            } catch (Exception e) {
                Log.Error(e, "Exception during re-approval.");
                StepFailed <ExceptionThrown>().Init(e);
                Output.ApprovedAmount = 0;
            }     // try
        }         // MakeAndVerifyDecision
Пример #3
0
        }         // InternalFlow

        private void ComparePrimaryAndSecondary(AutomationCalculator.AutoDecision.AutoRejection.LGAgent oSecondary)
        {
            if (Trail.HasApprovalChance == oSecondary.Trail.HasApprovalChance)
            {
                Trail.Negative <SameApprovalChance>(false)
                .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
                oSecondary.Trail.Negative <SameApprovalChance>(false)
                .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
            }
            else
            {
                Trail.Affirmative <SameApprovalChance>(false)
                .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
                oSecondary.Trail.Affirmative <SameApprovalChance>(false)
                .Init(Trail.HasApprovalChance, oSecondary.Trail.HasApprovalChance);
            }             // if

            if (Output.FlowType == oSecondary.Output.FlowType)
            {
                Trail.Dunno <SameFlowChosen>().Init(Output.FlowType, oSecondary.Output.FlowType);
                oSecondary.Trail.Dunno <SameFlowChosen>().Init(Output.FlowType, oSecondary.Output.FlowType);
            }
            else
            {
                Trail.Negative <SameFlowChosen>(true).Init(Output.FlowType, oSecondary.Output.FlowType);
                oSecondary.Trail.Negative <SameFlowChosen>(true).Init(Output.FlowType, oSecondary.Output.FlowType);
            }             // if

            if (Output.GradeRangeID == oSecondary.Output.GradeRangeID)
            {
                Trail.Dunno <SameConfigurationChosen>().Init(Output.GradeRangeID, oSecondary.Output.GradeRangeID);
                oSecondary.Trail.Dunno <SameConfigurationChosen>()
                .Init(Output.GradeRangeID, oSecondary.Output.GradeRangeID);
            }
            else
            {
                Trail.Negative <SameConfigurationChosen>(true).Init(Output.GradeRangeID, oSecondary.Output.GradeRangeID);
                oSecondary.Trail.Negative <SameConfigurationChosen>(true)
                .Init(Output.GradeRangeID, oSecondary.Output.GradeRangeID);
            }     // if
        }         // ComparePrimaryAndSecondary
Пример #4
0
        }         // CaisStatuses

        protected virtual T StepDone <T>() where T : ATrace
        {
            return(Trail.Affirmative <T>(false));
        }         // StepFailed
Пример #5
0
        }         // StepFailed

        /// <summary>
        ///     If the step was the only step then overall decision would be 'approved'.
        /// </summary>
        /// <typeparam name="T">Step type.</typeparam>
        /// <returns>Step type instance for filling step details.</returns>
        private T StepDone <T>() where T : ATrace
        {
            return(Trail.Affirmative <T>(false));
        }         // StepFailed
Пример #6
0
        }         // enum RowType

        private T StepReject <T>() where T : ATrace
        {
            return(Trail.Affirmative <T>(true));
        }         // StepReject
Пример #7
0
        }         // GatherData

        private void LogicalGlueFlow()
        {
            Output.FlowType = AutoDecisionFlowTypes.LogicalGlue;

            if ((Trail.MyInputData.RequestID == null) || (Trail.MyInputData.ResponseHttpStatus != (int)HttpStatusCode.OK))
            {
                Trail.Dunno <LGDataFound>().Init(false);
                Trail.Dunno <InternalFlow>().Init();
                InternalFlow();
                return;
            }
            else
            {
                Trail.Dunno <LGDataFound>().Init(true);
            }

            if (Trail.MyInputData.ResponseErrors.Count > 0)
            {
                Output.ErrorInLGData = true;
                Trail.Negative <LGWithoutError>(true).Init(false);
            }
            else
            {
                Output.ErrorInLGData = false;
                Trail.Dunno <LGWithoutError>().Init(true);
            }             // if

            if (Trail.MyInputData.HardReject)
            {
                Trail.Affirmative <LGHardReject>(true).Init(true);
            }
            else
            {
                Trail.Dunno <LGHardReject>().Init(false);
            }

            if (Trail.MyInputData.Bucket == null)
            {
                Trail.Negative <HasBucket>(true).Init(false);
            }
            else
            {
                Trail.Dunno <HasBucket>().Init(true);
            }

            if (Trail.MyInputData.MatchingGradeRanges.Count < 1)
            {
                Trail.Affirmative <OfferConfigurationFound>(true).Init(0);
            }
            else if (Trail.MyInputData.MatchingGradeRanges.Count > 1)
            {
                Trail.Negative <OfferConfigurationFound>(true).Init(Trail.MyInputData.MatchingGradeRanges.Count);

                Log.Alert(
                    "Too many grade range + product subtype pairs found for a {0} customer {1}, " +
                    "score {2}, origin {3}, company is {4}regulated, loan source {5}.",
                    Trail.MyInputData.LoanCount > 0 ? "returning" : "new",
                    this.args.CustomerID,
                    Trail.MyInputData.Score == null ? "'N/A'" : Trail.MyInputData.Score.ToString(),
                    Trail.MyInputData.CustomerOrigin == null ? "'N/A'" : Trail.MyInputData.CustomerOrigin.Value.ToString(),
                    Trail.MyInputData.CompanyIsRegulated ? string.Empty : "non-",
                    Trail.MyInputData.LoanSource == null ? "'N/A'" : Trail.MyInputData.LoanSource.Value.ToString()
                    );
            }
            else
            {
                Trail.Dunno <OfferConfigurationFound>().Init(1);

                MatchingGradeRanges.SubproductGradeRange spgr = Trail.MyInputData.MatchingGradeRanges[0];

                Output.GradeRangeID     = spgr.GradeRangeID;
                Output.ProductSubTypeID = spgr.ProductSubTypeID;
            }             // if

            Trail.DecideIfNotDecided();
        }         // LogicalGlueFlow