예제 #1
0
        public async Task <bool?> Handle(AllowedRevolvingLineUsersCommand message, CancellationToken cancellationToken)
        {
            var application = await _applicationRepository.GetAsync(message.ApplicationId);

            if (application != null)
            {
                CreditLineLimits cll = new CreditLineLimits();
                cll.AllowedRevolvingLineUsers = message.AllowedRevolvingLineUsers;
                var res = _arrangementRequestRepository.SetCreditLineUsers
                              (message.ApplicationId, message.ArrangementRequestId, cll, application);

                var appNumberString = "0000000000" + message.ApplicationId;
                appNumberString = appNumberString.Substring(appNumberString.Length - 10);
                _logger.LogDebug("Before publish ", appNumberString);
                var messageObj = _eventFactory.CreateBuilder("offer", "credit-line-limits-added")
                                 .AddBodyProperty("application-number", appNumberString)
                                 .AddHeaderProperty("application-number", appNumberString)
                                 .Build();
                _eventBus.Publish(messageObj);
                _logger.LogDebug("After publish ", appNumberString);
                return(await res);
            }
            return(null);
        }