Example #1
0
        public LoanResult Calculate(decimal annualInterestRate, decimal administrationFeeMin, Compound compound, decimal loanAmount, int LoanDuration)
        {
            var duration       = _calculateService.GetDuration(LoanDuration, compound);
            var discountFactor = _calculateService.GetDiscountFactor(annualInterestRate, duration, compound);
            var monthlyCost    = _calculateService.GetMonthlyCost(loanAmount, discountFactor);

            var totalAmountPaid           = _calculateService.GetTotalAmountPaid(monthlyCost, duration);
            var totalAmountPaidInInterest = _calculateService.GetTotalAmountPaidInInterest(totalAmountPaid, loanAmount);
            var totalAdministrativeFees   = _calculateService.GetTotalAdministrativeFees(loanAmount, annualInterestRate, administrationFeeMin);
            var aop = _calculateService.GetAOP(loanAmount, compound, monthlyCost);

            return(new LoanResult
            {
                MonthlyCost = monthlyCost,
                TotalAdministrativeFees = totalAdministrativeFees,
                TotalAmountPaid = totalAmountPaid,
                TotalAmountPaidInInterest = totalAmountPaidInInterest,
                AOP = aop
            });
        }