Ejemplo n.º 1
0
        public void Test_AccruedInterestProcessingCeaseDays()
        {
            ApplicationSettings generalSettings = ApplicationSettings.GetInstance("");

            generalSettings.DeleteAllParameters();
            generalSettings.AddParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, false);
            generalSettings.AddParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, true);
            generalSettings.AddParameter(OGeneralSettings.PAYFIRSTINSTALLMENTREALVALUE, true);
            generalSettings.AddParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            generalSettings.AddParameter(OGeneralSettings.BAD_LOAN_DAYS, 50);
            generalSettings.AddParameter(OGeneralSettings.CEASE_LAIE_DAYS, 10);
            generalSettings.AddParameter(OGeneralSettings.USE_DAILY_ACCRUAL_OF_PENALTY, false);

            Loan myContract = _SetContract(6000, 0.0833m, OLoanTypes.Flat,
                                           new NonRepaymentPenalties(0, 0, 0, 0), false, 0,
                                           new DateTime(2010, 10, 15), 3);

            OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments rLi =
                _SetRepaymentOptions(myContract, false);

            Assert.AreEqual(new DateTime(2010, 11, 15), myContract.GetInstallment(0).ExpectedDate);
            Assert.AreEqual(new DateTime(2010, 12, 15), myContract.GetInstallment(1).ExpectedDate);

            RepaymentEvent rpeEvent = myContract.Repay(1, new DateTime(2010, 11, 15), 2500, false, true);

            Assert.AreEqual(rpeEvent.Interests, 500m);
            rpeEvent = myContract.Repay(2, new DateTime(2010, 12, 10), 300, false, true);
            Assert.AreEqual(rpeEvent.Interests, 300);

            AccruedInterestEvent e = myContract.GetAccruedInterestEvent(new DateTime(2010, 12, 31));

            Assert.AreEqual(e.Code, "LIAE");
            Assert.AreEqual(e.AccruedInterest, 1151);
            myContract.Events.Add(e);
        }
Ejemplo n.º 2
0
        public void Delete_Event()
        {
            EventManager eventManager = (EventManager)container["EventManager"];
            //I choose LoanInterestAccruingEvent, but delete work with any event
            AccruedInterestEvent loanInterestAccruingEvent = new AccruedInterestEvent
            {
                Id = 15,
                User = new User { Id = 1 },
                Date = new DateTime(2006, 7, 21),
                Interest = 99,
                AccruedInterest = 3,
                Rescheduled = true,
                InstallmentNumber = 4
            };
            eventManager.AddLoanEvent(loanInterestAccruingEvent, 3);
            loanInterestAccruingEvent.CancelDate = DateTime.Now;
            eventManager.DeleteLoanEvent(loanInterestAccruingEvent);

            EventStock eventStock = eventManager.SelectEvents(3);
            foreach (Event e in eventStock.GetEvents())
            {
                if (e is AccruedInterestEvent)
                    _AssertLoanInterestAccruingEvent(e as AccruedInterestEvent, new DateTime(2006, 7, 21), 99, 3, true, 4,true);
            }
        }
Ejemplo n.º 3
0
        public void Select_Added_LoanInterestAccruingEvent()
        {
            EventManager         eventManager = (EventManager)container["EventManager"];
            AccruedInterestEvent loanInterestAccruingEvent = new AccruedInterestEvent
            {
                Id   = 15,
                User = new User {
                    Id = 1
                },
                Date              = new DateTime(2006, 7, 21),
                Interest          = 99,
                AccruedInterest   = 3,
                Rescheduled       = true,
                InstallmentNumber = 4
            };

            eventManager.AddLoanEvent(loanInterestAccruingEvent, 1);

            EventStock eventStock = eventManager.SelectEvents(2);

            foreach (Event e in eventStock.GetEvents())
            {
                if (e is AccruedInterestEvent)
                {
                    _AssertLoanInterestAccruingEvent(e as AccruedInterestEvent, new DateTime(2006, 7, 21), 99, 3, true, 4, false);
                }
            }
        }
Ejemplo n.º 4
0
        private static OCurrency GetValue(AccruedInterestEvent eventItem, ContractAccountingRule rule)
        {
            OCurrency amount = 0;

            if (rule.EventAttribute.Name.ToLower() == "accrued_interest")
            {
                amount = eventItem.AccruedInterest;
            }
            return(amount);
        }
Ejemplo n.º 5
0
 private static void _AssertLoanInterestAccruingEvent(AccruedInterestEvent pEvent, DateTime pDate, OCurrency pInterestPrepayment, OCurrency pAccruedInterest, bool pRescheduled, 
     int pInstallmentNumber, bool pDeleted)
 {
     Assert.AreEqual("LIAE", pEvent.Code);
     Assert.AreEqual(pDate, pEvent.Date);
     Assert.AreEqual(pInterestPrepayment.Value, pEvent.Interest.Value);
     Assert.AreEqual(pAccruedInterest.Value, pEvent.AccruedInterest.Value);
     Assert.AreEqual(pRescheduled, pEvent.Rescheduled);
     Assert.AreEqual(pInstallmentNumber, pEvent.InstallmentNumber);
     Assert.AreEqual(pDeleted, pEvent.Deleted);
 }
Ejemplo n.º 6
0
        public void AccruedInterestLoanProcessing()
        {
            if (ServicesProvider.GetInstance().GetGeneralSettings().AccountingProcesses == OAccountingProcesses.Accrual)
            {
                foreach (Loan loan in _listLoan)
                {
                    UpdateStatus("AccruedInterestIsBeingProcessedForContract", " ->" + loan.Code);
                    AccruedInterestEvent e = loan.GetAccruedInterestEvent(TimeProvider.Now);

                    if (e != null)
                    {
                        _generatedEvents.Add(e);
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public void Add_LoanInterestAccruingEvent()
 {
     EventManager eventManager = (EventManager)container["EventManager"];
     AccruedInterestEvent loanInterestAccruingEvent = new AccruedInterestEvent
     {
         Id = 15,
         User = new User { Id = 1 },
         Date = new DateTime(2006, 7, 21),
         Interest = 99,
         AccruedInterest = 3,
         Rescheduled = true,
         InstallmentNumber = 4
     };
     eventManager.AddLoanEvent(loanInterestAccruingEvent, 1);
     Assert.AreNotEqual(0, loanInterestAccruingEvent.Id);
 }
Ejemplo n.º 8
0
        public void TestAccruedInterestProcessingNegativeCase()
        {
            Loan myContract = _SetContract(6000, 0.0833m, OLoanTypes.Flat,
                                           new NonRepaymentPenalties(0, 0, 0, 0), false, 0,
                                           new DateTime(2010, 10, 15), 3);

            OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments rLI =
                _SetRepaymentOptions(myContract, false);

            Assert.AreEqual(new DateTime(2010, 11, 15), myContract.GetInstallment(0).ExpectedDate);
            Assert.AreEqual(new DateTime(2010, 12, 15), myContract.GetInstallment(1).ExpectedDate);

            RepaymentEvent rpeEvent = myContract.Repay(1, new DateTime(2010, 11, 15), 2500, false, true);

            Assert.AreEqual(rpeEvent.Interests, 500m);
            rpeEvent = myContract.Repay(2, new DateTime(2010, 12, 15), 2500, false, true);
            Assert.AreEqual(rpeEvent.Interests, 500);
            rpeEvent = myContract.Repay(3, new DateTime(2010, 12, 15), 300, false, true);
            Assert.AreEqual(rpeEvent.Interests, 300);

            AccruedInterestEvent e = myContract.GetAccruedInterestEvent(new DateTime(2010, 12, 31));
            //Assert.AreEqual(e, null);
        }
Ejemplo n.º 9
0
 private void LoanInterestAccruingOrigination(AccruedInterestEvent loanInterestAccruingEvent, Loan loanContract, SqlTransaction sqlTransac)
 {
     _eventManagement.AddLoanEvent(loanInterestAccruingEvent, loanContract.Id, sqlTransac);
 }