publish_all :create, [:budget_id] do
transform fn notification ->
transfer = notification.data
case App.Finance.get_account(transfer.from_account_id, tenant: transfer.organization_id, authorize?: false) do
{:ok, account} ->
%{notification | data: Map.put(transfer, :budget_id, account.budget_id)}
{:error, error} ->
notification
end
end
end
publish_all :create, [:budget_id] do
transform fn notification ->
transfer = notification.data
case App.Finance.get_account(transfer.from_account_id, tenant: transfer.organization_id, authorize?: false) do
{:ok, account} ->
%{notification | data: Map.put(transfer, :budget_id, account.budget_id)}
{:error, error} ->
notification
end
end
end