private async Task ValidateTransferSenderIdIsAFundingConnection(long accountId, long transferSenderId) { var hashedAccountId = _encodingService.Encode(accountId, EncodingType.AccountId); var fundingConnections = await _accountApiClient.GetTransferConnections(hashedAccountId); if (fundingConnections.Any(x => x.FundingEmployerAccountId == transferSenderId)) { return; } throw new BadRequestException($"TransferSenderId {transferSenderId} is not a FundingEmployer for Account {accountId}"); }
public async Task <List <TransferConnection> > GetTransferConnectionsForAccount(string accountHashedId) { var listOfTransferConnections = await _accountsApiClient.GetTransferConnections(accountHashedId); if (listOfTransferConnections == null) { return(new List <TransferConnection>()); } return(listOfTransferConnections.Select(x => new TransferConnection { AccountId = x.FundingEmployerAccountId, AccountName = x.FundingEmployerAccountName }).ToList()); }
public async Task <List <TransferConnection> > GetTransferConnectionsForAccount(string accountHashedId) { var listOfTransferConnections = await _accountsApiClient.GetTransferConnections(accountHashedId); if (listOfTransferConnections == null) { return(new List <TransferConnection>()); } return(listOfTransferConnections.Select(x => new TransferConnection { TransferConnectionCode = _encodingService.Encode(x.FundingEmployerAccountId, EncodingType.PublicAccountId), TransferConnectionName = x.FundingEmployerAccountName }).ToList()); }
public async Task <IEnumerable <EmployerTransferConnection> > GetTransferConnections(string accountId) { try { var transferConnections = await _accountApiClient.GetTransferConnections(accountId); return(transferConnections.Select(acc => new EmployerTransferConnection { FundingEmployerPublicHashedAccountId = acc.FundingEmployerPublicHashedAccountId, FundingEmployerAccountName = acc.FundingEmployerAccountName, FundingEmployerHashedAccountId = acc.FundingEmployerHashedAccountId, FundingEmployerAccountId = acc.FundingEmployerAccountId })); } catch (Exception e) { Console.WriteLine(e); throw; } }