コード例 #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();
        }
コード例 #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>());
        }
コード例 #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> >());
        }
コード例 #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>());
        }