Esempio n. 1
0
        public static void Print(PaymentOverview overview)
        {
            Output.WriteLine($"Loan amount: {overview.LoanAmount} kr.");
            Output.WriteLine($"Loan duration: {overview.LoanDuration} months");
            Output.WriteLine($"Monthly payment: {Math.Round(overview.Installment, 2)} kr.");
            Output.WriteLine($"Total paid amount (without administrative fee): {Math.Round(overview.TotalPaidAmount, 2)} kr.");
            Output.WriteLine($"Total paid interest: {Math.Round(overview.TotalPaidInterest, 2)} kr.");

            Output.WriteLine($"Administrative fee (one time): {Math.Round(overview.AdministrationFee, 2)} kr.");
        }
Esempio n. 2
0
        public PaymentOverviewModel Convert(PaymentOverview entity) =>
        entity != null
                ? new PaymentOverviewModel
        {
            ActualAnnualInterestRate = entity.ActualAnnualInterestRate,
            MonthlyCost    = entity.MonthlyCost,
            TotalAdminFees = entity.TotalAdminFees,
            TotalInterest  = entity.TotalInterest
        }

                : null;
Esempio n. 3
0
        public PaymentOverview CreateOverview(double amount, int duration, Term term)
        {
            var overview = new PaymentOverview(term)
            {
                LoanAmount   = amount,
                LoanDuration = duration
            };

            overview.Installment       = CalculateInstallment(overview.LoanAmount, overview.LoanDuration, term);
            overview.TotalPaidAmount   = CalculateTotalAmount(overview.Installment, overview.LoanDuration);
            overview.AdministrationFee = CalculateAdministrationFee(term, overview.LoanAmount);
            overview.TotalPaidInterest = CalculateTotalPaidInterest(overview.TotalPaidAmount, overview.LoanAmount);

            _historyRepository.Insert(overview);

            return(overview);
        }
Esempio n. 4
0
 public void Insert(PaymentOverview overview)
 {
     _data.Add(overview);
 }
Esempio n. 5
0
 private double CalculateAPR(PaymentOverview overview)
 {
     //todo how to calculate APR?
     return(0);
 }