예제 #1
0
 public void Get_Code()
 {
     SavingInitialDepositEvent savingInitialDeposit = new SavingInitialDepositEvent();
     Assert.AreEqual("SVIE", savingInitialDeposit.Code);
     SavingDepositEvent savingDeposit = new SavingDepositEvent();
     Assert.AreEqual("SVDE", savingDeposit.Code);
     SavingWithdrawEvent savingWithDraw = new SavingWithdrawEvent();
     Assert.AreEqual("SVWE", savingWithDraw.Code);
     SavingInterestsAccrualEvent savingAccrualInterest = new SavingInterestsAccrualEvent();
     Assert.AreEqual("SIAE", savingAccrualInterest.Code);
     SavingInterestsPostingEvent savingPostingInterest = new SavingInterestsPostingEvent();
     Assert.AreEqual("SIPE", savingPostingInterest.Code);
     SavingCreditTransferEvent savingCreditTransfer = new SavingCreditTransferEvent();
     Assert.AreEqual("SCTE", savingCreditTransfer.Code);
     SavingDebitTransferEvent savingDebitTransfer = new SavingDebitTransferEvent();
     Assert.AreEqual("SDTE", savingDebitTransfer.Code);
 }
예제 #2
0
        public override List<SavingEvent> DebitTransfer(OCurrency pAmount, ISavingsContract pCreditAccount, DateTime pDate, 
            string pDescription, User pUser, bool pIsDesactivateFees)
        {
            List<SavingEvent> events = new List<SavingEvent>();
            SavingDebitTransferEvent transferEvent = new SavingDebitTransferEvent
            {
                Amount = pAmount,
                Date = pDate,
                Description = pDescription,
                User = pUser,
                Cancelable = false,
                RelatedContractCode = pCreditAccount.Code,
                ProductType = typeof(SavingsBookProduct)
            }; 
            events.Add(transferEvent);
            Events.Add(transferEvent);

            if (Status != OSavingsStatus.Closed && !pIsDesactivateFees)
                    transferEvent.Fee = Product.TransferFeesType == OSavingsFeesType.Flat ? FlatTransferFees : pAmount * RateTransferFees.Value;

            return events;
        }
예제 #3
0
        public virtual List<SavingEvent> DebitTransfer(OCurrency pAmount, ISavingsContract pCreditAccount, DateTime pDate, string pDescription, User pUser, bool pIsDesactivateFees)
        {
            List<SavingEvent> events = new List<SavingEvent>();
            SavingDebitTransferEvent transferEvent = new SavingDebitTransferEvent
            {
                Amount = pAmount,
                Date = pDate,
                Description = pDescription,
                User = pUser,
                Cancelable = false,
                RelatedContractCode = pCreditAccount.Code,
                ProductType = Product.GetType(),
                ContracId = Id
            };
            events.Add(transferEvent);
            Events.Add(transferEvent);

            return events;
        }
예제 #4
0
 public virtual SavingEvent DebitTransfer(ISavingsContract to, OCurrency amount, OCurrency fee, DateTime date, string description)
 {
     SavingTransferEvent e;
     bool ib = Branch.Id != to.Branch.Id; // inter-branch
     if (ib)
     {
         e = new SavingDebitInterBranchTransferEvent();
     }
     else
     {
         e = new SavingDebitTransferEvent();
     }
     e.Description = ib ? "Inter-branch transfer" : "Transfer";
     e.RelatedContractCode = to.Code;
     e.Amount = amount;
     e.Fee = fee;
     e.Date = date;
     e.User = User.CurrentUser;
     e.Description = description;
     e.ProductType = Product.GetType();
     e.Target = this;
     Events.Add(e);
     return e;
 }
예제 #5
0
 private static SavingEvent GetSavingsEvent(string code)
 {
     SavingEvent e;
     switch (code)
     {
         case OSavingEvents.Deposit:
             e = new SavingDepositEvent();
             break;
         case OSavingEvents.Withdraw:
             e = new SavingWithdrawEvent();
             break;
         case OSavingEvents.Accrual:
             e = new SavingInterestsAccrualEvent();
             break;
         case OSavingEvents.Posting:
             e = new SavingInterestsPostingEvent();
             break;
         case OSavingEvents.InitialDeposit:
             e = new SavingInitialDepositEvent();
             break;
         case OSavingEvents.CreditTransfer:
             e = new SavingCreditTransferEvent();
             break;
         case OSavingEvents.DebitTransfer:
             e = new SavingDebitTransferEvent();
             break;
         case OSavingEvents.ManagementFee:
             e = new SavingManagementFeeEvent();
             break;
         case OSavingEvents.SavingClosure:
             e = new SavingClosureEvent();
             break;
         case OSavingEvents.Close:
             e = new SavingCloseEvent();
             break;
         case OSavingEvents.OverdraftFees:
             e = new SavingOverdraftFeeEvent();
             break;
         case OSavingEvents.Agio:
             e = new SavingAgioEvent();
             break;
         case OSavingEvents.PendingDeposit:
             e = new SavingPendingDepositEvent();
             break;
         case OSavingEvents.Reopen:
             e = new SavingReopenEvent();
             break;
         case OSavingEvents.PendingDepositRefused:
             e = new SavingPendingDepositRefusedEvent();
             break;
         case OSavingEvents.SpecialOperationCredit:
             e = new SavingCreditOperationEvent();
             break;
         case OSavingEvents.SpecialOperationDebit:
             e = new SavingDebitOperationEvent();
             break;
         case OSavingEvents.InterBranchCreditTransfer:
             e = new SavingCreditInterBranchTransferEvent();
             break;
         case OSavingEvents.InterBranchDebitTransfer:
             e = new SavingDebitInterBranchTransferEvent();
             break;
         case OSavingEvents.LoanDisbursement:
             e = new SavingLoanDisbursementEvent();
             break;
         case OSavingEvents.SavingLoanRepayment:
             e = new LoanRepaymentFromSavingEvent();
             break;
         case OSavingEvents.BlockCompulsarySavings:
             e = new SavingBlockCompulsarySavingsEvent();
             break;
         case OSavingEvents.UnblockCompulsorySavings:
             e = new SavingUnblockCompulsorySavingsEvent();
             break;
         default:
             Debug.Fail("Failed to create saving event object");
             throw new Exception();
     }
     return e;
 }
예제 #6
0
 public void Get_Set_RelatedAccountCode()
 {
     SavingDebitTransferEvent event1 = new SavingDebitTransferEvent { RelatedContractCode = "CODE/RELATED/ACCOUNT/1" };
     Assert.AreEqual("CODE/RELATED/ACCOUNT/1", event1.RelatedContractCode);
     SavingCreditTransferEvent event2 = new SavingCreditTransferEvent { RelatedContractCode = "CODE/RELATED/ACCOUNT/2" };
     Assert.AreEqual("CODE/RELATED/ACCOUNT/2", event2.RelatedContractCode);
 }
예제 #7
0
        private static Event GetSavingEvent(OpenCbsReader r)
        {
            SavingEvent e;

            switch (r.GetString("code"))
            {
                case OSavingEvents.Deposit:
                    e = new SavingDepositEvent();
                    break;
                case OSavingEvents.Withdraw:
                    e = new SavingWithdrawEvent();
                    break;
                case OSavingEvents.InitialDeposit:
                    e = new SavingInitialDepositEvent();
                    break;
                case OSavingEvents.CreditTransfer:
                    e = new SavingCreditTransferEvent();
                    break;
                case OSavingEvents.DebitTransfer:
                    e = new SavingDebitTransferEvent();
                    break;
                case OSavingEvents.SpecialOperationCredit:
                    e = new SavingCreditOperationEvent();
                    break;
                case OSavingEvents.SpecialOperationDebit:
                    e = new SavingDebitOperationEvent();
                    break;
                case OSavingEvents.InterBranchCreditTransfer:
                    e = new SavingCreditInterBranchTransferEvent();
                    break;
                case OSavingEvents.InterBranchDebitTransfer:
                    e = new SavingDebitInterBranchTransferEvent();
                    break;
                default:
                    throw new Exception();
            }

            e.Amount = r.GetMoney("se_amount");
            if (e is ISavingsFees)
                ((ISavingsFees)e).Fee = r.GetMoney("se_fees");
            if (e is SavingTransferEvent)
                ((SavingTransferEvent)e).RelatedContractCode = r.GetString("se_transfer_code");

            return e;
        }