private ABackdoorSimpleDetails CreateBackdoor() { if (!this.backdoorEnabled) { Log.Debug( "Not using back door simple flow for {0}: " + "disabled by configuration (BackdoorSimpleAutoDecisionEnabled).", OuterContextDescription ); return(null); } // if if (this.cashRequestOriginator != CashRequestOriginator.FinishedWizard) { Log.Debug( "Not using back door simple flow for {0}: cash request originator is '{1}'.", OuterContextDescription, this.cashRequestOriginator ); return(null); } // if if (!this.customerIsTest) { Log.Debug( "Not using back door simple flow for customer {0}: not a test customer.", OuterContextDescription ); return(null); } // if return(ABackdoorSimpleDetails.Create( this.customerID, this.customerEmail, this.customerOwnsProperty, this.requestedLoan.RequestedAmount, this.homeOwnerCap, this.notHomeOwnerCap, this.delay )); } // CreateBackdoor
} // 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