public TransactionLogoCalculator(string connectionString, Dictionary <string, Logo> logoOverrides) { _connectionString = connectionString; _transactionsDataService = new FinanceAPIMongoDataService.DataService.TransactionsDataService(_connectionString); _clientDataService = new FinanceAPIMongoDataService.DataService.ClientDataService(_connectionString); _logoOverrides = logoOverrides; }
public TransactionViewModel(IMvxMessenger messenger, IDialogService dialogService, ITransactionsDataService transactionsDataService) : base(messenger) { _transactionsDataService = transactionsDataService; _dialogService = dialogService; }
public AccountProcessor(string connectionString) { _connectionString = connectionString; _accountDataService = new FinanceAPIMongoDataService.DataService.AccountDataService(_connectionString); _transactionDataService = new FinanceAPIMongoDataService.DataService.TransactionsDataService(_connectionString); _datafeedDataService = new FinanceAPIMongoDataService.DataService.DatafeedDataService(_connectionString); }
public TransactionsController( ICategoriesDataService categoriesDataService, ILogger <TransactionsController> logger, ITransactionsDataService transactionsDataService) { if (categoriesDataService is null) { throw new ArgumentNullException(nameof(categoriesDataService)); } if (logger is null) { throw new ArgumentNullException(nameof(logger)); } if (transactionsDataService is null) { throw new ArgumentNullException(nameof(transactionsDataService)); } _categoriesDataService = categoriesDataService; _logger = logger; _transactionsDataService = transactionsDataService; }
public DemoClearDownTask(IOptions <TaskSettings> settings) : base(settings) { _settings = settings.Value; _transactionsDataService = new FinanceAPIMongoDataService.DataService.TransactionsDataService(_settings.MongoDB_ConnectionString); _clientDataService = new FinanceAPIMongoDataService.DataService.ClientDataService(_settings.MongoDB_ConnectionString); }
public TransactionsApiController(ITransactionsDataService transactionsDataService) { _transactionsDataService = transactionsDataService; }
public TransactionsHistoryViewModel(IMvxMessenger messenger, ITransactionsDataService transactionsDataService) : base(messenger) { _transactionsDataService = transactionsDataService; _token = messenger.Subscribe <ReceiveNewTransactionMessage>(OnReloadData); }
public override void Execute(Task task) { Task = task; var args = Task.Data; _datafeedDataService = new FinanceAPIMongoDataService.DataService.DatafeedDataService(Settings.MongoDB_ConnectionString); _accountDataService = new FinanceAPIMongoDataService.DataService.AccountDataService(Settings.MongoDB_ConnectionString); _transactionDataService = new FinanceAPIMongoDataService.DataService.TransactionsDataService(Settings.MongoDB_ConnectionString); if (string.IsNullOrEmpty(args["AccountID"].ToString())) { base.Execute(Task); return; } string accountID = args["AccountID"].ToString(); if (!_accountDataService.GetAccounts(Task.ClientID).Any(a => a.ID == accountID)) { base.Execute(Task); return; } List <ExternalAccount> externalAccounts = _datafeedDataService.GetExternalAccounts(Task.ClientID, accountID); Account account = _accountDataService.GetAccountById(accountID, Task.ClientID); IDatafeedAPI datafeedApi = new TrueLayerAPI(Settings.MongoDB_ConnectionString, Settings.TrueLayer_ClientID, Settings.TrueLayer_ClientSecret, Settings.TrueLayer_Mode); if (account == null || externalAccounts.Count == 0) { base.Execute(Task); return; } AccountSettings accountSettings = _accountDataService.GetAccountSettings(accountID); decimal totalAccountBalance = 0; decimal totalAvailableAccountBalance = 0; foreach (var externalAccount in externalAccounts) { totalAccountBalance += ProcessExternalAccount(externalAccount, datafeedApi, account, out decimal availableBalance); totalAvailableAccountBalance += availableBalance; } // Reload account to get new balance account = _accountDataService.GetAccountById(accountID, Task.ClientID); if (accountSettings != null && accountSettings.GenerateAdjustments) { BalanceAccount(account, totalAccountBalance); } // Enqueue task to calculate logos on new transactions Task logoTask = new Task($"Logo Calculator [{account.AccountName}]", Task.ClientID, TaskType.LogoCalculator, DateTime.Now); logoTask.Data = new Dictionary <string, object> { { "ClientID", Task.ClientID }, { "AccountID", accountID } }; // Set Account Last Refreshed Date _accountDataService.UpdateLastRefreshedDate(accountID, DateTime.Now); BackgroundJob.Enqueue <LogoCalculatorTask>(t => t.Execute(logoTask)); base.Execute(Task); }
public TransactionProcessor(string connectionString, TransactionLogoCalculator logoCalculator) { _connectionString = connectionString; _logoCalculator = logoCalculator; _transactionDataService = new FinanceAPIMongoDataService.DataService.TransactionsDataService(_connectionString); }