private void LoadNormalTransferFee()
        {
            if (!(_saving.Product is SavingsBookProduct))
            {
                return;
            }

            SavingsBookProduct p = (SavingsBookProduct)_saving.Product;

            if (p.FlatTransferFees.HasValue || p.FlatTransferFeesMin.HasValue)
            {
                if (p.FlatTransferFees.HasValue)
                {
                    _feesMin = _feesMax = p.FlatTransferFees;
                }
                else
                {
                    _feesMin = p.FlatTransferFeesMin;
                    _feesMax = p.FlatTransferFeesMax;
                }
            }
            else
            {
                if (p.RateTransferFees.HasValue)
                {
                    _feesMin = _feesMax = (decimal)p.RateTransferFees * 100;
                }
                else
                {
                    _feesMin = (decimal)p.RateTransferFeesMin * 100;
                    _feesMax = (decimal)p.RateTransferFeesMax * 100;
                }
            }
        }
Esempio n. 2
0
        public void CalculateInterest_OneMonth_Withdraw()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase  = OSavingCalculAmountBase.MinimalAmount,
                WithdrawFeesType  = OSavingsFeesType.Flat,
                FlatWithdrawFees  = 0
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 01), null)
            {
                Product = product, InterestRate = 0.1, FlatWithdrawFees = 0
            };

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

            saving.Withdraw(100, new DateTime(2009, 01, 15), "depot", new User(), false, null);

            List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>();

            list = saving.CalculateInterest(new DateTime(2009, 02, 01), new User {
                Id = 1
            });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 90);
        }
Esempio n. 3
0
        public void PostingInterests_OnePosting()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfYear
            };

            SavingBookContract saving = new SavingBookContract(
                ApplicationSettings.GetInstance(""),
                new User(),
                new DateTime(2009, 01, 01),
                null)
            {
                Product      = product,
                InterestRate = 0.1
            };

            List <SavingInterestsPostingEvent> list = new List <SavingInterestsPostingEvent>();

            list = saving.PostingInterests(new DateTime(2010, 01, 01), new User {
                Id = 1
            });

            Assert.AreEqual(list.Count, 1);
        }
Esempio n. 4
0
        public void CalculateInterest_ThirtyDay()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfYear
            };
            SavingBookContract saving = new SavingBookContract(
                ApplicationSettings.GetInstance(""),
                new User(),
                new DateTime(2009, 01, 01),
                null)
            {
                Product = product, InterestRate = 0.1
            };

            List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>();

            list = saving.CalculateInterest(new DateTime(2009, 01, 31), new User {
                Id = 1
            });

            Assert.AreEqual(31, list.Count);
        }
        private void nudAmount_ValueChanged(object sender, EventArgs e)
        {
            try
            {
                _amount = nudAmount.Value;
                bool isFlat = false;

                if (_saving is SavingBookContract)
                {
                    SavingsBookProduct p = (SavingsBookProduct)_saving.Product;
                    if (IsNormalTransfer())
                    {
                        isFlat = p.FlatTransferFees.HasValue || p.FlatTransferFeesMin.HasValue;
                    }
                    else
                    {
                        isFlat = p.InterBranchTransferFee.IsFlat;
                    }
                }
                if (_bookingDirection == OSavingsOperation.Credit)
                {
                    isFlat = true;
                }
                OCurrency fee = isFlat ? updAmountFees.Value : _amount * updAmountFees.Value / 100;
                nudTotalAmount.Value = (_amount + fee).Value;
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
Esempio n. 6
0
        public void PostingInterests_NoPosting()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfMonth,
                Periodicity       = new InstallmentType("Monthly", 0, 1)
            };

            SavingBookContract saving = new SavingBookContract(
                ApplicationSettings.GetInstance(""),
                new User(),
                new DateTime(2009, 01, 01),
                null)
            {
                Product      = product,
                InterestRate = 0.1,
                NextMaturity = new DateTime(2009, 01, 01)
            };

            List <SavingInterestsPostingEvent> list = new List <SavingInterestsPostingEvent>();

            list = saving.PostingInterests(new DateTime(2009, 01, 02), new User {
                Id = 1
            });

            Assert.AreEqual(0, list.Count);
        }
Esempio n. 7
0
        public void PostingInterests_OnePosting()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfDay,
                Periodicity       = new InstallmentType("Daily", 1, 0)
            };
            SavingBookContract saving = new SavingBookContract(
                ApplicationSettings.GetInstance(""),
                new User(),
                new DateTime(2009, 01, 01), null)
            {
                Product      = product,
                InterestRate = 0.1
            };

            saving.NextMaturity = saving.CreationDate;
            List <SavingInterestsPostingEvent> list = new List <SavingInterestsPostingEvent>();

            list = saving.PostingInterests(
                saving.NextMaturity.Value,
                new User {
                Id = 1
            }
                );

            Assert.AreEqual(1, list.Count);
        }
Esempio n. 8
0
        public void CalculateInterest_OneWeek()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Weekly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase  = OSavingCalculAmountBase.MinimalAmount
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 05), null)
            {
                Product = product, InterestRate = 0.1
            };

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

            List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>();

            list = saving.CalculateInterest(new DateTime(2009, 01, 12), new User {
                Id = 1
            });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 100);
        }
Esempio n. 9
0
        public void Test_RetrieveForSavings()
        {
            SavingsBookProduct savingsBookProduct = new SavingsBookProduct()
            {
                Id = 1
            };

            Person person = new Person
            {
                FirstName = "Michael",
                LastName  = "Krejci",
                Activity  = new EconomicActivity(1, "Agriculture", null, false)
            };

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User(),
                                                               savingsBookProduct);

            person.Savings.Add(saving);

            Account specficAccount = _rules.GetSpecificAccount(OAccounts.CASH_CREDIT, saving, OBookingDirections.Both);

            Assert.AreEqual(null, specficAccount);

            specficAccount = _rules.GetSpecificAccount(OAccounts.CASH, saving, OBookingDirections.Both);
            Assert.AreEqual("1020", specficAccount.Number);
        }
Esempio n. 10
0
        public void CalculateInterest_TwoOperation_In_OneDay()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Weekly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase  = OSavingCalculAmountBase.MinimalAmount,
                WithdrawFeesType  = OSavingsFeesType.Flat,
                FlatWithdrawFees  = 0
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 01), null)
            {
                Product = product, InterestRate = 0.1, FlatWithdrawFees = 0
            };

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

            saving.Withdraw(250, new DateTime(2009, 01, 02), "retrait", new User(), false, null);
//            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OSavingsMethods.Cash, null, null);

            List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>();

            list = saving.CalculateInterest(new DateTime(2009, 01, 08), new User {
                Id = 1
            });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 75);
        }
Esempio n. 11
0
        public void TestAddSavingBookProduct()
        {
            SavingsBookProduct savingsProduct = new SavingsBookProduct
            {
                Name                = "Good savings account",
                Code                = "P123",
                InitialAmountMin    = 100,
                InitialAmountMax    = 200,
                DepositMin          = 250,
                DepositMax          = 400,
                WithdrawingMin      = 400,
                WithdrawingMax      = 450,
                TransferMin         = 100,
                TransferMax         = 500,
                InterestRateMin     = 0.12,
                InterestRateMax     = 0.20,
                BalanceMin          = 1000,
                BalanceMax          = 2000,
                InterestBase        = OSavingInterestBase.Daily,
                InterestFrequency   = OSavingInterestFrequency.EndOfYear,
                EntryFeesMin        = 10,
                EntryFeesMax        = 20,
                WithdrawFeesType    = OSavingsFeesType.Flat,
                FlatWithdrawFeesMin = 1,
                FlatWithdrawFeesMax = 5,
                TransferFeesType    = OSavingsFeesType.Flat,
                FlatTransferFeesMin = 1,
                FlatTransferFeesMax = 5,
                DepositFeesMin      = 1,
                DepositFeesMax      = 5,
                CloseFeesMin        = 2,
                CloseFeesMax        = 7,
                ManagementFeesMin   = 4,
                ManagementFeesMax   = 16,
                OverdraftFeesMin    = 2,
                OverdraftFeesMax    = 6,
                AgioFeesMin         = 1,
                AgioFeesMax         = 4,
                Currency            = new Currency {
                    Id = 1
                }
            };

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

            savingsProduct.ManagementFeeFreq = managementFeeFreq;

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

            savingsProduct.AgioFeesFreq = agioFeeFreq;

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

            Assert.Greater(savingsProduct.Id, 0);
        }
Esempio n. 12
0
        public void Get_Set_CalculAmountBase()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount
            };

            Assert.AreEqual(OSavingCalculAmountBase.MinimalAmount, product.CalculAmountBase);
        }
Esempio n. 13
0
        public void Get_Set_InitialAmountMax()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                InitialAmountMax = 300m
            };

            Assert.AreEqual(300m, savings.InitialAmountMax.Value);
        }
Esempio n. 14
0
        public void Get_Set_InitialAmountMin()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                InitialAmountMin = 150m
            };

            Assert.AreEqual(150m, savings.InitialAmountMin.Value);
        }
Esempio n. 15
0
        public void Get_Set_ClientType()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                ClientType = OClientTypes.Person
            };

            Assert.AreEqual(OClientTypes.Person, savings.ClientType);
        }
Esempio n. 16
0
        public void Get_Set_Code()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                Code = "Saving Product Code"
            };

            Assert.AreEqual("Saving Product Code", savings.Code);
        }
Esempio n. 17
0
        public void Get_Set_RateWithdrawFeesMin()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                RateWithdrawFeesMin = 0.01d
            };

            Assert.AreEqual(0.01d, product.RateWithdrawFeesMin.Value);
        }
Esempio n. 18
0
        public void Get_Set_RateTransferFeesMax()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                RateTransferFeesMax = 0.10d
            };

            Assert.AreEqual(0.10d, product.RateTransferFeesMax.Value);
        }
Esempio n. 19
0
        public void Get_Set_RateTransferFees()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                RateTransferFees = 0.05d
            };

            Assert.AreEqual(0.05d, product.RateTransferFees.Value);
        }
Esempio n. 20
0
        public void Get_Set_FlatTransferFees()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                FlatTransferFees = 25m
            };

            Assert.AreEqual(25m, product.FlatTransferFees.Value);
        }
Esempio n. 21
0
        public void Get_Set_Delete()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                Delete = true
            };

            Assert.IsTrue(savings.Delete);
        }
Esempio n. 22
0
        public void Get_Set_FlatTransferFeesMax()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                FlatTransferFeesMax = 50m
            };

            Assert.AreEqual(50m, product.FlatTransferFeesMax.Value);
        }
Esempio n. 23
0
        public void Get_Set_FlatTransferFeesMin()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                FlatTransferFeesMin = 10m
            };

            Assert.AreEqual(10m, product.FlatTransferFeesMin.Value);
        }
Esempio n. 24
0
        public void Get_Set_TransferFeesType()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                TransferFeesType = OSavingsFeesType.Flat
            };

            Assert.AreEqual(OSavingsFeesType.Flat, product.TransferFeesType);
        }
Esempio n. 25
0
        public void Get_Set_InterestBase()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                InterestBase = OSavingInterestBase.Monthly
            };

            Assert.AreEqual(OSavingInterestBase.Monthly, product.InterestBase);
        }
Esempio n. 26
0
        public void Get_Set_WithdrawFeesType()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                WithdrawFeesType = OSavingsFeesType.Flat
            };

            Assert.AreEqual(OSavingsFeesType.Flat, product.WithdrawFeesType);
        }
Esempio n. 27
0
        public void Get_Set_Name()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                Name = "Saving Product Name"
            };

            Assert.AreEqual("Saving Product Name", savings.Name);
        }
Esempio n. 28
0
        public void Get_Set_InterestFrequency()
        {
            SavingsBookProduct product = new SavingsBookProduct {
                InterestFrequency = OSavingInterestFrequency.EndOfWeek
            };

            Assert.AreEqual(OSavingInterestFrequency.EndOfWeek, product.InterestFrequency);
        }
Esempio n. 29
0
        public void Get_Set_Id()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                Id = 1
            };

            Assert.AreEqual(1, savings.Id);
        }
Esempio n. 30
0
        public void Get_Set_InterestRateMax()
        {
            SavingsBookProduct savings = new SavingsBookProduct {
                InterestRateMax = .55d
            };

            Assert.AreEqual(.55d, savings.InterestRateMax);
        }