Exemple #1
0
        }         // Outcome

        protected override StepResults Run()
        {
            BackdoorInvestorID = null;

            ABackdoorSimpleDetails backdoorSimpleDetails = CreateBackdoor();

            if (backdoorSimpleDetails == null)
            {
                Log.Debug(
                    "Not using back door simple for {0}: back door code from customer email '{1}' " +
                    "ain't no matches any existing back door regex.",
                    OuterContextDescription,
                    this.customerEmail
                    );

                return(StepResults.NotApplied);
            }             // if

            Log.Debug("Using back door simple for {0} as: {1}.", OuterContextDescription, backdoorSimpleDetails);

            backdoorSimpleDetails.SetAdditionalCustomerData(
                this.cashRequestID,
                this.nlCashRequestID,
                this.smallLoanScenarioLimit,
                this.aspireToMinSetupFee,
                this.typeOfBusiness,
                this.customerOriginID,
                this.requestedLoan,
                this.offerValidHours
                );

            if (!backdoorSimpleDetails.SetResult(AutoDecisionResponse))
            {
                return(StepResults.NotApplied);
            }

            Medal       = backdoorSimpleDetails.Medal;
            OfferResult = backdoorSimpleDetails.OfferResult;

            Medal.SaveToDb(this.cashRequestID, this.nlCashRequestID, this.tag, DB);

            OfferResult.SaveToDb(DB);

            BackdoorLogicApplied = true;

            if (backdoorSimpleDetails.Decision != DecisionActions.Approve)
            {
                return(StepResults.Applied);
            }

            BackdoorSimpleApprove bsa = backdoorSimpleDetails as BackdoorSimpleApprove;

            if (bsa == null)               // Should never happen because of the "if" condition.
            {
                BackdoorLogicApplied = false;
                return(StepResults.NotApplied);
            }             // if

            BackdoorInvestorID = bsa.InvestorID;

            Medal.MedalClassification  = bsa.MedalClassification;
            Medal.OfferedLoanAmount    = bsa.ApprovedAmount;
            Medal.TotalScoreNormalized = 1m;
            Medal.AnnualTurnover       = bsa.ApprovedAmount;

            var glcd = new GetLoanCommissionDefaults(this.cashRequestID, bsa.ApprovedAmount);

            glcd.Execute();

            if (!glcd.IsBrokerCustomer)
            {
                return(StepResults.Applied);
            }

            AutoDecisionResponse.BrokerSetupFeePercent = glcd.Result.BrokerCommission;
            AutoDecisionResponse.SetupFee = glcd.Result.ManualSetupFee;

            return(StepResults.Applied);
        }         // Run