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(); }
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>()); }
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> >()); }
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>()); }