コード例 #1
0
        public void Test_LateLoanProcessingDoCalculationTwoTimes()
        {
            Loan myContract = _SetContract(1000, 0.03m, OLoanTypes.Flat, new NonRepaymentPenalties(0, 0, 0.003, 0), false, 1, new DateTime(2010, 6, 6), 6);

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

            Assert.AreEqual(new DateTime(2010, 7, 6), myContract.GetInstallment(0).ExpectedDate);
            Assert.AreEqual(new DateTime(2010, 8, 6), myContract.GetInstallment(1).ExpectedDate);

            rLI.CalculateNewInstallmentsWithLateFees(new DateTime(2010, 10, 1));
            // good loan to the bad loan
            OverdueEvent e = myContract.GetOverdueEvent(new DateTime(2010, 10, 1));

            Assert.AreEqual(e.Code, "GLBL");
            e = myContract.GetOverdueEvent(new DateTime(2010, 10, 20));
            Assert.AreEqual(e, null);
            myContract.Repay(1, new DateTime(2010, 10, 20), 500, false, true);
            //bad loan to the late loan
            e = myContract.GetOverdueEvent(new DateTime(2010, 10, 21));

            Assert.AreEqual(e.Code, "BLLL");
            myContract.Repay(1, new DateTime(2010, 11, 6), 500, false, true);
            //late loan to the good loan
            e = myContract.GetOverdueEvent(new DateTime(2010, 11, 6));

            Assert.AreEqual(e.Code, "LLGL");
            Assert.AreEqual(e.OLB, 243m);
        }
コード例 #2
0
        public void LateLoanProcessing()
        {
            foreach (Loan loan in _listLoan)
            {
                UpdateStatus("OverdueEventsProcessingForContract", " ->" + loan.Code);
                OverdueEvent e = loan.GetOverdueEvent(TimeProvider.Now);

                if (e != null)
                {
                    _generatedEvents.Add(e);
                }
            }
        }
コード例 #3
0
        private static OCurrency GetValue(OverdueEvent eventItem, ContractAccountingRule rule)
        {
            OCurrency amount = 0;

            if (rule.EventAttribute.Name.ToLower() == "olb")
            {
                amount = eventItem.OLB;
            }

            if (rule.EventAttribute.Name.ToLower() == "overdue_principal")
            {
                amount = eventItem.OverduePrincipal;
            }
            return(amount);
        }
コード例 #4
0
        public void Test_RescheduleLateLoanProcessing()
        {
            Loan myContract = _SetContract(1000, 0.03m, OLoanTypes.Flat, new NonRepaymentPenalties(0, 0, 0.003, 0), false, 1, new DateTime(2010, 6, 6), 6);

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

            Assert.AreEqual(new DateTime(2010, 7, 6), myContract.GetInstallment(0).ExpectedDate);
            Assert.AreEqual(new DateTime(2010, 8, 6), myContract.GetInstallment(1).ExpectedDate);

            myContract.Repay(1, new DateTime(2010, 7, 6), 230, false, true);
            myContract.Repay(2, new DateTime(2010, 8, 6), 230, false, true);

            rLI.CalculateNewInstallmentsWithLateFees(new DateTime(2010, 10, 1));
            ReschedulingOptions ro = new ReschedulingOptions
            {
                InterestRate              = 0.04m,
                NewInstallments           = 2,
                RepaymentDateOffset       = 0,
                ChargeInterestDuringShift = true,
                ReschedulingDate          = new DateTime(2010, 10, 1)
            };

            myContract.Reschedule(ro);
            myContract.AddRecheduleTransformationEvent(ro.ReschedulingDate);
            List <OverdueEvent> list = myContract.Events.GetOverdueEvents();

            Assert.AreEqual(list[0].Code, "LLRL");

            // good loan to the bad loan
            OverdueEvent e = myContract.GetOverdueEvent(new DateTime(2010, 10, 1));

            Assert.AreEqual(e.Code, "GLLL");
            e = myContract.GetOverdueEvent(new DateTime(2010, 10, 20));
            Assert.AreEqual(e, null);
            myContract.Repay(1, new DateTime(2010, 10, 20), 500, false, true);
            //bad loan to the late loan
            e = myContract.GetOverdueEvent(new DateTime(2010, 10, 21));

            Assert.AreEqual(e.Code, "LLGL");
            myContract.Repay(1, new DateTime(2010, 11, 6), 500, false, true);
            //late loan to the good loan
        }
コード例 #5
0
 private void OverdueEventOrigination(OverdueEvent overdueEvent, Loan loanContract, SqlTransaction sqlTransac)
 {
     _eventManagement.AddLoanEvent(overdueEvent, loanContract.Id, sqlTransac);
 }