예제 #1
0
            public void Calculate(int customerID, bool isHomeOwner, AConnection db, ASafeLog log)
            {
                var instance = new CalculateMedal(customerID, DecisionTime, true, false);

                instance.Execute();

                log.Debug("Before capping the offer: {0}", instance.Result);

                int amount = Math.Min(
                    instance.Result.RoundOfferedAmount(),
                    isHomeOwner
                                                ? CurrentValues.Instance.MaxCapHomeOwner
                                                : CurrentValues.Instance.MaxCapNotHomeOwner
                    );

                var approveAgent = new AutomationCalculator.AutoDecision.AutoApproval.ManAgainstAMachine.SameDataAgent(
                    customerID,
                    amount,
                    (AutomationCalculator.Common.Medal)instance.Result.MedalClassification,
                    (AutomationCalculator.Common.MedalType)instance.Result.MedalType,
                    (AutomationCalculator.Common.TurnoverType?)instance.Result.TurnoverType,
                    DecisionTime,
                    db,
                    log
                    ).Init();

                approveAgent.MakeDecision();

                Amount   = amount;
                Decision = approveAgent.Trail.GetDecisionName();

                if (amount == 0)
                {
                    RepaymentPeriod = 0;
                    InterestRate    = 0;
                    SetupFee        = 0;
                }
                else
                {
                    var odc = new OfferDualCalculator(
                        customerID,
                        DecisionTime,
                        amount,
                        LoanCount > 0,
                        instance.Result.MedalClassification
                        );

                    odc.CalculateOffer();

                    RepaymentPeriod = odc.VerifyBoundaries.RepaymentPeriod;
                    InterestRate    = odc.VerifyBoundaries.InterestRate / 100.0m;
                    SetupFee        = odc.VerifyBoundaries.SetupFee / 100.0m;
                }         // if
            }             // Calculate
예제 #2
0
        }         // CreateTag

        private MedalResult CalculateMedal()
        {
            if (this.medalToUse != null)
            {
                Log.Debug("Using preset medal for customer '{0}'...", this.customerID);
                return(this.medalToUse);
            }             // if

            Log.Debug("Executing silent medal for customer '{0}'...", this.customerID);

            var instance = new CalculateMedal(this.customerID, this.cashRequestID, this.nlCashRequestID, DateTime.UtcNow, false, true)
            {
                Tag = Tag,
            };

            instance.Execute();

            return(instance.Result);
        }         // CalculateMedal
예제 #3
0
		public void TestMedal() {
			var x = new CalculateMedal(29486, null, null, DateTime.UtcNow, false, false);
			x.Execute();
		} // TestMedal