Beispiel #1
0
        }        //Execute

        private ActionResult HandleOneAssignedToLoanInvestor(SafeReader sr, bool bRowSetStart)
        {
            try {
                int     repaymentBankAccountID      = sr["RepaymentBankAccountID"];
                decimal investmentPercent           = sr["InvestmentPercent"];
                decimal?discountServicingFeePercent = sr["DiscountServicingFeePercent"];
                decimal servicingFeePercent         = ConfigManager.CurrentValues.Instance.InvestorServicingFeePercent;
                if (discountServicingFeePercent.HasValue && discountServicingFeePercent.Value > 0)
                {
                    servicingFeePercent = servicingFeePercent * (1 - discountServicingFeePercent.Value);
                }

                var servicingFeeAmount    = this.amount * investmentPercent * servicingFeePercent;
                var investorRepaymentPart = this.amount * investmentPercent - servicingFeeAmount;

                AddInvestorSystemBalance addSystemBalance = new AddInvestorSystemBalance(repaymentBankAccountID,
                                                                                         this.now,
                                                                                         investorRepaymentPart,
                                                                                         servicingFeeAmount,
                                                                                         null,
                                                                                         this.loanID,
                                                                                         this.loanTransactionID,
                                                                                         "Repayment",
                                                                                         this.userID,
                                                                                         this.transactionDate
                                                                                         );
                addSystemBalance.Execute();
            } catch (Exception ex) {
                Log.Error(ex, "failed to add system balance for repayment {0} of loan {1} for investor {2}",
                          this.loanTransactionID, this.loanID, sr["InvestorID"]);
            }
            return(ActionResult.Continue);
        }        //HandleOneAssignedToOfferInvestor
Beispiel #2
0
        }        //Execute

        private ActionResult HandleOneAssignedToOfferInvestor(SafeReader sr, bool bRowSetStart)
        {
            try {
                int       fundingBankAccountID = sr["InvestorBankAccountID"];
                decimal   approvedSum          = sr["ManagerApprovedSum"];
                decimal   investmentPercent    = sr["InvestmentPercent"];
                int       currentInvestorID    = sr["InvestorID"];
                const int negative             = -1;

                AddInvestorSystemBalance addSystemBalance = new AddInvestorSystemBalance(fundingBankAccountID,
                                                                                         this.now,
                                                                                         approvedSum * investmentPercent * negative,
                                                                                         null,
                                                                                         this.cashRequestID,
                                                                                         null,
                                                                                         null,
                                                                                         "Offer was approved",
                                                                                         this.userID,
                                                                                         this.now);
                addSystemBalance.Execute();

                var notifyInvestor = new NotifyInvestorUtilizedFunds(currentInvestorID);
                notifyInvestor.Execute();
            } catch (Exception ex) {
                Log.Warn(ex, "failed to add system balance for approved cash request {0} for investor {1}",
                         this.cashRequestID, sr["InvestorID"]);
            }
            return(ActionResult.Continue);
        }        //HandleOneAssignedToOfferInvestor
        }        //MarkOfferAsExpired

        public int UpdateSystemBalance(int?investorID, int?fundingBankAccountID, decimal creditSum, decimal investmentPercent, long cashRequestID)
        {
            if (investorID.HasValue && fundingBankAccountID.HasValue)
            {
                var addInvestorSystemBalance = new AddInvestorSystemBalance(fundingBankAccountID.Value, this.now, creditSum * investmentPercent,
                                                                            null, cashRequestID, null, null, "Offer expired", 1, this.now);
                addInvestorSystemBalance.Execute();
                return(addInvestorSystemBalance.SystemBalanceID);
            }
            return(0);
        }        //UpdateSystemBalance
Beispiel #4
0
        public override void Execute()
        {
            try {
                if (this.bankAccountTypeID == (int)I_InvestorAccountTypeEnum.Funding)
                {
                    this.systemBalanceTransactionSign = 1;
                    this.bankAccountType = I_InvestorAccountTypeEnum.Funding;
                }


                if (this.bankAccountTypeID == (int)I_InvestorAccountTypeEnum.Repayments)
                {
                    this.systemBalanceTransactionSign = -1;
                    this.bankAccountType = I_InvestorAccountTypeEnum.Repayments;
                }

                AddInvestorSystemBalance changeSystemBalance = new AddInvestorSystemBalance(this.investorAccountID,
                                                                                            this.now,
                                                                                            this.transactionAmount * this.systemBalanceTransactionSign,
                                                                                            null,
                                                                                            null,
                                                                                            null,
                                                                                            null,
                                                                                            this.transactionComment,
                                                                                            this.underwriterID,
                                                                                            this.transactionDate);
                changeSystemBalance.Execute();

                AddInvestorBankAccountBalance addBankAccountBalance = new AddInvestorBankAccountBalance(this.investorAccountID,
                                                                                                        this.now,
                                                                                                        this.transactionAmount,
                                                                                                        this.underwriterID,
                                                                                                        this.transactionComment,
                                                                                                        this.transactionDate,
                                                                                                        this.bankTransactionRef);
                addBankAccountBalance.Execute();
            } catch (Exception ex) {
                Log.Warn(ex, "Failed to execute {0} transfer of £{1} for investor bank account {2} into DB", this.bankAccountType, this.transactionAmount, this.investorAccountID);
                Result = false;
                throw;
            }

            Result = true;
            Log.Info("Executing {0} transfer of £{1} for investor bank account {2} into DB complete.", this.bankAccountType, this.transactionAmount, this.investorAccountID);
        }        //Execute