Exemple #1
0
        public async Task <Unit> Handle(SetApplicationOutcomeCommand request, CancellationToken cancellationToken)
        {
            if (request.Outcome == ApplicationOutcome.Approve)
            {
                _logger.LogInformation($"Approving Application {request.ApplicationId} for Pledge {request.PledgeId}");

                var apiRequestData = new ApproveApplicationRequestData
                {
                    UserId          = request.UserId,
                    UserDisplayName = request.UserDisplayName
                };

                var apiRequest = new ApproveApplicationRequest(request.PledgeId, request.ApplicationId, apiRequestData);

                await _levyTransferMatchingService.ApproveApplication(apiRequest);
            }
            else if (request.Outcome == ApplicationOutcome.Reject)
            {
                _logger.LogInformation($"Rejecting Application {request.ApplicationId} for Pledge {request.PledgeId}");

                var apiRequestData = new RejectApplicationRequestData
                {
                    UserId          = request.UserId,
                    UserDisplayName = request.UserDisplayName
                };

                var apiRequest = new RejectApplicationRequest(request.PledgeId, request.ApplicationId, apiRequestData);

                await _levyTransferMatchingService.RejectApplication(apiRequest);
            }

            return(Unit.Value);
        }
Exemple #2
0
        public async Task <EmptyResponse> RejectAsync(long id, [FromBody] RejectApplicationRequest request)
        {
            await _ethereumClient.WaitForConfirmationAsync(request.TransactionHash);

            await _expertService.RejectApplicationAsync(id);

            return(new EmptyResponse());
        }
Exemple #3
0
        public void Setup()
        {
            _command = _fixture.Create <RejectApplicationsCommand>();
            _command.ApplicationsToReject = new List <int> {
                5
            };

            _levyTransferMatchingService = new Mock <ILevyTransferMatchingService>();

            _levyTransferMatchingService.Setup(x => x.RejectApplication(It.IsAny <RejectApplicationRequest>()))
            .Callback <RejectApplicationRequest>(r => _request = r)
            .Returns(Task.CompletedTask);

            _handler = new RejectApplicationsCommandHandler(_levyTransferMatchingService.Object, Mock.Of <ILogger <RejectApplicationsCommandHandler> >());
        }
Exemple #4
0
        public void Setup()
        {
            _command = _fixture.Create <SetApplicationOutcomeCommand>();

            _levyTransferMatchingService = new Mock <ILevyTransferMatchingService>();
            _levyTransferMatchingService.Setup(x => x.ApproveApplication(It.IsAny <ApproveApplicationRequest>()))
            .Callback <ApproveApplicationRequest>(request => _approveApplicationRequest = request)
            .Returns(Task.CompletedTask);

            _levyTransferMatchingService.Setup(x => x.RejectApplication(It.IsAny <RejectApplicationRequest>()))
            .Callback <RejectApplicationRequest>(request => _rejectApplicationRequest = request)
            .Returns(Task.CompletedTask);

            _handler = new SetApplicationOutcomeCommandHandler(_levyTransferMatchingService.Object, Mock.Of <ILogger <SetApplicationOutcomeCommandHandler> >());
        }
Exemple #5
0
        public async Task <Unit> Handle(RejectApplicationsCommand request, CancellationToken cancellationToken)
        {
            _logger.LogInformation($"Rejecting Application(s) { string.Join(", ", request.ApplicationsToReject) } for Pledge {request.PledgeId}");

            var apiRequestData = new RejectApplicationRequestData
            {
                UserId          = request.UserId,
                UserDisplayName = request.UserDisplayName
            };

            foreach (var applicationId in request.ApplicationsToReject)
            {
                var apiRequest = new RejectApplicationRequest(request.PledgeId, applicationId, apiRequestData);
                await _levyTransferMatchingService.RejectApplication(apiRequest);
            }
            return(Unit.Value);
        }
 public async Task RejectApplication(RejectApplicationRequest request)
 {
     await _levyTransferMatchingApiClient.PostWithResponseCode <RejectApplicationRequest>(request);
 }