Exemplo n.º 1
0
        public async Task RecordWithdrawTransactionAsync(RequestCreateTransactionModel request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var content  = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");
            var response = await HttpClientWithAuthorization.PostAsync("/api/transactions/withdraw", content, cancellationToken);

            await response.EnsureSuccessStatusCodeAsync();
        }
Exemplo n.º 2
0
        public async Task <BankingAccountModel> GetBankingAccountByUserIdAsync(Guid userId, CancellationToken cancellationToken = default(CancellationToken))
        {
            var response = await HttpClientWithAuthorization.GetAsync("/api/accounts/user/" + userId, cancellationToken);

            await response.EnsureSuccessStatusCodeAsync();

            return(await response.DeserilizeResponseAsync <BankingAccountModel>());
        }
Exemplo n.º 3
0
        public async Task <List <TransactionModel> > GetTransactionsAsync(Guid accountId, CancellationToken cancellationToken = default(CancellationToken))
        {
            var response = await HttpClientWithAuthorization.GetAsync($"/api/transactions?accountId={accountId}", cancellationToken);

            await response.EnsureSuccessStatusCodeAsync();

            return(await response.DeserilizeResponseAsync <List <TransactionModel> >());
        }
Exemplo n.º 4
0
        public async Task <BankingAccountModel> CreateDebitAccountAsync(Guid userId, CancellationToken cancellationToken = default(CancellationToken))
        {
            var content  = new StringContent(JsonConvert.SerializeObject(new CreateAccountRequestModel(userId)), Encoding.UTF8, "application/json");
            var response = await HttpClientWithAuthorization.PostAsync("/api/accounts", content, cancellationToken);

            await response.EnsureSuccessStatusCodeAsync();

            return(await response.DeserilizeResponseAsync <BankingAccountModel>());
        }