public static void Login(string username, string accessToken) { CurrentUsername = username; UsersClient.SetBearerToken(accessToken); TransactionsClient.SetBearerToken(accessToken); IsLoggedIn = true; }
public TransactionSender() { // In a real world scenario it would be dependency injection. _httpRequestMessageBuilder = new HttpRequestMessageBuilder(); _transactionsClient = new TransactionsClient(); _httpResponseMessageReader = new HttpResponseMessageReader(); }
public static void Logout() { CurrentUsername = null; UsersClient.SetBearerToken(null); TransactionsClient.SetBearerToken(null); IsLoggedIn = false; }
/// <summary> /// Initializes a new instance of the <see cref="IgniteClient"/> class. /// </summary> /// <param name="clientConfiguration">The client configuration.</param> public IgniteClient(IgniteClientConfiguration clientConfiguration) { Debug.Assert(clientConfiguration != null); _configuration = new IgniteClientConfiguration(clientConfiguration); _marsh = new Marshaller(_configuration.BinaryConfiguration) { Ignite = this }; _transactions = new TransactionsClient(this, clientConfiguration.TransactionConfiguration); _socket = new ClientFailoverSocket(_configuration, _marsh, _transactions); _binProc = _configuration.BinaryProcessor ?? new BinaryProcessorClient(_socket); _binary = new Impl.Binary.Binary(_marsh); _cluster = new ClientCluster(this); _compute = new ComputeClient(this, ComputeClientFlags.None, TimeSpan.Zero, null); _services = new ServicesClient(this); }
public CreateTransactionCommand( TransactionType transactionType, TransactionsClient transactionsClient) { _transactionType = transactionType; _transactionsClient = transactionsClient; }
/// <summary> /// Initializes a new instance of the <see cref="ClientFailoverSocket"/> class. /// </summary> /// <param name="config">The configuration.</param> /// <param name="marsh">The marshaller.</param> /// <param name="transactions">The transactions.</param> public ClientFailoverSocket( IgniteClientConfiguration config, Marshaller marsh, TransactionsClient transactions) { Debug.Assert(config != null); Debug.Assert(marsh != null); Debug.Assert(transactions != null); _config = config; _marsh = marsh; _transactions = transactions; _logger = (_config.Logger ?? NoopLogger.Instance).GetLogger(GetType()); #pragma warning disable 618 // Type or member is obsolete if (config.Host == null && (config.Endpoints == null || config.Endpoints.Count == 0)) { throw new IgniteClientException("Invalid IgniteClientConfiguration: Host is null, " + "Endpoints is null or empty. Nowhere to connect."); } #pragma warning restore 618 _endPoints = GetIpEndPoints(config).ToList(); if (_endPoints.Count == 0) { throw new IgniteClientException("Failed to resolve all specified hosts."); } ConnectDefaultSocket(); OnFirstConnection(); }
public AccountsService(AccountsRepository accountsRepository, ILogger <AccountsService> logger, Mapper mapper, TransactionsClient transactionsClient) { this.accountsRepository = accountsRepository; this.logger = logger; this.mapper = mapper; this.transactionsClient = transactionsClient; }
public PaymentsService(PaymentsRepository paymentsRepository, ILogger <PaymentsService> logger, Mapper mapper, TransactionsClient transactionsClient, LoansClient loansClient) { this.paymentsRepository = paymentsRepository; this.logger = logger; this.mapper = mapper; this.transactionsClient = transactionsClient; this.loansClient = loansClient; }
public async Task <string> MakeTransactionAsync(string transactionServiceUrl, int accountId, double amount) { var client = new TransactionsClient(transactionServiceUrl, _httpClientFactory.CreateClient()); var transactionInfo = await client.NewAsync(new TransactionViewModel { AccountId = accountId, Amount = amount }); return(transactionInfo); }
public async Task <IEnumerable <TransactionInfo> > GetTransactionDetailsAsync(string transactionServiceUrl, int accountId) { var client = new TransactionsClient(transactionServiceUrl, _httpClientFactory.CreateClient()); var transactions = await client.GetAsync(accountId); return(AutoMapper.Mapper.Map <IEnumerable <TransactionViewModel>, IEnumerable <TransactionInfo> >(transactions)); }
public LoansService(LoansRepository loansRepository, ILogger <LoansService> logger, Mapper mapper, PaymentsClient paymentsClient, TransactionsClient transactionsClient) { this.loansRepository = loansRepository; this.logger = logger; this.mapper = mapper; this.paymentsClient = paymentsClient; this.transactionsClient = transactionsClient; }
public CardsService(CardsRepository cardsRepository, ILogger<CardsService> logger, Mapper mapper, AccountsClient accountsClient, TransactionsClient transactionsClient) { this.cardsRepository = cardsRepository; this.logger = logger; this.mapper = mapper; this.accountsClient = accountsClient; this.transactionsClient = transactionsClient; }
public DataFetcher(TransactionsClient transactionsClient, AccountsClient accountsClient, PaymentsClient paymentsClient, CardsClient cardsClient, LoansClient loansClient) { this.transactionsClient = transactionsClient; this.accountsClient = accountsClient; this.paymentsClient = paymentsClient; this.cardsClient = cardsClient; this.loansClient = loansClient; }
public PanelsBranchService(ILogger <PanelsBranchService> logger, TransactionsClient transactionsClient, PaymentsClient paymentsClient, LoansClient loansClient, AccountsClient accountsClient, CardsClient cardsClient ) { this.logger = logger; this.transactionsClient = transactionsClient; this.paymentsClient = paymentsClient; this.loansClient = loansClient; this.accountsClient = accountsClient; this.cardsClient = cardsClient; }
public SetupController(AccountsClient accountsClient, CardsClient cardsClient, LoansClient loansClient, PaymentsClient paymentsClient, TransactionsClient transactionsClient, UsersClient usersClient, Mapper mapper) { this.accountsClient = accountsClient; this.cardsClient = cardsClient; this.loansClient = loansClient; this.paymentsClient = paymentsClient; this.transactionsClient = transactionsClient; this.usersClient = usersClient; this.mapper = mapper; }
static async Task Main(string[] args) { var httpClient = new HttpClient(); UsersClient = new UsersClient(API_BASE_URL, httpClient); TransactionsClient = new TransactionsClient(API_BASE_URL, httpClient); var isRunning = true; while (isRunning) { if (IsLoggedIn) { Console.WriteLine($"Hello, {CurrentUsername}"); Console.WriteLine("Available commands: deposit, withdraw, balance, transactions, logout"); var input = Console.ReadLine(); switch (input.ToLower()) { case "balance": { await new ShowBalanceCommand(UsersClient).Run(); break; } case "deposit": { await new Commands.CreateTransactionCommand( TransactionType.Deposit, TransactionsClient).Run(); break; } case "withdraw": { await new Commands.CreateTransactionCommand( TransactionType.Withdrawal, TransactionsClient).Run(); break; } case "transactions": { await new ListTransactionsCommand(TransactionsClient).Run(); break; } case "logout": { Logout(); break; } } } else { Console.WriteLine("Available commands: login, signup, exit"); var input = Console.ReadLine(); switch (input.ToLower()) { case "login": { await new LoginCommand(UsersClient).Run(); break; } case "signup": { await new SignUpCommand(UsersClient).Run(); break; } case "exit": isRunning = false; continue; } } Console.Clear(); } }
public ListTransactionsCommand(TransactionsClient transactionsClient) { _transactionsClient = transactionsClient; }
public TransactionController(ILogger <TransactionController> logger, TransactionsClient transactionsClient, Mapper mapper) { this.logger = logger; this.transactionsClient = transactionsClient; this.mapper = mapper; }