public void ConvertNullAPIToAPI() { apiAccount = null; converter = new AccountConverter(apiAccount); Assert.IsNull(converter.ToAPIAccount()); }
public IEnumerable <Account> GetNewAccounts() { return((from a in Context.Accounts where a.Created > Context.NewDate orderby a.Name ascending select AccountConverter.ToDomain(a)).AsEnumerable()); }
public Account GetAccount(Guid WorkDoneItemId) { var inv = GetOpportunity(WorkDoneItemId); var acc = Context.Accounts.Single(a => a.Id == inv.AccountId); return(AccountConverter.ToDomain(acc)); }
public void ConvertSDKToAPI() { sdkAccount = CreateTypicalSDKAccount(); converter = new AccountConverter(sdkAccount); OneSpanSign.API.Account account = converter.ToAPIAccount(); Assert.IsNotNull(account); Assert.AreEqual(ACC_NAME, account.Name); Assert.AreEqual(ACC_CO_ID, account.Company.Id); Assert.AreEqual(ACC_CO_ADDR_ADDR1, account.Company.Address.Address1); Assert.AreEqual(1, account.CustomFields.Count); Assert.AreEqual(ACC_FIELD_DEF_VLE, account.CustomFields[0].Value); Assert.AreEqual(1, account.CustomFields[0].Translations.Count); Assert.AreEqual(ACC_FIELD_TRANSL_LANG, account.CustomFields[0].Translations[0].Language); Assert.AreEqual(1, account.Licenses.Count); Assert.AreEqual(ACC_LIC_STATUS, account.Licenses[0].Status); Assert.AreEqual(1, account.Licenses[0].Transactions.Count); Assert.AreEqual(ACC_LIC_TRANS_CC_NUM, account.Licenses[0].Transactions[0].CreditCard.Number); Assert.AreEqual(ACC_LIC_TRANS_PRICE_AMOUNT, account.Licenses[0].Transactions[0].Price.Amount); Assert.AreEqual(ACC_LIC_PLAN_CONTRACT, account.Licenses[0].Plan.Contract); Assert.AreEqual(ACC_LIC_PLAN_PRICE_AMOUNT, account.Licenses[0].Plan.Price.Amount); Assert.AreEqual(1, account.Providers.Documents.Count); Assert.AreEqual(ACC_PROV_DOC_NAME, account.Providers.Documents[0].Name); Assert.AreEqual(1, account.Providers.Users.Count); Assert.AreEqual(ACC_PROV_USR_NAME, account.Providers.Users[0].Name); }
public ResultGeneric <List <GetAccountsResponse> > GetAccountsByDocument(string cpf) { var result = new ResultGeneric <List <GetAccountsResponse> >(); var client = clientRepository.getByDocument(cpf); if (client != null) { var accounts = accountRepository.GetAllAccountsByClientID(client.ClientID); if (accounts.Count > 0) { var retorno = new List <GetAccountsResponse>(); accounts.ForEach(a => retorno.Add(AccountConverter.Parse(a, cpf))); result.Data = retorno; result.Success = true; } else { result.Success = false;; result.Errors.Add("Nenhuma conta localizada"); } } else { result.Success = false;; result.Errors.Add("Cliente não localizado com o CPF: " + cpf); } return(result); }
public void ConvertNullSDKToAPI() { sdkAccount = null; converter = new AccountConverter(sdkAccount); Assert.IsNull(converter.ToAPIAccount()); }
public void ConvertSDKToSDK() { sdkAccount = CreateTypicalSDKAccount(); converter = new AccountConverter(sdkAccount); Account account = converter.ToSDKAccount(); Assert.IsNotNull(account); Assert.AreEqual(sdkAccount, account); }
public IEnumerable <Account> GetActiveAccounts() { return((from a in Context.Accounts join i in Context.Invoices on a.Id equals i.AccountId where i.InvoiceDate > Context.ActiveDate orderby a.Name ascending select AccountConverter.ToDomain(a)).Distinct().AsEnumerable()); }
public AccountDTO AddAccountToUser(AccountDTO accountDTO, string username) { var user = userService.GetEntityByUsername(username); user.Account = AccountConverter.ToEntity(accountDTO); userService.Save(user); return(accountDTO); }
public IEnumerable <AccountDTO> deleteAccountFromClient(String clientId, int accountId) { Client client = clientRepository.GetByID(clientId); accountRepository.Delete(accountId); return(AccountConverter.toDtos(accountRepository.Get().Where(x => x.Client.SocialSecurityNumber == clientId))); }
public AccountRemoteDataSource( ILogger <AccountRemoteDataSource> logger, AccountClient client, AccountConverter converter ) { this.logger = logger; this.client = client; this.converter = converter; }
public void Passing() { AccountConverter converter = new AccountConverter(); var address = "xrb_39ymww61tksoddjh1e43mprw5r8uu1318it9z3agm7e6f96kg4ndqg9tuds4"; var decode = converter.DecodeAccount(address); var encode = converter.EncodeAccount(decode); Assert.Equal(address, encode); }
public AccountDTO getAccountById(int accountId) { Account account = accountRepository.GetByID(accountId); if (account == null) { throw new InvalidOperationException("No account found with that accountId"); } return(AccountConverter.toDto(account)); }
public void ConvertAPIToAPI() { apiAccount = CreateTypicalAPIAccount(); converter = new AccountConverter(apiAccount); OneSpanSign.API.Account account = converter.ToAPIAccount(); Assert.IsNotNull(account); Assert.AreEqual(apiAccount, account); }
public AccountDTO GetAccount(string username) { var acc = GetAccountForUser(username); if (acc == null) { return(null); } return(AccountConverter.ToDTO(acc)); }
public Account GetItem(Guid id) { var account = (from a in Context.Accounts where a.Id == id select AccountConverter.ToDomain(a)).Single(); account.Invoices = GetInvoices(id, Context.ActiveDate); account.Opportunities = GetNewAndActiveOpportunities(id, Context.NewDate, Context.ActiveDate); return(account); }
public IEnumerable <ReportProfitItem> GetProfitData() { return(from a in accounts join p in allocations on a.Id equals p.AccountId select new ReportProfitItem { Account = AccountConverter.ConvertToDomain(a), Allocation = AllocationConverter.ConvertToDomain(p), WorkDoneMargin = GetWorkDoneMargin(a.Id, GetMonthStart(p.Month)) }); }
public IEnumerable <ReportWorkDoneItem> GetWorkDoneItems() { return(from a in accounts join i in invoices on a.Id equals i.AccountId join w in workDoneItems on i.Id equals w.InvoiceId where (bool)w.Active && (bool)i.Active select new ReportWorkDoneItem { Account = AccountConverter.ConvertToDomain(a), Invoice = InvoiceConverter.ConvertToDomain(i), WorkDoneItem = WorkDoneItemConverter.ConvertToDomain(w) }); }
public AccountDTO updateAccount(int accountId, AccountDTO accountDto) { Account account = accountRepository.GetByID(accountId); if (account == null) { throw new InvalidOperationException("No account found with that id"); } account.Amount = accountDto.Amount; accountRepository.Update(account); return(AccountConverter.toDto(account)); }
public AccountDTO UpdateAccount(AccountDTO accountDTO, string username) { var user = userService.GetEntityByUsername(username); var updatedAcc = AccountConverter.ToEntity(accountDTO); if (user.AccountId == null) { return(null); } updatedAcc.Id = user.AccountId.Value; user.Account = updatedAcc; repository.Save(updatedAcc); return(accountDTO); }
public void AddAndGetAccount2() { IRepository <FrontiersDb> _repo = new LiteDBRepository <FrontiersDb>(_databaseSetting); var address = "xrb_39ymww61tksoddjh1e43mprw5r8uu1318it9z3agm7e6f96kg4ndqg9tuds4"; AccountConverter converter = new AccountConverter(); var accountUInt256 = converter.DecodeAccount(address); FrontiersDb frontierEntry = new FrontiersDb(); frontierEntry.Account = accountUInt256; _repo.Insert(frontierEntry); var accountFind = converter.DecodeAccount(address); var found = _repo.FindOneById(accountFind); Assert.NotNull(found); }
public IEnumerable <AccountDTO> addAccountToClient(String clientId, int accountId) { Client client = clientRepository.GetByID(clientId); Account account = accountRepository.GetByID(accountId); if (client == null || account == null) { throw new InvalidOperationException("Client or account does not exist"); } account.Client = client; accountRepository.Update(account); return(AccountConverter.toDtos(accountRepository.Get().Where(x => x.Client.SocialSecurityNumber == clientId))); }
public AccountDTO createAccount(AccountDTO accountDto) { if (accountDto.Amount < 0) { throw new InvalidOperationException("Impossible to have a negative balance"); } Account account = new Account { Client = null, CreationDate = DateTime.Now, Amount = accountDto.Amount, Id = accountDto.Id, Type = accountDto.Type }; accountRepository.Insert(account); return(AccountConverter.toDto(account)); }
public ResultGeneric <PostClientAccountResponse> Register(PostClientAccountRequest entity) { var accountCreate = new ResultGeneric <PostClientAccountResponse>(); var newClient = ClientConverter.Parse(entity); var newAccount = AccountConverter.Parse(entity); var clientID = new Guid(); #region Client var client = clientRepository.getByDocument(entity.CPF); if (client != null) { clientID = client.ClientID; } else { clientRepository.Insert(newClient); clientID = newClient.ClientID; } #endregion #region Account if (!accountRepository.AccountExists(entity.AgencyNumber, entity.AccountNumber)) { newAccount.ClientID = clientID; accountRepository.Insert(newAccount); accountCreate.Success = true; } else { accountCreate.Success = false; accountCreate.Errors.Add("Conta já existente"); } accountCreate.Data = ClientConverter.Parse(newClient, newAccount); #endregion return(accountCreate); }
public void TestSetup() { converter = new AccountConverter(); }
public IEnumerable <AccountDTO> getAllAccounts() { return(AccountConverter.toDtos(accountRepository.Get())); }
public Account GetParent(Guid id) { var parentId = Context.Opportunities.Single(o => o.Id == id).AccountId; return(AccountConverter.ToDomain(Context.Accounts.Single(a => a.Id == parentId))); }