cover/Elixir.WalletNotifications.Events.NotificationFailed.html

1 defmodule WalletNotifications.Events.NotificationFailed do
2 @moduledoc "Emitted when a notification delivery fails."
3 @behaviour WalletEvents.DomainEvent
4
5 @impl true
6 7 def event_name, do: "NotificationFailed.v1"
7 @impl true
8 7 def event_version, do: 1
9
10
:-(
def build(notification_id, opts \\ []) do
11 7 %{
12 event_id: WalletSharedKernel.Correlation.new_request_id(),
13 event_name: event_name(),
14 event_version: event_version(),
15 aggregate_id: notification_id,
16 correlation_id: Keyword.get(opts, :correlation_id, WalletSharedKernel.Correlation.new_correlation_id()),
17 occurred_at: DateTime.utc_now(),
18 payload: %{
19 notification_id: notification_id,
20 user_id: Keyword.get(opts, :user_id),
21 channel: Keyword.get(opts, :channel),
22 reason: Keyword.get(opts, :reason)
23 }
24 }
25 end
26 end
Line Hits Source