Exemplo n.º 1
0
        public async Task Process(CloseInput input)
        {
            Account account = await accountReadOnlyRepository.Get(input.AccountId);

            if (account == null)
            {
                throw new AccountNotFoundException($"The account {input.AccountId} does not exists or is already closed.");
            }

            account.Close();

            await accountWriteOnlyRepository.Delete(account);

            CloseOutput output = outputConverter.Map <CloseOutput>(account);

            this.outputBoundary.Populate(output);
        }
Exemplo n.º 2
0
        public async Task Process(CloseInput input)
        {
            Account account = await accountReadOnlyRepository.Get(input.AccountId);

            if (account == null)
            {
                throw new AccountNotFoundException($"The account {input.AccountId} does not exists or is already closed.");
            }

            account.Close();

            var domainEvents = account.GetEvents();
            await bus.Publish(domainEvents);

            CloseOutput response = responseConverter.Map <CloseOutput>(account);

            this.outputBoundary.Populate(response);
        }