コード例 #1
0
        public async override Task <GetTransactionsResult> GetTransactions(GetTransactionsRequest request, ServerCallContext context)
        {
            var ids = request.Ids.Any() ? request.Ids.ToArray() : loansRepository.GetPaymentsIds();
            var transactionsRequest = new FilterTransactionsRequest {
                Payments = { ids }, TimestampFrom = request.TimestampFrom, TimestampTo = request.TimestampTo
            };
            var transactionsResponse = await transactionsClient.FilterAsync(transactionsRequest, context.RequestHeaders.SelectCustom());

            return(new GetTransactionsResult {
                Transactions = { transactionsResponse.Transactions }
            });
        }
        public override async Task <AggregateOverallResponse> AggregateOverall(AggregateOverallRequest request, ServerCallContext context)
        {
            var paymentsIds          = loansRepository.GetPaymentsIds();
            var transactionsResponse = await transactionsReadClient.FilterAsync(new FilterTransactionsRequest { Payments = { paymentsIds }, TimestampTo = request.TimestampTo, TimestampFrom = request.TimestampFrom }, context.RequestHeaders.SelectCustom());

            var aggregations = Aggregations.CreateOverallCsvReport(new OverallReportData {
                Aggregations = request.Aggregations.ToArray(), Granularity = request.Granularity, Transactions = transactionsResponse.Transactions.ToArray()
            });

            return(new AggregateOverallResponse {
                Portions = { aggregations }
            });
        }
コード例 #3
0
        public Task GetTransactions(MessageContext context, GetTransactionsEvent inputEvent)
        {
            var paymentsIds          = inputEvent.Ids != null && inputEvent.Ids.Length > 0 ? inputEvent.Ids : loansRepository.GetPaymentsIds();
            var getTransactionsEvent = new FilterTransactionsEvent {
                Payments = paymentsIds, TimestampFrom = inputEvent.TimestampFrom, TimestampTo = inputEvent.TimestampTo
            };

            publishingRouter.Publish(Queues.Transactions, getTransactionsEvent, context.FlowId, context.ReplyTo);
            return(Task.CompletedTask);
        }