Beispiel #1
0
 public override async Task<GetTransactionsResponse> GetTransactions(GetTransactionsRequest request, ServerCallContext context)
 {
     var ids = request.Ids.Any() ? request.Ids.ToArray() : cardsRepository.GetIds();
     var transactionsRequest = new FilterTransactionsRequest { Cards = { ids }, TimestampFrom = request.TimestampFrom, TimestampTo = request.TimestampTo };
     var transactionsResponse = await transactionsClient.FilterAsync(transactionsRequest, context.RequestHeaders.SelectCustom());
     return new GetTransactionsResponse { Transactions = { transactionsResponse.Transactions } };
 }
Beispiel #2
0
        public override async Task <GetTransactionsResponse> GetTransactions(GetTransactionsRequest request, ServerCallContext context)
        {
            var filters = new FilterTransactionsRequest {
                Senders = { request.Ids }, Recipients = { request.Ids }, TimestampFrom = request.TimestampFrom, TimestampTo = request.TimestampTo
            };
            var response = await transactionsClient.FilterAsync(filters, context.RequestHeaders.SelectCustom());

            return(new GetTransactionsResponse {
                Transactions = { response.Transactions }
            });
        }
        public override Task <GetTransactionsResult> Filter(FilterTransactionsRequest request, ServerCallContext context)
        {
            var filters = new Filters
            {
                Cards         = request.Cards.ToHashSet(),
                Payments      = request.Payments.ToHashSet(),
                Recipients    = request.Recipients.ToHashSet(),
                Senders       = request.Senders.ToHashSet(),
                TimestampFrom = request.TimestampFrom.ToNullableDateTime(),
                TimestampTo   = request.TimestampTo.ToNullableDateTime(),
            };

            var transactions = transactionsRepository.GetMany(filters, request.Top).Select(t => mapper.Map <Transaction>(t));

            return(Task.FromResult(new GetTransactionsResult {
                Transactions = { transactions }
            }));
        }