public SavingDeposit(ApplicationSettings pApplicationSettings, ChartOfAccounts pChartOfAccounts, User pUser) { _events = new List<SavingEvent>(); _chartOfAccounts = _FillChartOfAccounts(pChartOfAccounts); _applicationSettings = pApplicationSettings; _user = pUser; }
public SavingDeposit(ApplicationSettings pApplicationSettings, ChartOfAccounts pChartOfAccounts, User pUser, TermDepositProduct pProduct) { _events = new List<SavingEvent>(); base.Product = pProduct; _chartOfAccounts = _FillChartOfAccounts(pChartOfAccounts); _applicationSettings = pApplicationSettings; _user = pUser; }
public SavingDeposit(ApplicationSettings pApplicationSettings, ChartOfAccounts pChartOfAccounts, User pUser, DateTime pCreationDate, IClient pClient) { Client = pClient; CreationDate = pCreationDate; _events = new List<SavingEvent>(); _chartOfAccounts = _FillChartOfAccounts(pChartOfAccounts); _applicationSettings = pApplicationSettings; _user = pUser; }
public Saving(ApplicationSettings pApplicationSettings, ChartOfAccounts pChartOfAccounts, User pUser, SavingBookProduct pProduct) { base.Product = pProduct; _events = new List<SavingEvent>(); _chartOfAccounts = _FillChartOfAccounts(pChartOfAccounts); _applicationSettings = pApplicationSettings; _user = pUser; _loans = new List<Loan>(); }
public Saving(ApplicationSettings pApplicationSettings, ChartOfAccounts pChartOfAccounts, User pUser, DateTime pCreationDate, SavingBookProduct pProduct, IClient pClient) { Client = pClient; CreationDate = pCreationDate; base.Product = pProduct; _events = new List<SavingEvent>(); _chartOfAccounts = _FillChartOfAccounts(pChartOfAccounts); _applicationSettings = pApplicationSettings; _user = pUser; _loans = new List<Loan>(); }
public void TestCalculateMaximumAmountWithFlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOLBAndKeepNotExpectedInstallment() { 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); this.repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")); //30 + 230 + 1000 * 0.003 * 42 = 386 Assert.AreEqual(386, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2)); }
public void CloseAccount() { Currency currency = new Currency() { UseCents = false, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" }; CompulsorySavingsProduct product = new CompulsorySavingsProduct(); product.Currency = currency; CompulsorySavings saving = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 1000, new DateTime(2009, 01, 01), null) { InterestRate = 0.01, Product = product }; List <SavingEvent> events = saving.Close(new DateTime(2009, 02, 26), new User() { Id = 1 }, "Close savings contract", false); int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count; int postingEvents = saving.Events.FindAll(item => item is SavingInterestsPostingEvent).Count; Assert.AreEqual(events.Count, 58); Assert.AreEqual(accrualEvents, 56); Assert.AreEqual(postingEvents, 1); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_COMPULSORY_SAVINGS, 1).Balance.Value, 0); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.COMPULSORY_SAVINGS, 1).Balance.Value, 1560); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.CASH, 1).Balance.Value, 1000); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.INTERESTS_ON_DEPOSIT_ACCOUNT, 1).Balance.Value, 560); Assert.AreEqual(saving.GetBalance(), 1560); Assert.AreEqual(saving.Status, OSavingsStatus.Closed); }
public void TestIfInterestPrincipalAndFeesInLetterCorrectlyRetrievedWhenDisburseAndNoFeesWhenCurrencyIsSOMAndLanguageIsRussian() { Assert.AreEqual(new DateTime(2006, 1, 1), contractForAPerson.StartDate); CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, null, "SOM", "ru-RU", new ExchangeRate(new DateTime(2006, 1, 1), 3), new DateTime(2006, 1, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); //Negative value for principal if event is a loanDisbursmentEvent Assert.AreEqual(-3000, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(0, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(0, cashReceipt.PaidFeesInExternalCurrency); Assert.AreEqual("ноль SOM", cashReceipt.PaidInterestInLetter); Assert.AreEqual("ноль SOM", cashReceipt.PaidFeesInLetter); Assert.AreEqual("три тысячи SOM", cashReceipt.PaidPrincipalInLetter); }
public void TestIfInterestPrincipalAndFeesInLetterCorrectlyRetrievedWhenRepayAndFeesWhenCurrencyIsUSDAndLanguageIsRussian() { Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "ru-RU", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(0, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(252.00m, Math.Round(cashReceipt.PaidFeesInExternalCurrency, 2)); Assert.AreEqual("девяносто USD", cashReceipt.PaidInterestInLetter); Assert.AreEqual("двести пятьдесят два USD", cashReceipt.PaidFeesInLetter); Assert.AreEqual("ноль USD", cashReceipt.PaidPrincipalInLetter); }
public void CashReceipt_CorrectlySaveAndRetrieved_GracePeriod() { contractForAPerson.Disbursed = true; _person.CashReceiptIn = 1; CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(1, cashReceipt.GracePeriod); }
public void CalculateInterest_CashMode_Daily_EndOfYear_OneClosure_OneDayBefore_PostingDate() { Currency currency = new Currency() { UseCents = false, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" }; CompulsorySavingsProduct product = new CompulsorySavingsProduct(); product.Currency = currency; CompulsorySavings saving = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 1000, new DateTime(2009, 01, 01), null) { InterestRate = 0.1, Product = product }; saving.Closure(new DateTime(2009, 12, 31), new User() { Id = 1 }); int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count; int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count; Assert.AreEqual(accrualEvents, 364); Assert.AreEqual(postingEvents, 0); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_COMPULSORY_SAVINGS, 1).Balance.Value, 36400); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.COMPULSORY_SAVINGS, 1).Balance.Value, 1000); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.CASH, 1).Balance.Value, 1000); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.INTERESTS_ON_DEPOSIT_ACCOUNT, 1).Balance.Value, 36400); Assert.AreEqual(saving.GetBalance(), 1000); }
public void Get_Set_Credits() { _project.AddCredit(new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())), OClientTypes.Group); Assert.AreEqual(1, _project.Credits.Count); Assert.AreEqual(OClientTypes.Group, _project.Credits[0].ClientType); }
public void TestIfDistrictCorrectlyRetrievedWhenContractBeneficiaryIsAGroup() { CashReceipt cashReceipt = new CashReceipt(contractForAGroup, _group, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual("Lorraine", cashReceipt.District); }
public void Get_Set_Loan() { Loan loan = new Loan() { Id = 1 }; CompulsorySavings compulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User()) { Loan = loan }; Assert.AreEqual(loan, compulsorySavings.Loan); }
public void Get_Set_Code_ForPerson() { CompulsorySavings CompulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 12m, new DateTime(2007, 08, 11), null) { Code = "", Product = new CompulsorySavingsProduct() { Id = 2, Name = "CompulsorySavingsProduct", Code = "CompulsorySavingsProduct" } }; CompulsorySavings.GenerateSavingCode(new Person { Id = 2, FirstName = "Vincent", LastName = "Guigui" }, 3, "BC/YY/PC-PS/CN-ID", "IMF", "BC"); Assert.AreEqual("S/BC/2007/COMPU-4/GUIG-2", CompulsorySavings.Code); CompulsorySavings.GenerateSavingCode(new Person { Id = 10, FirstName = "Vincent", LastName = "Guigui" }, 4, "IC/BC/CS/ID", "IMF", "BC"); Assert.AreEqual("IMF/BC/05/00010/73", CompulsorySavings.Code); }
public void Get_Set_Id() { CompulsorySavings CompulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 12m, TimeProvider.Today, null) { Id = 1 }; Assert.AreEqual(1, CompulsorySavings.Id); }
public void CalculateInterest_AccrualMode_Daily_EndOfYear_OneClosure_On_PostingDate() { ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual); Currency currency = new Currency() { UseCents = false, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" }; CompulsorySavingsProduct product = new CompulsorySavingsProduct(); product.Currency = currency; CompulsorySavings saving = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 1000, new DateTime(2009, 01, 01), null) { InterestRate = 0.1, Product = product }; saving.Closure(new DateTime(2010, 01, 01), new User() { Id = 1 }); int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count; int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count; OCurrency interests = saving.Events.Where(item => item is SavingInterestsAccrualEvent).Sum(item => item.Amount.Value); Assert.AreEqual(accrualEvents, 365); Assert.AreEqual(postingEvents, 1); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_COMPULSORY_SAVINGS, 1).Balance.Value, 0); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.COMPULSORY_SAVINGS, 1).Balance.Value, 37500); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.CASH, 1).Balance.Value, 1000); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.INTERESTS_ON_DEPOSIT_ACCOUNT, 1).Balance.Value, 36500); Assert.AreEqual(saving.GetBalance(), 37500); }
public void Get_Set_Product() { CompulsorySavingsProduct product = new CompulsorySavingsProduct { Id = 1 }; CompulsorySavings CompulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 12m, TimeProvider.Today, product, null); Assert.AreEqual(product, CompulsorySavings.Product); }
private static Loan _SetContract(OLoanTypes pLoansType, bool pKeepExpectedInstallment, int pGracePeriod, int pMaturity, ExoticInstallmentsTable pExoticProduct) { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = pLoansType, ChargeInterestWithinGracePeriod = true, KeepExpectedInstallment = pKeepExpectedInstallment, ExoticProduct = pExoticProduct, AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB, Currency = new Currency { Id = 1 } }; Loan myContract = new Loan(package, 1000, 0.03m, pMaturity, pGracePeriod, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.BadLoan = false; myContract.AnticipatedTotalRepaymentPenalties = 0.01; myContract.NonRepaymentPenalties.InitialAmount = 0.003; return(myContract); }
protected ContractChartOfAccounts _FillChartOfAccounts(ChartOfAccounts pChartOfAccounts) { ContractChartOfAccounts contractChartOfAccounts; if (pChartOfAccounts.UniqueAccounts.Count > 0) contractChartOfAccounts = new ContractChartOfAccounts(pChartOfAccounts.UniqueAccounts. Select(item => new Account(item.Number, item.LocalNumber, item.Label, 0, item.TypeCode, item.DebitPlus, item.AccountCategory, Product != null && Product.Currency != null ? Product.Currency.Id : 1)).ToList()); else contractChartOfAccounts = new ContractChartOfAccounts(pChartOfAccounts.DefaultAccounts.ToList()); contractChartOfAccounts.AccountingRuleCollection = pChartOfAccounts.AccountingRuleCollection; return contractChartOfAccounts; }
public void TestIfCityCorrectlyRetrievedWhenContractBeneficiaryIsAPerson() { CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual("Paris", cashReceipt.City); }
public void TestIfInterestPrincipalAndFeesCorrectlyRetrievedWhenDisburseAndFees() { Assert.AreEqual(new DateTime(2006, 1, 1), contractForAGroup.StartDate); CashReceipt cashReceipt = new CashReceipt(contractForAGroup, _person, null, "USD", "en-US", new ExchangeRate(new DateTime(2006, 1, 1), 3), new DateTime(2006, 1, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); //Negative value for principal if event is a loanDisbursmentEvent Assert.AreEqual(-3000, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(0, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidFeesInExternalCurrency); }
public void TestIfLoanOfficerNameCorrectlyRetrieved() { CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual("Nicolas MANGIN", cashReceipt.LoanOfficerName_Contract); }
public void TestIfLocalAccountNumberCorrectlyRetrievedWhenDisburse() { ChartOfAccounts chartOfAccounts = ChartOfAccounts.GetInstance(User.CurrentUser); CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, null, "USD", "en-US", null, new DateTime(2006, 1, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(String.Empty, cashReceipt.InterestLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByTypeCode("CASH").LocalNumber, cashReceipt.PrincipalLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByTypeCode("COMMISSIONS").LocalNumber, cashReceipt.FeesLocalAccountNumber); }
public void TestIfCashReceiptOutCorrectlySaveAndRetrievedWhenNoCashReceiptOut() { contractForAPerson.Disbursed = false; CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, null, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(1, cashReceipt.CashReceiptOut.Value); }
public void CalculateInterest_AccrualMode_Daily_EndOfYear_OneClosure_DayOfCreation() { ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual); CompulsorySavings saving = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 1000, new DateTime(2009, 01, 15), null) { InterestRate = 0.1, Product = new CompulsorySavingsProduct() }; List <SavingEvent> events = saving.Closure(new DateTime(2009, 01, 15, 1, 1, 1), new User() { Id = 1 }); int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count; int postingEvents = saving.Events.FindAll(item => item is SavingInterestsPostingEvent).Count; Assert.AreEqual(events.Count, 1); Assert.AreEqual(accrualEvents, 0); Assert.AreEqual(postingEvents, 0); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_COMPULSORY_SAVINGS, 1).Balance.Value, 0); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.COMPULSORY_SAVINGS, 1).Balance.Value, 1000); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.CASH, 1).Balance.Value, 1000); Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.INTERESTS_ON_DEPOSIT_ACCOUNT, 1).Balance.Value, 0); Assert.AreEqual(saving.GetBalance(), 1000); }
public void TestIfInterestPrincipalAndFeesCorrectlyRetrievedWhenRepayAndFees() { Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); Assert.AreEqual(new DateTime(2006, 2, 1), contract.GetInstallment(0).ExpectedDate); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(0, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(252.00m, Math.Round(cashReceipt.PaidFeesInExternalCurrency, 2)); }
public void RepayInstallments_DontCancelFees_InitialAmount_RepaymentTwicelyADay() { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "10-days", 10, 0), LoanType = OLoanTypes.Flat, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1 } }; package.KeepExpectedInstallment = true; package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB; Loan myContract = new Loan(package, 8000, 0.03333m, 5, 0, new DateTime(2010, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.BadLoan = false; myContract.AnticipatedTotalRepaymentPenalties = 0.01; myContract.NonRepaymentPenalties = new NonRepaymentPenalties(0, 0, 0.0667, 0.01); myContract.CalculateInstallments(true); myContract.Disburse(new DateTime(2010, 1, 1), false, true); myContract.Repay(1, new DateTime(2010, 1, 8), 30, false, true); RepaymentEvent rPE = myContract.Repay(1, new DateTime(2010, 1, 11), 0, false, true); Assert.AreEqual(rPE.Penalties, 0); }
public void TestIfLocalAccountNumberCorrectlyRetrievedWhenRepayAGoodLoan() { ChartOfAccounts chartOfAccounts = ChartOfAccounts.GetInstance(User.CurrentUser); Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(chartOfAccounts.GetAccountByNumber(OAccounts.INTERESTS_ON_CASH_CREDIT_INDIVIDUAL_LOAN).LocalNumber, cashReceipt.InterestLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByNumber(OAccounts.CASH_CREDIT_INDIVIDUAL_LOAN).LocalNumber, cashReceipt.PrincipalLocalAccountNumber); Assert.AreEqual(chartOfAccounts.GetAccountByTypeCode("COMMISSIONS").LocalNumber, cashReceipt.FeesLocalAccountNumber); }
/// <summary> /// Instancy a new CreditContract. Use it if installments need'nt calculate /// </summary> /// <param name="pUser"></param> /// <param name="pGeneralSettings"></param> /// <param name="pNwds"></param> /// <param name="pPt"></param> /// <param name="pChartOfAccounts"></param> public Loan(User pUser, ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNwds, ProvisionTable pPt, ChartOfAccounts pChartOfAccounts) { _user = pUser; _generalSettings = pGeneralSettings; _nwdS = pNwds; NonRepaymentPenalties = new NonRepaymentPenalties(); _installmentList = new List<Installment>(); _guarantors = new List<Guarantor>(); _collaterals = new List<ContractCollateral>(); _events = new EventStock(); EntryFeesPercentage = true; }
public void TestIfInterestPrincipalAndFeesInLetterCorrectlyRetrievedWhenRepayAndFeesWhenCurrencyIsUSDAndLanguageIsEnglish() { Credit contract = contractForAPerson.Copy(); contract.Disburse(new DateTime(2006, 1, 1), true, false); CashReceipt cashReceipt = new CashReceipt(contract, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 3, 1), 3), new DateTime(2006, 3, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(0, cashReceipt.PaidPrincipalInExternalCurrency); Assert.AreEqual(90, cashReceipt.PaidInterestInExternalCurrency); Assert.AreEqual(252.00m, Math.Round(cashReceipt.PaidFeesInExternalCurrency, 2)); Assert.AreEqual("ninety USD", cashReceipt.PaidInterestInLetter); Assert.AreEqual("two hundred and fifty-two USD", cashReceipt.PaidFeesInLetter); Assert.AreEqual("zero USD", cashReceipt.PaidPrincipalInLetter); }
public void Get_Balance() { List <SavingEvent> events = new List <SavingEvent> { new SavingDepositEvent { Amount = 3500.46m }, new SavingWithdrawEvent { Amount = 20 }, new SavingDepositEvent { Amount = 100 }, new SavingWithdrawEvent { Amount = 30 } }; CompulsorySavings CompulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 200m, new DateTime(2008, 07, 18), null); CompulsorySavings.Events.AddRange(events); Assert.AreEqual(3750.46, CompulsorySavings.GetBalance().Value); }
public void TestIfUserIdCorrectlySaveAndRetrieved() { CashReceipt cashReceipt = new CashReceipt(contractForAPerson, _person, 0, "USD", "en-US", new ExchangeRate(new DateTime(2006, 2, 1), 3), new DateTime(2006, 2, 1), false, User.CurrentUser, GeneralSettings.GetInstance(""), ChartOfAccounts.GetInstance(User.CurrentUser), true); Assert.AreEqual(1, cashReceipt.UserId); }
public void Get_Set_InitialAmount() { List <SavingEvent> events = new List <SavingEvent> { new SavingWithdrawEvent { Amount = 75, Date = new DateTime(2008, 10, 21) }, new SavingDepositEvent { Amount = 12.46m, Date = new DateTime(2008, 08, 18) }, new SavingDepositEvent { Amount = 86, Date = new DateTime(2008, 09, 01) } }; CompulsorySavings CompulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 150m, new DateTime(2008, 07, 18), null); CompulsorySavings.Events.AddRange(events); Assert.AreEqual(173.46m, CompulsorySavings.GetBalance().Value); Assert.AreEqual(150m, CompulsorySavings.InitialAmount.Value); }
public Loan(LoanProduct pAckage, OCurrency pAmount, double pInterestRate, int pNbOfInstallments, int pGracePeriod, DateTime pStartDate, DayOfWeek? meetingDay, User pUser, ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNwds, ProvisionTable pPt, ChartOfAccounts pChartOfAccounts) { _user = pUser; _generalSettings = pGeneralSettings; _nwdS = pNwds; Product = pAckage; NonRepaymentPenalties = new NonRepaymentPenalties(); _events = new EventStock(); _guarantors = new List<Guarantor>(); _collaterals = new List<ContractCollateral>(); _installmentType = pAckage.InstallmentType; _amount = pAmount; _interestRate = pInterestRate; _nbOfInstallments = pNbOfInstallments; GracePeriod = pGracePeriod; CreationDate = pStartDate; _startDate = pStartDate; _firstInstallmentDate = CalculateInstallmentDate(pStartDate, 1); if (meetingDay.HasValue) _firstInstallmentDate = GetMeetingDate(_firstInstallmentDate, meetingDay); _alignAlignDisbursementDate = CalculateAlignDisbursementDate(_firstInstallmentDate); //with this constructor, installment are directly calculated when a new CreditContract is instanciated _installmentList = CalculateInstallments(true); EntryFeesPercentage = pAckage.EntryFeesPercentage; }
public void Get_BalanceMin_At_Date() { CompulsorySavingsProduct product = new CompulsorySavingsProduct(); CompulsorySavings CompulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 1000, new DateTime(2009, 01, 01), product, null); CompulsorySavings.Withdraw(100, new DateTime(2009, 02, 02), "retrait", new User(), false); CompulsorySavings.Deposit(230, new DateTime(2009, 02, 02), "depot", new User(), false, false, OSavingsMethods.Cash); Assert.AreEqual(CompulsorySavings.GetBalanceMin(new DateTime(2009, 01, 01)), 1000); Assert.AreEqual(CompulsorySavings.GetBalanceMin(new DateTime(2009, 02, 01)), 1000); Assert.AreEqual(CompulsorySavings.GetBalanceMin(new DateTime(2009, 02, 02)), 900); }
private static Loan _SetContract(OLoanTypes pLoansType, NonRepaymentPenalties pNonRepaymentPenalties, bool pKeepExpectedInstallment) { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = pLoansType, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1, UseCents = true }, RoundingType = ORoundingType.Approximate }; package.KeepExpectedInstallment = pKeepExpectedInstallment; 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.AnticipatedTotalRepaymentPenalties = 0.01; myContract.NonRepaymentPenalties = pNonRepaymentPenalties; return(myContract); }
public void Get_Set_InterestRate() { double interestRate = 2.0; CompulsorySavings CompulsorySavings = new CompulsorySavings(ApplicationSettings.GetInstance(""), ChartOfAccounts.GetInstance(new User()), new User(), 12m, TimeProvider.Today, null) { InterestRate = interestRate }; Assert.AreEqual(interestRate, CompulsorySavings.InterestRate); }