Exemple #1
0
        public void AddSavingBook()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User()
            {
                Id = 1
            }, new DateTime(2009, 01, 01), _savingsBookProduct, null)
            {
                Code = "S/CR/2009/SAVIN-1/BAR-1", Status = OSavingsStatus.Active, InterestRate = 0.01, FlatWithdrawFees = 3, FlatTransferFees = 3
            };

            saving.InitialAmount = 1000;
            saving.EntryFees     = 10;
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            User user = new User {
                Id = 1
            };

            saving.Events[0].User = user;
            saving.Events[0].Id   = 400;
            saving.SavingsOfficer = user;
            saving.Id             = _savingManager.Add(saving, new Person {
                Id = 6
            });
            _savingEventManager.Add(saving.Events[0], saving.Id);

            SavingBookContract retrievedSaving = (SavingBookContract)_savingManager.Select(saving.Id);

            _compareSavings(saving, retrievedSaving);
        }
        protected override void SetUp()
        {
            base.SetUp();

            ChartOfAccounts.SuppressAll();

            _savingManager      = (SavingManager)container["SavingManager"];
            _savingEventManager = (SavingEventManager)container["SavingEventManager"];

            _client = new Person {
                Id = 6
            };
            _user = new User {
                Id = 1
            };
            User.CurrentUser = _user;
            _product         = new SavingsBookProduct
            {
                Id                = 1,
                Name              = "SavingProduct1",
                InitialAmountMin  = 100,
                InitialAmountMax  = 500,
                BalanceMin        = 0,
                BalanceMax        = 1000,
                WithdrawingMin    = 100,
                WithdrawingMax    = 150,
                DepositMin        = 200,
                DepositMax        = 250,
                TransferMin       = 100,
                TransferMax       = 200,
                InterestRateMin   = 0.2,
                InterestRateMax   = 0.3,
                InterestBase      = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfMonth,
                Currency          = new Currency {
                    Id = 1
                },
                WithdrawFeesType = OSavingsFeesType.Flat,
                FlatWithdrawFees = 10,
                TransferFeesType = OSavingsFeesType.Rate,
                RateTransferFees = 0.1
            };

            _saving = new SavingBookContract(ApplicationSettings.GetInstance(""), _user, new DateTime(2009, 01, 01), _product, null)
            {
                Code             = "S/CR/2009/SAVIN-1/BAR-1",
                InterestRate     = 0.2,
                FlatWithdrawFees = 10,
                RateTransferFees = 0.1
            };
            _saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            _savingTarget = _saving = new SavingBookContract(ApplicationSettings.GetInstance(""), _user, new DateTime(2009, 01, 01), _product, null)
            {
                Code         = "S/CR/2009/SAVIN-1/BAR-2",
                InterestRate = 0.2,
            };

            _saving.InitialAmount   = 1000;
            _saving.EntryFees       = 10;
            _saving.SavingsOfficer  = _user;
            _saving.NumberOfPeriods = 0;
            _saving.Id       = _savingManager.Add(_saving, _client);
            _savingTarget.Id = _savingManager.Add(_savingTarget, _client);

            Branch branch = new Branch {
                Id = 1, Name = "Default", Code = "Default"
            };

            _saving.Branch       = branch;
            _savingTarget.Branch = branch;
        }
Exemple #3
0
        public void TestUpdateUsedSavingBookProduct()
        {
            Assert.Ignore(); // Ru55
            SavingsBookProduct savingsProduct = new SavingsBookProduct
            {
                Name                = "Good savings account",
                Code                = "P123",
                ClientType          = OClientTypes.All,
                InitialAmountMin    = 100,
                InitialAmountMax    = 200,
                DepositMin          = 250,
                DepositMax          = 400,
                WithdrawingMin      = 400,
                WithdrawingMax      = 450,
                TransferMin         = 100,
                TransferMax         = 300,
                InterestRateMin     = 0.12,
                InterestRateMax     = 0.20,
                BalanceMin          = 1000,
                BalanceMax          = 2000,
                InterestBase        = OSavingInterestBase.Daily,
                InterestFrequency   = OSavingInterestFrequency.EndOfYear,
                EntryFeesMin        = 10,
                EntryFeesMax        = 20,
                WithdrawFeesType    = OSavingsFeesType.Rate,
                RateWithdrawFeesMin = 0.01,
                RateWithdrawFeesMax = 0.05,
                TransferFeesType    = OSavingsFeesType.Rate,
                RateTransferFeesMin = 0.01,
                RateTransferFeesMax = 0.05,
                Currency            = new Currency {
                    Id = 1
                }
            };

            InstallmentType managementFeeFreq = new InstallmentType {
                Name = "Weekly", NbOfDays = 7, NbOfMonths = 0, Id = 1
            };

            savingsProduct.ManagementFeeFreq = managementFeeFreq;

            InstallmentType agioFeeFreq = new InstallmentType {
                Name = "Daily", NbOfDays = 1, NbOfMonths = 0, Id = 2
            };

            savingsProduct.AgioFeesFreq = agioFeeFreq;

            _savingProductManager = (SavingProductManager)container["SavingProductManager"];
            _savingProductManager.Add(savingsProduct);

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User()
            {
                Id = 1
            }, new DateTime(2009, 01, 01),
                                                               savingsProduct, null)
            {
                Code         = "S/CR/2009/P123/BAR-1",
                Status       = OSavingsStatus.Active,
                InterestRate = 0.01
            };

            _savingManager = (SavingManager)container["SavingManager"];
            _savingManager.Add(saving, new Person {
                Id = 6
            });

            SavingsBookProduct loadedProduct = _savingProductManager.SelectSavingsBookProduct(savingsProduct.Id);

            savingsProduct.Name                = "Good updating product";
            savingsProduct.ClientType          = OClientTypes.Person;
            savingsProduct.Code                = "P125";
            savingsProduct.InitialAmountMin    = 200;
            savingsProduct.InitialAmountMax    = 400;
            savingsProduct.DepositMin          = 500;
            savingsProduct.DepositMax          = 800;
            savingsProduct.WithdrawingMin      = 800;
            savingsProduct.WithdrawingMax      = 900;
            savingsProduct.TransferMin         = 500;
            savingsProduct.TransferMax         = 1000;
            savingsProduct.InterestRateMin     = 0.24;
            savingsProduct.InterestRateMax     = 0.20;
            savingsProduct.BalanceMin          = 2000;
            savingsProduct.BalanceMax          = 4000;
            savingsProduct.InterestBase        = OSavingInterestBase.Monthly;
            savingsProduct.InterestFrequency   = OSavingInterestFrequency.EndOfMonth;
            savingsProduct.EntryFees           = 15;
            savingsProduct.EntryFeesMax        = null;
            savingsProduct.EntryFeesMin        = null;
            savingsProduct.WithdrawFeesType    = OSavingsFeesType.Rate;
            savingsProduct.RateWithdrawFees    = 0.03;
            savingsProduct.RateWithdrawFeesMin = null;
            savingsProduct.RateWithdrawFeesMax = null;
            savingsProduct.FlatWithdrawFeesMin = null;
            savingsProduct.FlatWithdrawFeesMax = null;
            savingsProduct.TransferFeesType    = OSavingsFeesType.Rate;
            savingsProduct.RateTransferFees    = 0.03;
            savingsProduct.RateTransferFeesMin = null;
            savingsProduct.RateTransferFeesMax = null;
            savingsProduct.FlatTransferFeesMin = null;
            savingsProduct.FlatTransferFeesMax = null;
            savingsProduct.Currency            = new Currency {
                Id = 2
            };

            _savingProductManager.Update(savingsProduct);

            loadedProduct = _savingProductManager.SelectSavingsBookProduct(savingsProduct.Id);

            Assert.AreEqual(savingsProduct.Id, loadedProduct.Id);
            Assert.AreEqual(OClientTypes.All, loadedProduct.ClientType);
            Assert.AreEqual("Good savings account", loadedProduct.Name);
            Assert.AreEqual("P123", loadedProduct.Code);
            Assert.AreEqual(savingsProduct.BalanceMax.Value, loadedProduct.BalanceMax.Value);
            Assert.AreEqual(savingsProduct.BalanceMin.Value, loadedProduct.BalanceMin.Value);
            Assert.AreEqual(savingsProduct.InitialAmountMax.Value, loadedProduct.InitialAmountMax.Value);
            Assert.AreEqual(savingsProduct.InitialAmountMin.Value, loadedProduct.InitialAmountMin.Value);
            Assert.AreEqual(savingsProduct.DepositMax.Value, loadedProduct.DepositMax.Value);
            Assert.AreEqual(savingsProduct.DepositMin.Value, loadedProduct.DepositMin.Value);
            Assert.AreEqual(savingsProduct.WithdrawingMax.Value, loadedProduct.WithdrawingMax.Value);
            Assert.AreEqual(savingsProduct.WithdrawingMin.Value, loadedProduct.WithdrawingMin.Value);
            Assert.AreEqual(savingsProduct.TransferMin.Value, loadedProduct.TransferMin.Value);
            Assert.AreEqual(savingsProduct.TransferMax.Value, loadedProduct.TransferMax.Value);
            Assert.AreEqual(savingsProduct.InterestRate, loadedProduct.InterestRate);
            Assert.AreEqual(savingsProduct.InterestRateMax, loadedProduct.InterestRateMax);
            Assert.AreEqual(savingsProduct.InterestRateMin, loadedProduct.InterestRateMin);
            Assert.AreEqual(OSavingInterestBase.Daily, loadedProduct.InterestBase);
            Assert.AreEqual(OSavingInterestFrequency.EndOfYear, loadedProduct.InterestFrequency);
            Assert.AreEqual(savingsProduct.EntryFees, loadedProduct.EntryFees);
            Assert.AreEqual(savingsProduct.EntryFeesMax.HasValue, loadedProduct.EntryFeesMax.HasValue);
            Assert.AreEqual(savingsProduct.EntryFeesMin.HasValue, loadedProduct.EntryFeesMin.HasValue);
            Assert.AreEqual(savingsProduct.WithdrawFeesType, loadedProduct.WithdrawFeesType);
            Assert.AreEqual(savingsProduct.FlatWithdrawFees.HasValue, loadedProduct.FlatWithdrawFees.HasValue);
            Assert.AreEqual(savingsProduct.FlatWithdrawFeesMax.HasValue, loadedProduct.FlatWithdrawFeesMax.HasValue);
            Assert.AreEqual(savingsProduct.FlatWithdrawFeesMin.HasValue, loadedProduct.FlatWithdrawFeesMin.HasValue);
            Assert.AreEqual(savingsProduct.RateWithdrawFees, loadedProduct.RateWithdrawFees);
            Assert.AreEqual(savingsProduct.RateWithdrawFeesMax.HasValue, loadedProduct.RateWithdrawFeesMax.HasValue);
            Assert.AreEqual(savingsProduct.RateWithdrawFeesMin.HasValue, loadedProduct.RateWithdrawFeesMin.HasValue);
            Assert.AreEqual(savingsProduct.TransferFeesType, loadedProduct.TransferFeesType);
            Assert.AreEqual(savingsProduct.FlatTransferFees.HasValue, loadedProduct.FlatTransferFees.HasValue);
            Assert.AreEqual(savingsProduct.FlatTransferFeesMax.HasValue, loadedProduct.FlatTransferFeesMax.HasValue);
            Assert.AreEqual(savingsProduct.FlatTransferFeesMin.HasValue, loadedProduct.FlatTransferFeesMin.HasValue);
            Assert.AreEqual(savingsProduct.RateTransferFees, loadedProduct.RateTransferFees);
            Assert.AreEqual(savingsProduct.RateTransferFeesMax.HasValue, loadedProduct.RateTransferFeesMax.HasValue);
            Assert.AreEqual(savingsProduct.RateTransferFeesMin.HasValue, loadedProduct.RateTransferFeesMin.HasValue);
            Assert.AreEqual(1, loadedProduct.Currency.Id);
        }