private static CalculateMaximumAmountToRepayStrategy _MaximumAmountToRepay(Loan pContract, bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount, bool pCancelInterest, OCurrency pManualInterestAmount)
        {
            CreditContractOptions cCO = new CreditContractOptions(pContract.Product.LoanType, pContract.Product.KeepExpectedInstallment, pCancelFees, pManualFeesAmount, pManualCommissionAmount, pCancelInterest, pManualInterestAmount,
                                                                  pContract.Product.AnticipatedTotalRepaymentPenaltiesBase);

            return(new CalculateMaximumAmountToRepayStrategy(cCO, pContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")));
        }
        public void Flate_BadLoan_42dayslate_OnOLB_KeepNotExpectedInstallment()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType        = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency {
                    Id = 1
                }
            };

            package.KeepExpectedInstallment = false;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.OLB          = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);

            repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            //30 + 230 + 1000 * 0.003 * 42 = 386
            Assert.AreEqual(386, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
        }
        private static RepayNextInstallmentsStrategy _SetRepaymentOptions(Loan pContract, bool pCancelInterest, OCurrency pManualInterestAmount)
        {
            CreditContractOptions cCO = new CreditContractOptions(pContract.Product.LoanType, pContract.Product.KeepExpectedInstallment, true, 0, 0, pCancelInterest, pManualInterestAmount,
                                                                  pContract.Product.AnticipatedTotalRepaymentPenaltiesBase);

            return(new RepayNextInstallmentsStrategy(pContract, cCO, new User(), ApplicationSettings.GetInstance("")));
        }
        public void Declining_BadLoanWith42dayslateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepExpectedInstallment()
        {
            ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", true);
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType        = OLoanTypes.DecliningFixedInstallments,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency {
                    Id = 1, UseCents = true
                },
                RoundingType = ORoundingType.Approximate
            };

            package.KeepExpectedInstallment = true;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""),
                                       NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.InitialAmount = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties  = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);

            repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            //30 + 218.35 + 1000 * 0.003 * 42
            Assert.AreEqual(374.35m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
        }
        public void FlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithInterestAndKeepExpectedInstallment()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType        = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency {
                    Id = 1, UseCents = true
                }
            };

            package.KeepExpectedInstallment = true;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003;
            myContract.NonRepaymentPenalties.OverDueInterest  = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties     = 0.01;

            ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", true);

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);

            repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            //30 + 230 + 30 * 0.003 * 42 + 230 * 0.003 *14
            Assert.AreEqual(273.44m, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
            //NOT CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS
            ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", false);

            //30 + 230 + 30 * 0.003 * 36 + 230 * 0.003 *12
            Assert.AreEqual(270.74m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
        }
        public void TestCalculateMaximumAmountWithDecliningBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithInterestAndKeepNotExpectedInstallment()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType        = OLoanTypes.DecliningFixedInstallments,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency {
                    Id = 1
                },
                RoundingType = ORoundingType.Approximate
            };

            package.KeepExpectedInstallment = false;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.OverDueInterest  = 0.003;
            myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties     = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);

            repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            //30 + 218.35 + 30 * 0.003 * 42 + 218.35 * 0.003 * 14 = 30 + 218 + 4 + 9 = 261
            Assert.AreEqual(261, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
        }
        public void TestCalculateMaximumAmountWithFlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithoutInterestAndKeepExpectedInstallment()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType        = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency {
                    Id = 1
                }
            };

            package.KeepExpectedInstallment = true;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties     = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);

            this.repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, false);
            //30 + 230 + 200 * 0.003 * 12 = 268.4 => 267
            // Assert.AreEqual(267, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
            Assert.AreEqual(267, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 0));

            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);

            //30 + 230 + 200 * 0.003 * 14 = 268.4 => 268
            Assert.AreEqual(268, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
        }
        public void TestCalculateMaximumAmountWithFlateBadLoanWith42DaysLateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepExpectedInstallmentAndCancelFeesSetToFalse()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType        = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency {
                    Id = 1
                }
            };

            package.KeepExpectedInstallment = true;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.InitialAmount = 0.0123;
            myContract.AnticipatedTotalRepaymentPenalties  = 0.01;

            //42 days late
            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);

            this.repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            //30 + 230 + 1000 * 0.0123 * 42 = 776.6 => 777
            //  Assert.AreEqual(777, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
            Assert.AreEqual(777, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 0));
        }
 public CalculateAnticipatedFeesStrategy(CreditContractOptions pCCO,Loan pContract, ApplicationSettings pGeneralSettings)
 {
     if(pCCO.CancelFees || pCCO.KeepExpectedInstallments)
         _cFfar = new AnticipatedFeesNotCalculate();
     else
         _cFfar = new AnticipatedFeesCalculate(pCCO,pContract);
 }
Esempio n. 10
0
 public RepayFeesStrategy(CreditContractOptions pCCO)
 {
     if (!pCCO.CancelFees)
         _methodToCalculateFees = new AutomaticMethod();
     else
         _methodToCalculateFees = new ManualMethod();
 }
Esempio n. 11
0
 public RepayInterestStrategy(CreditContractOptions pCCO)
 {
     if (pCCO.CancelInterests && pCCO.KeepExpectedInstallments)
         _methodToCalculateInterest = new ManualMethod();
     else
         _methodToCalculateInterest = new AutomaticMethod();
 }
 public CalculationBaseForAnticipatedFees(CreditContractOptions pCCO, Loan pContract)
 {
     if (pCCO.AnticipatedTotalRepaymentPenaltiesBase == OAnticipatedRepaymentPenaltiesBases.RemainingInterest)
         _iBtcffar = new RemainingInterest(pContract);
     else
         _iBtcffar = new RemainingOLB(pContract);
 }
Esempio n. 13
0
        private static OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments _SetRepaymentOptions(Loan pContract, bool pCancelFees)
        {
            CreditContractOptions cCO = new CreditContractOptions(pContract.Product.LoanType, pContract.Product.KeepExpectedInstallment, pCancelFees, 0, 0, false, 0,
                                                                  pContract.Product.AnticipatedTotalRepaymentPenaltiesBase);

            return(new OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments(cCO, pContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")));
        }
 public DecliningKeepExpectedInstallments(Loan pContract, CreditContractOptions pCco)
 {
     _paidInstallments = new List<Installment>();
     _contract = pContract;
     _methodToRepayInterest = new RepayInterestStrategy(pCco);
     _methodToRepayFees = new RepayFeesStrategy(pCco);
     _methodToRepayCommission = new RepayCommisionStrategy(pCco);
 }
 public FlateKeepExpectedInstallments(Loan contract, CreditContractOptions pCCO)
 {
     _contract                = contract;
     _paidInstallments        = new List <Installment>();
     _methodToRepayInterest   = new RepayInterestStrategy(pCCO);
     _methodToRepayFees       = new RepayFeesStrategy(pCCO);
     _methodToRepayCommission = new RepayCommisionStrategy(pCCO);
 }
Esempio n. 16
0
 public RepayFeesStrategy(CreditContractOptions pCCO)
 {
     // || pCCO.KeepExpectedInstallments
     if (!pCCO.CancelFees)
         _methodToCalculateFees = new AutomaticMethod();
     else
         _methodToCalculateFees = new ManualMethod();
 }
 public FlateKeepExpectedInstallments(Loan contract, CreditContractOptions pCCO)
 {
     _contract = contract;
     _paidInstallments = new List<Installment>();
     _methodToRepayInterest = new RepayInterestStrategy(pCCO);
     _methodToRepayFees = new RepayFeesStrategy(pCCO);
     _methodToRepayCommission = new RepayCommisionStrategy(pCCO);
 }
Esempio n. 18
0
 public DecliningKeepExpectedInstallments(Loan pContract, CreditContractOptions pCco)
 {
     _paidInstallments        = new List <Installment>();
     _contract                = pContract;
     _methodToRepayInterest   = new RepayInterestStrategy(pCco);
     _methodToRepayFees       = new RepayFeesStrategy(pCco);
     _methodToRepayCommission = new RepayCommisionStrategy(pCco);
 }
 public CalculateAmountToRepaySpecifiedInstallmentStrategy(CreditContractOptions pCCo,Loan pContract, User pUser, 
     ApplicationSettings pGeneralSettings,NonWorkingDateSingleton pNonWorkingDate)
 {
     _user = pUser;
     _generalSettings = pGeneralSettings;
     _nWds = pNonWorkingDate;
     _contract = pContract;
     _cCo = pCCo;
 }
 public CalculateAmountToRepaySpecifiedInstallmentStrategy(CreditContractOptions pCCo, Loan pContract, User pUser,
                                                           ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNonWorkingDate)
 {
     _user            = pUser;
     _generalSettings = pGeneralSettings;
     _nWds            = pNonWorkingDate;
     _contract        = pContract;
     _cCo             = pCCo;
 }
        public CalculateMaximumAmountToRegradingLoanStrategy(CreditContractOptions pCCo, Loan pContract, User pUser,
                                                             ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNonWorkingDate)
        {
            _user            = pUser;
            _generalSettings = pGeneralSettings;
            _nWds            = pNonWorkingDate;

            _contract = pContract;
            _cCo      = pCCo;
        }
        public CalculateMaximumAmountToRegradingLoanStrategy(CreditContractOptions pCCo,Loan pContract, User pUser, 
            ApplicationSettings pGeneralSettings,NonWorkingDateSingleton pNonWorkingDate)
        {
            _user = pUser;
            _generalSettings = pGeneralSettings;
            _nWds = pNonWorkingDate;

            _contract = pContract;
            _cCo = pCCo;
        }
Esempio n. 23
0
 public CalculateInstallments(CreditContractOptions pCCO, Loan pContract, User pUser, ApplicationSettings pGeneralSettings,NonWorkingDateSingleton pNonWorkingDate)
 {
     _generalSettings = pGeneralSettings;
     _nWds = pNonWorkingDate;
     _contract = pContract;
     _cCo = pCCO;
     _methodToRepayFees = new RepayFeesStrategy(pCCO);
     _methodToRepayInterest = new RepayInterestStrategy(pCCO);
     _methodToRepayCommission = new RepayCommisionStrategy(pCCO);
     PaidIstallments = new List<Installment>();
 }
 public CalculateAnticipatedFeesStrategy(CreditContractOptions pCCO, Loan pContract, ApplicationSettings pGeneralSettings)
 {
     if (pCCO.CancelFees || pCCO.KeepExpectedInstallments)
     {
         _cFfar = new AnticipatedFeesNotCalculate();
     }
     else
     {
         _cFfar = new AnticipatedFeesCalculate(pCCO, pContract);
     }
 }
Esempio n. 25
0
 public RepayInterestStrategy(CreditContractOptions pCCO)
 {
     if (pCCO.CancelInterests && pCCO.KeepExpectedInstallments)
     {
         _methodToCalculateInterest = new ManualMethod();
     }
     else
     {
         _methodToCalculateInterest = new AutomaticMethod();
     }
 }
Esempio n. 26
0
 public RepayFeesStrategy(CreditContractOptions pCCO)
 {
     if (!pCCO.CancelFees)
     {
         _methodToCalculateFees = new AutomaticMethod();
     }
     else
     {
         _methodToCalculateFees = new ManualMethod();
     }
 }
 public CalculationBaseForAnticipatedFees(CreditContractOptions pCCO, Loan pContract)
 {
     if (pCCO.AnticipatedTotalRepaymentPenaltiesBase == OAnticipatedRepaymentPenaltiesBases.RemainingInterest)
     {
         _iBtcffar = new RemainingInterest(pContract);
     }
     else
     {
         _iBtcffar = new RemainingOLB(pContract);
     }
 }
 public CalculateRealInterestInstallments(CreditContractOptions pCco,
                                          CalculateMaximumAmountToRepayStrategy calculateMaximumAmount, Loan pContract,
                                          ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNonWorkingDate)
 {
     _generalSettings         = pGeneralSettings;
     _nWds                    = pNonWorkingDate;
     _contract                = pContract;
     _cCo                     = pCco;
     _methodToRepayFees       = new RepayFeesStrategy(pCco);
     _methodToRepayInterest   = new RepayInterestStrategy(pCco);
     _methodToRepayCommission = new RepayCommisionStrategy(pCco);
     PaidIstallments          = new List <Installment>();
     _calculateMaximumAmount  = calculateMaximumAmount;
 }
        public RepayNextInstallmentsStrategy(Loan contract,CreditContractOptions cCO, User pUser, ApplicationSettings pGeneralSettings)
        {
            if(cCO.LoansType != OLoanTypes.Flat) //declining
            {
                if(cCO.KeepExpectedInstallments)
                    _repayNextInstallments = new DecliningKeepExpectedInstallments(contract, cCO);
                else
                {
                    if (contract.Product.ExoticProduct != null)
                    {
                        if(contract.UseCents)
                            _repayNextInstallments = new DecliningExoticKeepNotExpectedInstallmentsWithCents(contract);
                        else
                            _repayNextInstallments = new DecliningExoticKeepNotExpectedInstallmentsWithNoCents(contract);
                    }
				    //???????????????????????????????????????
                    else
                        _repayNextInstallments = new DecliningKeepNotExpectedInstallments(contract, pUser, pGeneralSettings);
                }
            }
            else //flat
            {
                if (cCO.KeepExpectedInstallments)
                {
                    _repayNextInstallments = new FlateKeepExpectedInstallments(contract, cCO);
                }
                else
                {
                    if (contract.Product.ExoticProduct != null)
                    {
                        if (contract.UseCents)
                        {
                            _repayNextInstallments = new FlatExoticKeepNotExpectedInstallmentsWithCents(contract);
                        }
                        else
                        {
                            _repayNextInstallments = new FlatExoticKeepNotExpectedInstallmentsWithNoCents(contract);
                        }
                    }

                    else
                    {   // ??????????????????????????????????????????????????????????????
                        if (contract.UseCents)
                            _repayNextInstallments = new FlateKeepNotExpectedInstallmentsWithCents(contract, pGeneralSettings);
                        else
                            _repayNextInstallments = new FlateKeepNotExpectedInstallmentsWithNoCents(contract, pGeneralSettings);
                    }
                }
            }
        }
 public CalculateRealInterestInstallments(CreditContractOptions pCco,  
     CalculateMaximumAmountToRepayStrategy calculateMaximumAmount, Loan pContract, 
     ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNonWorkingDate)
 {
     _generalSettings = pGeneralSettings;
     _nWds = pNonWorkingDate;
     _contract = pContract;
     _cCo = pCco;
     _methodToRepayFees = new RepayFeesStrategy(pCco);
     _methodToRepayInterest = new RepayInterestStrategy(pCco);
     _methodToRepayCommission = new RepayCommisionStrategy(pCco);
     PaidIstallments = new List<Installment>();
     _calculateMaximumAmount = calculateMaximumAmount;
 }
        public void _Flate_BadLoan_42dayslate_BasedOnOverDueWithoutInterest_KeepExpectedInstallment()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);

            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType        = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency {
                    Id = 1, UseCents = true
                },
                KeepExpectedInstallment = true,
                AnticipatedTotalRepaymentPenaltiesBase =
                    OAnticipatedRepaymentPenaltiesBases.RemainingOLB
            };
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(),
                                       ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
                                       ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
            {
                BadLoan = true,
                NonRepaymentPenalties = { OverDuePrincipal = 0.003 },
                AnticipatedTotalRepaymentPenalties = 0.01
            };

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);

            repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            //30 + 230 + 200 * 0.003 * 14
            Assert.AreEqual(268.4m, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
            //NOT CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, false);

            //30 + 230 + 200 * 0.003 * 12
            Assert.AreEqual(266.60m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
        }
Esempio n. 32
0
 public RepaymentMethod(Loan pContract, CreditContractOptions pCCO)
 {
     _contract = pContract;
     _cco = pCCO;
     PaidIstallments = new List<Installment>();
 }
        private static CalculateAnticipatedFeesStrategy _SetFeesCalculationOptions(Loan pContract, bool pCancelFees)
        {
            CreditContractOptions cCO = new CreditContractOptions(pContract.Product.LoanType, pContract.Product.KeepExpectedInstallment, pCancelFees, 0, 0, false, 0, pContract.Product.AnticipatedTotalRepaymentPenaltiesBase);

            return(new CalculateAnticipatedFeesStrategy(cCO, pContract, ApplicationSettings.GetInstance("")));
        }
Esempio n. 34
0
 public AnticipatedFeesCalculate(CreditContractOptions pCCO,Loan pContract)
 {
     _loan = pContract;
     _bTcffar = new CalculationBaseForAnticipatedFees(pCCO,pContract);
 }
Esempio n. 35
0
 public RepaymentMethod(Loan pContract, CreditContractOptions pCCO)
 {
     _contract       = pContract;
     _cco            = pCCO;
     PaidIstallments = new List <Installment>();
 }
Esempio n. 36
0
 public AnticipatedFeesCalculate(CreditContractOptions pCCO, Loan pContract)
 {
     _loan    = pContract;
     _bTcffar = new CalculationBaseForAnticipatedFees(pCCO, pContract);
 }
Esempio n. 37
0
 public RepaymentMethod(Loan pContract, CreditContractOptions pCCO)
 {
     _contract = pContract;
     _cco = pCCO;
 }
 public RepayCommisionStrategy(CreditContractOptions pCCO)
 {
     _pCCO = pCCO;
 }
Esempio n. 39
0
 public RepayCommisionStrategy(CreditContractOptions pCCO)
 {
     _pCCO = pCCO;
 }