public CreateAccountViewModel()
        {
            _navigationService  = DependencyService.Get <INavigationService>();
            _accountDataService = DependencyService.Get <IAccountDataService>();

            AddAccountToDatabaseCommand = new Command(() => AddAccountToDatabase());
        }
예제 #2
0
 public AccountProcessor(string connectionString)
 {
     _connectionString       = connectionString;
     _accountDataService     = new FinanceAPIMongoDataService.DataService.AccountDataService(_connectionString);
     _transactionDataService = new FinanceAPIMongoDataService.DataService.TransactionsDataService(_connectionString);
     _datafeedDataService    = new FinanceAPIMongoDataService.DataService.DatafeedDataService(_connectionString);
 }
예제 #3
0
 public AuthenticationService(IAccountDataService accountDataService, IDiffieHellmanKeyExchangeService keyExchangeService, IDiffieHellmanEncryptionService messageEncryptionService, IDiffieHellmanDecryptionService messageDecryptionService)
 {
     _accountDataService       = accountDataService;
     _keyExchangeService       = keyExchangeService;
     _messageEncryptionService = messageEncryptionService;
     _messageDecryptionService = messageDecryptionService;
 }
예제 #4
0
        public override void Execute(Task task)
        {
            _accountDataService  = new FinanceAPIMongoDataService.DataService.AccountDataService(Settings.MongoDB_ConnectionString);
            _datafeedDataService = new FinanceAPIMongoDataService.DataService.DatafeedDataService(Settings.MongoDB_ConnectionString);

            List <Account> accounts = _accountDataService.GetAllAccounts();

            foreach (Account account in accounts)
            {
                List <ExternalAccount> externalAccounts = _datafeedDataService.GetExternalAccounts(account.ClientID, account.ID);
                if (externalAccounts == null || externalAccounts.Count == 0)
                {
                    continue;
                }

                AccountSettings accountSettings = _accountDataService.GetAccountSettings(account.ID);
                if (accountSettings == null)
                {
                    continue;
                }

                if (ShouldRefreshAccount(accountSettings.RefreshInterval, account.LastRefreshed))
                {
                    Task refreshTask = new Task($"Account Refresh [{account.AccountName}]", account.ClientID, TaskType.AccountRefresh);
                    refreshTask.Data.Add("AccountID", account.ID);
                    BackgroundJob.Enqueue <AccountRefresh>(refresh => refresh.Execute(refreshTask));
                }
            }
        }
        public AccountsViewModel()
        {
            _navigationService  = DependencyService.Get <INavigationService>();
            _accountDataService = DependencyService.Get <IAccountDataService>();

            ShowCreateAccountViewModel = new Command(async() => await _navigationService.NavigateToCreateAccount());
            ShowAccountDetailViewModel = new Command(async() => await _navigationService.NavigateToAccountDetail(_selectedItem));
        }
예제 #6
0
 public AccountController(IAuthContext authContext, IHttpClientFactory httpClientFactory, IAccountDataService accountDataService, IIntegrationEventService integrationEventService, IServiceProvider serviceProvider, IUnitOfWork uow)
 {
     _authContext             = authContext;
     _httpClientFactory       = httpClientFactory;
     _accountDataService      = accountDataService;
     _integrationEventService = serviceProvider.GetRequiredService <IIntegrationEventService>();
     _uow = uow;
 }
예제 #7
0
 public AccountLedgersController(IAccountLedgerDataService accountLedgerData,
                                 IAccountDataService accountData,
                                 IFiscalYearDataService fiscalYearData)
 {
     _accountLedgerData = accountLedgerData;
     _accountData       = accountData;
     _fiscalYearData    = fiscalYearData;
 }
예제 #8
0
 public AccountController(
     IAccountService service,
     IUserService userService,
     IAccountDataService dataservice)
 {
     _service     = service;
     _dataservice = dataservice;
     _userService = userService;
 }
예제 #9
0
 public void Init()
 {
     customerService  = new CustomerDataService();
     accountService   = new AccountDataService();
     unit             = new UnitOfWork.UnitOfWork(customerService, accountService);
     payoff           = new UnitOfWork.Payoff(1, 300m, unit);
     accounts         = payoff.GetAccounts().ToList().OrderBy(a => a.DailyInterest()).ToList();
     payoff._Accounts = accounts;
 }
예제 #10
0
 public AccountService(IAccountDataService accountDataService, IPasswordHasher passwordHasher,
                       ITokenService tokenService, IConfiguration configuration, IMapper mapper)
 {
     _accountDataService = accountDataService;
     _passwordHasher     = passwordHasher;
     _tokenService       = tokenService;
     _configuration      = configuration;
     _mapper             = mapper;
 }
예제 #11
0
 public VouchersController(IVoucherDataService voucherData,
                           IFiscalYearDataService fiscalYearData,
                           IAccountDataService accountData,
                           IAccountLedgerDataService accountLedgerData)
 {
     _voucherData       = voucherData;
     _fiscalYearData    = fiscalYearData;
     _accountData       = accountData;
     _accountLedgerData = accountLedgerData;
 }
 public PaymentsController(IPaymentDataService paymentDataService,
                           IAccountDataService accountDataService,
                           ICategoryDataService categoryDataService,
                           UserManager <AppUser> userManager)
 {
     this.paymentDataService  = paymentDataService;
     this.accountDataService  = accountDataService;
     this.categoryDataService = categoryDataService;
     this.userManager         = userManager;
 }
예제 #13
0
        public AccountDetailViewModel(Account account)
        {
            _navigationService  = DependencyService.Get <INavigationService>();
            _accountDataService = DependencyService.Get <IAccountDataService>();

            _account = account;

            ProcessAccountPurchaseThenShowAccountsViewModel = new Command(async() => await ProcessAccountPurchase());
            ProcessAccountPaymentThenShowAccountsViewModel  = new Command(async() => await ProcessAccountPayment());
            DeleteAccountThenShowAccountsViewModel          = new Command(async() => await DeleteAccount());
            SaveChanges = new Command(async() => await _accountDataService.UpdateAccount(_account));
        }
예제 #14
0
        public AccountController(ILoginService loginService, IEmailConfirmationService emailConfirmationService,
                                 IAddUserService addUserService, ICredentialsService credentialsService, IAccountDataService accountDataService,
                                 IOptionsSnapshot <IdentityUIEndpoints> identityUIEndpoints)
        {
            _loginService             = loginService;
            _emailConfirmationService = emailConfirmationService;
            _addUserService           = addUserService;
            _credentialsService       = credentialsService;
            _accountDataService       = accountDataService;

            _identityUIEndpoints = identityUIEndpoints.Value;
        }
 public IssuesViewModel(IInnerNavigator <Issue> nav, IAuthenticator authenticator, IAccountDataService accountDataService, IIssueDataService issueDataService)
 {
     SelectedItem         = null;
     InnerIssuesNavigator = nav;
     _authenticator       = authenticator;
     _accountDataService  = accountDataService;
     InnerIssuesNavigator.ParentViewModel = this;
     DeleteIssuesCommand = new DeleteIssuesCommand(this, issueDataService);
     if (authenticator.IsLoggedIn)
     {
         LoadIssues();
     }
 }
예제 #16
0
        public AccountController(
            ILoginService loginService,
            IEmailConfirmationService emailConfirmationService,
            IAddUserService addUserService,
            ICredentialsService credentialsService,
            IAccountDataService accountDataService,
            ITwoFactorAuthService twoFactorAuthService,
            IExternalLoginService externalLoginService,
            IGroupRegistrationService groupRegistrationService,
            IOptionsSnapshot <IdentityUIEndpoints> identityUIEndpoints)
        {
            _loginService             = loginService;
            _emailConfirmationService = emailConfirmationService;
            _addUserService           = addUserService;
            _credentialsService       = credentialsService;
            _accountDataService       = accountDataService;
            _twoFactorAuthService     = twoFactorAuthService;
            _externalLoginService     = externalLoginService;
            _groupRegistrationService = groupRegistrationService;

            _identityUIEndpoints = identityUIEndpoints.Value;
        }
예제 #17
0
 public AccountService(IAccountDataService accountDataService)
 {
     _accountDataService = accountDataService;
 }
예제 #18
0
 public FinancialAccountController(IAccountBusinessLogic accountBusinessLogic, IAccountDataService accountDataService)
 {
     _accountBusinessLogic = accountBusinessLogic;
     _accountDataService   = accountDataService;
 }
예제 #19
0
 public AccountController(IAccountDataService accountDataService, IUserDataService userDataService)
 {
     _accountDataService = accountDataService;
     _userDataService    = userDataService;
 }
예제 #20
0
 public AccountViewModel(IAccountDataService accountDataService)
 {
     _accountDataService = accountDataService;
 }
예제 #21
0
 public AccountBusinessLogic(IAccountDataService accountDataService)
 {
     this.AccountDataService = accountDataService;
 }
예제 #22
0
 public AccountService(IAccountDataService accountDataService)
 {
     this._accountDataService = accountDataService;
 }
예제 #23
0
 public AccountService(IAccountDataService accountDataService, IPasswordHasher <Account> passwordHasher)
 {
     _accountDataService = accountDataService;
     _passwordHasher     = passwordHasher;
 }
 public MonthlyBalanceController(IAccountDataService accountDataService)
 {
     this.accountDataService = accountDataService;
 }
 public AuthenticationService(IAccountDataService accountDataService, IPasswordHasher passwordHasher)
 {
     _accountDataService = accountDataService;
     _passwordHasher     = passwordHasher;
 }
예제 #26
0
        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);
        }
예제 #27
0
 public FinancialAccountController()
 {
     _accountBusinessLogic = new AccountBusinessLogic(new AccountDataService(new BudgetManagerDbContext()));
     _accountDataService   = new AccountDataService(new BudgetManagerDbContext());
 }
        public void Init()
        {
            _accountDataService = new AccountDataService();

            _accountDb = new List <Account>()
            {
                new Account {
                    _AccountId = 1, _CustomerId = 1, _Name = "Wells Fargo",
                    _Balance   = 2000.00m, _Apr = 0.159f, _MinPay = 25.00m, _Payment = 30.00m
                },
                new Account {
                    _AccountId = 2, _CustomerId = 1, _Name = "Chase Bank",
                    _Balance   = 3000.00m, _Apr = 0.189f, _MinPay = 27.00m, _Payment = 30.00m
                },
                new Account {
                    _AccountId = 3, _CustomerId = 1, _Name = "Car Loan",
                    _Balance   = 4000.00m, _Apr = 0.209f, _MinPay = 225.00m, _Payment = 225.00m
                },
                new Account {
                    _AccountId = 4, _CustomerId = 2, _Name = "Bank of America",
                    _Balance   = 1500.00m, _Apr = 0.229f, _MinPay = 25.00m, _Payment = 100.00m
                },
                new Account {
                    _AccountId = 5, _CustomerId = 2, _Name = "Student Loan1",
                    _Balance   = 20000.00m, _Apr = 0.03f, _MinPay = 225.00m, _Payment = 225.00m
                },
                new Account {
                    _AccountId = 6, _CustomerId = 2, _Name = "Student Loan2",
                    _Balance   = 20000.00m, _Apr = 0.06f, _MinPay = 250.00m, _Payment = 250.00m
                },
                new Account {
                    _AccountId = 7, _CustomerId = 3, _Name = "Zales Credit",
                    _Balance   = 2700.00m, _Apr = 0.299f, _MinPay = 75.00m, _Payment = 100.00m
                },
                new Account {
                    _AccountId = 8, _CustomerId = 3, _Name = "Capital One",
                    _Balance   = 1000.00m, _Apr = 0.139f, _MinPay = 15.00m, _Payment = 15.00m
                },
                new Account {
                    _AccountId = 9, _CustomerId = 3, _Name = "Best Buy",
                    _Balance   = 2200.00m, _Apr = 0.169f, _MinPay = 25.00m, _Payment = 100.00m
                },
                new Account {
                    _AccountId = 10, _CustomerId = 3, _Name = "American Express",
                    _Balance   = 3500.00m, _Apr = 0.199f, _MinPay = 25.00m, _Payment = 100.00m
                }
            };

            _accountDataService.SaveToFile(_accountDb);

            _mockAccountService = new Mock <IAccountDataService>();

            _accountJson = _accountDataService.ReadFromFile();

            //_mockAccountService.Object.SavePaymentsToFile(_accountDb);

            _mockAccountService.Setup(a => a.FindAll()).Returns(
                () =>
            {
                var accounts = new List <Account>();

                _accountDb.ToList().ForEach(account =>
                {
                    accounts.Add(new Account()
                    {
                        _AccountId  = account._AccountId,
                        _CustomerId = account._CustomerId,
                        _Name       = account._Name,
                        _Balance    = account._Balance,
                        _Apr        = account._Apr,
                        _MinPay     = account._MinPay,
                        _Payment    = account._Payment
                    });
                });

                return(accounts);
            });

            _mockAccountService.Setup(a => a.AddAccount(It.IsAny <Account>())).Callback(
                (Account account) =>
            {
                if (account == null)
                {
                    throw new InvalidOperationException("Add Account - account was null");
                }
                if (account._AccountId <= 0)
                {
                    account._AccountId = _accountDb.Max(a => a._AccountId) + 1;
                    _accountDb.Add(account);
                }
            });

            _mockAccountService.Setup(a => a.DeleteAccount(It.IsAny <Account>())).Callback(
                (Account account) =>
            {
                var deleteAccount = _accountDb.SingleOrDefault(a => a._AccountId.Equals(account._AccountId));
                _accountDb.Remove(deleteAccount);
            }) /*.Verifiable()??*/;

            _mockAccountService.Setup(a => a.EditAccount(It.IsAny <Account>())).Callback(
                (Account account) =>
            {
                if (account == null)
                {
                    throw new InvalidOperationException("Edit Account - account was null");
                }
                var updateAccount = _accountDb.SingleOrDefault(a => a._AccountId.Equals(account._AccountId));
                if (updateAccount == null)
                {
                    throw new InvalidOperationException("Account was null");
                }
                updateAccount._CustomerId = account._CustomerId;
                updateAccount._Name       = account._Name;
                updateAccount._Balance    = account._Balance;
                updateAccount._Apr        = account._Apr;
                updateAccount._MinPay     = account._MinPay;
                updateAccount._Payment    = account._Payment;
            });

            _mockAccountService.Setup(a => a.FindByName(It.IsAny <string>())).Returns(
                (string name) =>
            {
                return(_accountDb.SingleOrDefault(a => a._Name.Equals(name)));
            });

            _mockAccountService.Setup(a => a.FindByID(It.IsAny <int>())).Returns(
                (int id) =>
            {
                return(_accountDb.SingleOrDefault(a => a._AccountId.Equals(id)));
            });

            _mockAccountService.Setup(a => a.FindAllByCustomerId(It.IsAny <int>())).Returns(
                (int id) =>
            {
                var customerAccounts = new List <Account>();
                customerAccounts     = _accountDb.ToList().Where(account => account._CustomerId.Equals(id)).ToList();
                if (customerAccounts.Count().Equals(0))
                {
                    throw new InvalidOperationException("No accounts with that id");
                }
                return(customerAccounts);
            });
        }
 public AccountController(IAccountDataService accountDataService)
 {
     _accountDataService = accountDataService;
 }
예제 #30
0
 /// <summary>
 /// Constructor with Dependency Injection using Ninject
 /// </summary>
 /// <param name="dataService"></param>
 public AccountController(IAccountDataService dataService)
 {
     accountDataService = dataService;
 }
예제 #31
0
 public AccountsController(IAccountDataService accountDataService, UserManager <AppUser> userManager)
 {
     this.accountDataService = accountDataService;
     this.userManager        = userManager;
 }