Exemple #1
0
        public Task HandleAsync(BankIdEvent bankIdEvent)
        {
            var eventId      = new EventId(bankIdEvent.EventTypeId, bankIdEvent.EventTypeName);
            var debugMessage = GetSerializedEventOrError(bankIdEvent);

            _logger.LogDebug(eventId, debugMessage);

            return(Task.CompletedTask);
        }
        public Task HandleAsync(BankIdEvent bankIdEvent)
        {
            var eventId         = new EventId(bankIdEvent.EventTypeId, bankIdEvent.EventTypeName);
            var serializedEvent = JsonSerializer.Serialize(bankIdEvent, bankIdEvent.GetType(), _serializerOptions);

            _logger.LogDebug(eventId, serializedEvent);

            return(Task.CompletedTask);
        }
Exemple #3
0
 private string GetSerializedEventOrError(BankIdEvent bankIdEvent)
 {
     try
     {
         return(JsonSerializer.Serialize(bankIdEvent, bankIdEvent.GetType(), _serializerOptions));
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
        public async Task TriggerAsync(BankIdEvent bankIdEvent)
        {
            ArgumentNullException.ThrowIfNull(nameof(bankIdEvent));

            bankIdEvent.SetContext(_bankIdActiveLoginContext);

            var tasks = new List <Task>();

            foreach (var listener in _listeners)
            {
                tasks.Add(listener.HandleAsync(bankIdEvent));
            }

            await Task.WhenAll(tasks);
        }
Exemple #5
0
 public Task HandleAsync(BankIdEvent bankIdEvent) => bankIdEvent switch
 {
        // Helpers

        private static EventId GetEventId(BankIdEvent e)
        {
            return(new EventId(e.EventTypeId, e.EventTypeName));
        }