public CreateAccount(string accountNumber, AccountBoardingModel boardingModel) { _RequestedOn = DateTime.Now; _UniqueGuid = Guid.NewGuid(); AccountNumber = accountNumber; BoardingModel = boardingModel; }
public SpinUpAccountActor( string portfolio, string accountNumber, List <MaintenanceFee> oligations, IActorRef supervisor, AccountBoardingModel boardingModel) { Portfolio = portfolio; AccountNumber = accountNumber; Obligations = oligations; Supervisor = supervisor; BoardingModel = boardingModel; }
private void GetAccountsForClient(string clientsFilePath, string obligationsFilePath) { try { _log.Info($"Gonna try to open file {clientsFilePath}"); if (File.Exists(clientsFilePath)) { var readText = File.ReadAllLines(clientsFilePath, Encoding.UTF8); _log.Info($"There are {readText.Length} accounts in {clientsFilePath}"); foreach (var row in readText) { if (row.Length > 11) { var line = row.ToUpper().Split('\t'); if (line.Length < 7) { throw new Exception( $"Row: {row} in {clientsFilePath} does not have 7 tab-separated columns. It has {line.Length}."); } var portfolioName = new PortfolioName(line[0]); var accountNumber = new AccountNumber(line[1]); var userName = line[2]; double balance; double.TryParse(line[3], out balance); var inventroy = line[4]; var daysDelinquent = double.Parse(line[5]); var lastPaymentAmount = 100.0; var lastPaymentDate = DateTime.Now.AddDays(-10); if (daysDelinquent > 0.0) { lastPaymentAmount = 55.0; lastPaymentDate = DateTime.Now.AddDays(-1 * daysDelinquent); } var delinquentAmount = double.Parse(line[6]); var accountBoarded = new AccountBoardingModel ( line[0], accountNumber, balance, inventroy, userName, lastPaymentAmount: lastPaymentAmount, lastPaymentDate: lastPaymentDate ); if (_accountsInPortfolio.ContainsKey(portfolioName)) { var existingAccounts = _accountsInPortfolio[portfolioName]; existingAccounts.Add(accountNumber, accountBoarded); _accountsInPortfolio[portfolioName] = existingAccounts; } else { var accounts = new Dictionary <AccountNumber, AccountBoardingModel>(); accounts.Add(accountNumber, accountBoarded); _accountsInPortfolio.Add(portfolioName, accounts); } } } _log.Info($"Successfully processing file {clientsFilePath}"); GetObligationsForClient(obligationsFilePath); } else { throw new FileNotFoundException(clientsFilePath); } } catch (Exception e) { _log.Error($"[GetAccountsForClient]: {e.Message} {e.StackTrace}"); Sender.Tell(new FailedToLoadAccounts($"{e.Message} {e.StackTrace}")); } }