Exemplo n.º 1
0
        private List <Task> RaiseEventsToRevokePermission(IEnumerable <EmployerInfo> employers, long ukprn)
        {
            var tasks = new List <Task>();

            foreach (var employer in employers)
            {
                if (employer.LegalEntities == null)
                {
                    continue;
                }

                foreach (var legalEntity in employer.LegalEntities)
                {
                    _logger.LogInformation($"Queuing to revoke provider {ukprn} permission on account {employer.EmployerAccountId} for legal entity {legalEntity.LegalEntityId}.");
                    var providerBlockedOnLegalEntityEvent = new ProviderBlockedOnLegalEntityEvent()
                    {
                        Ukprn             = ukprn,
                        EmployerAccountId = employer.EmployerAccountId,
                        LegalEntityId     = legalEntity.LegalEntityId,
                        AccountLegalEntityPublicHashedId = legalEntity.AccountLegalEntityPublicHashedId
                    };

                    tasks.Add(_messaging.PublishEvent(providerBlockedOnLegalEntityEvent));
                }
            }
            return(tasks);
        }
Exemplo n.º 2
0
 public Task Handle(ProviderBlockedOnLegalEntityEvent notification, CancellationToken cancellationToken)
 => HandleUsingEventStore(notification);