Ejemplo n.º 1
0
        public void ProcessPayment(Contract contract, IOnlinePaymentService paymentService)
        {
            double baseValue = contract.TotalValue / contract.Months;


            for (int i = 1; i <= contract.Months; i++)
            {
                DateTime dueDate = contract.Date.AddMonths(i);

                double intermediateValue = baseValue + paymentService.Interest(baseValue, i);

                double FinalValue = intermediateValue + paymentService.PaymentFee(intermediateValue);

                Installment install = new Installment(dueDate, FinalValue);

                contract.addInstallments(install);
            }

            Console.WriteLine("INSTALLMENTS: ");

            foreach (Installment item in contract.list)
            {
                Console.WriteLine(item.DueDate.ToString("dd/MM/yyyy") + " - " + item.Amount);
            }
        }
Ejemplo n.º 2
0
 public void ProcessContract(Contract contract, int months)
 {
     double basicQuota = contract.TotalValue / months;
     for (int i = 1; i <= months; i++)
     {
         DateTime date = contract.Date.AddMonths(i);
         double updatedQuota = basicQuota + _onlinePaymentService.Interest(basicQuota, i);
         double fullQuota = updatedQuota + _onlinePaymentService.PaymentFee(updatedQuota);
         contract.AddInstallment(new Installment(date, fullQuota));
     }
 }
Ejemplo n.º 3
0
        public void ProcessContract(Contract contract, int months)
        {
            double valueInstallmentNoTax = contract.TotalValue / months;

            for (int i = 1; i <= months; i++)
            {
                double   valueInstallmentWithTax = _onlinePaymentService.PaymentFee(_onlinePaymentService.Interest(valueInstallmentNoTax, i));
                DateTime installmentDate         = contract.Date.AddMonths(i);
                contract.Installments.Add(new Installment(installmentDate, valueInstallmentWithTax));
            }
        }
        public void ProcessContract(Contract contract, int months)
        {
            double amount = contract.TotalValue / months;

            for (int i = 1; i <= months; i++)
            {
                DateTime installmentDate   = contract.Date.AddMonths(i);
                double   installmentAmount = _onlinePaymentService.Interest(amount, i);
                contract.AddInstallment(new Installment(installmentDate, installmentAmount));
            }
        }
        public void ProcessContract(Contract contract, int months)
        {
            double amount = 0.0;

            for (int i = 1; i <= months; i++)
            {
                amount = contract.TotalValue / months;
                amount = _onlinePaymentService.Interest(amount, i);
                amount = _onlinePaymentService.PaymentFee(amount);
                contract.AddInstallment(new Installment(contract.Date.AddMonths(i), amount));
            }
        }
Ejemplo n.º 6
0
        public void ProcessContract(Contract contract, int months)
        {
            double basicQuota = contract.totalValue / months; // divide o valor total pelo numero de cotas

            for (int i = 1; i <= months; i++)
            {
                DateTime dt          = contract.date.AddMonths(i);                                 // esse valor é adicionado a cada data de pagamento de cota
                double   updateQuota = basicQuota + _onlinePaymentService.Interest(basicQuota, i); //
                double   fullQuota   = updateQuota + _onlinePaymentService.PaymentFee(updateQuota);
                contract.AddInstallments(new Installment(dt, fullQuota));
            }
        }
Ejemplo n.º 7
0
        public void ProcessContract(Contract contract, int months)
        {
            double quota = contract.TotalValue / months;

            for (int i = 1; i <= months; i++)
            {
                double interest     = quota + _paymentService.Interest(quota, i);
                double totalPayment = interest + _paymentService.PaymentFee(interest);

                contract.AddInstallment(new Installment(contract.Date.AddMonths(i), totalPayment));
            }
        }
Ejemplo n.º 8
0
        public void ProcessContract(Contract contract, int month)
        {
            double basicQuota = contract.ContractValue / month;

            for (int i = 1; i <= month; i++)
            {
                DateTime date        = contract.ContractDate.AddMonths(i);
                double   updateQuota = basicQuota + _iOnPaymService.Interest(basicQuota, i);
                double   fullQuota   = updateQuota + _iOnPaymService.PaymentFee(updateQuota);
                contract.AddInstallment(new Installments(date, fullQuota));
            }
        }
Ejemplo n.º 9
0
        public void ProcessContract(Contract contract, int moths)
        {
            double basicQuota = contract.ValorContrato / moths;

            for (int moth = 0; moth <= moths; moth++)
            {
                DateTime date        = contract.Date.AddMonths(moth);
                double   updateQuota = basicQuota + _onlinePaymentService.Interest(basicQuota, moth);
                double   fullQuota   = updateQuota + _onlinePaymentService.PaymentFee(basicQuota);
                contract.AddItem(new Installment(date, fullQuota));
            }
        }
Ejemplo n.º 10
0
        public void ProcessContract(Contract contrato, int meses)
        {
            float AliquotaBasica = contrato.TotalValue / meses;

            for (int i = 1; i <= meses; i++)
            {
                DateTime data = contrato.Date.AddMonths(i);
                float    AliquotaAtualizada = AliquotaBasica + _onlinePaymentService.Interest(AliquotaBasica, i);
                float    AliquotaTotal      = AliquotaAtualizada + _onlinePaymentService.PaymentFee(AliquotaAtualizada);
                contrato.AdicionaParcela(new Installment(data, AliquotaTotal));
            }
        }
Ejemplo n.º 11
0
        public static void ProcessContract(Contract contract, int monthes, IOnlinePaymentService service)
        {
            double monthValue = contract.ContractValue / monthes;

            for (int i = 0; i < monthes; i++)
            {
                DateTime _dueDate = contract.Date.AddMonths(i + 1);
                double   _amount  = monthValue + service.Interest(monthValue, i + 1);
                _amount += service.PaymentFee(monthValue);

                contract.installments.Add(new Installment(_dueDate, _amount));
            }
        }
Ejemplo n.º 12
0
        public void ProcessContract(Contract contract, int months)
        {
            double basicQuota = contract.TotalValue / months;

            for (int i = 1; i <= months; i++)
            {
                DateTime installmentDate  = contract.Date.AddMonths(i);
                double   interestValue    = _onlinePaymentService.Interest(basicQuota, i);
                double   feeValue         = _onlinePaymentService.PaymentFee(basicQuota);
                double   installmentValue = basicQuota + interestValue + feeValue;

                contract.AddInstallment(new Installment(installmentDate, installmentValue));
            }
        }
Ejemplo n.º 13
0
        public void ProcessContract(Contract contract, int month)
        {
            var parcelas = contract.TotalValor / month;

            for (int i = 1; i <= month; i++)
            {
                DateTime qtdPar = contract.Data.AddMonths(1);

                var atualizaValorSimples  = parcelas + _onlinePaymentService.PaymentFee(parcelas);
                var atualizaValorComposto = parcelas + _onlinePaymentService.Interest(atualizaValorSimples, i);

                contract.AddInstallment(new Installment(atualizaValorComposto, qtdPar));
            }
        }
Ejemplo n.º 14
0
        public void ProcessContract(Contract contract, int months)
        {
            double baseQuote = contract.TotalValue / months;

            for (int i = 1; i <= months; i++)
            {
                DateTime dueDate      = contract.Date.AddMonths(i);
                double   updatedQuote = baseQuote + _onlinePaymentService.Interest(baseQuote, i);
                double   totalQuote   = updatedQuote + _onlinePaymentService.PaymentFee(updatedQuote);

                Installment installment = new Installment(dueDate, totalQuote);
                contract.AddInstallment(installment);
            }
        }
        public void ProcessContract(Contract contract, int months)
        {
            double BasicQuota = contract.Total / months;
            double total      = 0;

            for (int i = 1; i <= months; i++)
            {
                DateTime date        = contract.Date.AddMonths(i);
                double   UpdateQuota = BasicQuota + _onlinePaymentService.Interest(BasicQuota, i);
                double   FullQuota   = UpdateQuota + _onlinePaymentService.PaymentFee(UpdateQuota);
                total += FullQuota;

                contract.Installments.Add(new Installment(date, FullQuota, total));
            }
        }
Ejemplo n.º 16
0
        public void ProcessContract(Contract contract, int month, IOnlinePaymentService onlinePaymentService)
        {
            double amountSimple = contract.TotalValue / month;

            for (int i = 1; i <= month; i++)
            {
                double updateAmount = onlinePaymentService.Interest(amountSimple, i);

                double amountTotal = onlinePaymentService.PaymentFee(updateAmount);

                DateTime date = contract.DateContract.Date.AddMonths(i);

                contract.AddItem(new Installments(date, amountTotal));
            }
        }
Ejemplo n.º 17
0
        public void ProcessContract(Contract contract, int months)
        {
            double fee = contract.TotalValue / months;

            for (int i = 1; i <= months; i++)
            {
                double value      = fee + _onlinePaymentService.Interest(fee, i);
                double totalValue = value + _onlinePaymentService.PaymentFee(value);

                DateTime dueDate = contract.Date.AddMonths(i);

                Installment installment = new Installment(dueDate, totalValue);

                contract.Installments.Add(installment);
            }
        }
Ejemplo n.º 18
0
        public void ProcessContract(Contract contract, int months)
        {
            DateTime time        = contract.Date;
            DateTime datePayment = time.AddDays(30);
            //"Melhoria" -> DateTime datePayment = contract.Date.AddMonths(i);

            double installment = 0.0;
            double value       = contract.TotalValue / months;

            for (int i = 1; i <= months; i++)
            {
                installment = _paymentService.Interest(value, i);
                Installment instal = new Installment(datePayment, installment);
                contract.addInstallment(instal);
                //Melhoria -> contract.addInstallment(new Installment(datePayment, installment));

                time        = datePayment;
                datePayment = time.AddDays(30);
            }
        }
        public void ProcessContract(Contract contract, int months)
        {
            double valueInstallment = contract.Value / months;

            for (int i = 1; i <= months; i++)
            {
                double   amount  = valueInstallment + _onlinePaymentService.PaymentFee(_onlinePaymentService.Interest(valueInstallment, i)) + _onlinePaymentService.Interest(valueInstallment, i);
                DateTime dueDate = contract.Date.AddDays(30.0);
                contract.installments.Add(new Installment(dueDate, amount));
            }
        }