| 1 |
|
defmodule WalletJourney.Commands.StartJourney do |
| 2 |
|
@moduledoc """ |
| 3 |
|
Command handler for starting a new transfer journey. |
| 4 |
|
|
| 5 |
|
Delegates to `WalletJourney.Coordinator.execute_journey/1` to run the full |
| 6 |
|
orchestration pipeline synchronously. |
| 7 |
|
|
| 8 |
|
Returns `{:ok, journey}` on success or `{:error, reason, journey}` on failure. |
| 9 |
|
""" |
| 10 |
|
|
| 11 |
|
alias WalletJourney.Coordinator |
| 12 |
|
|
| 13 |
|
@doc """ |
| 14 |
|
Executes the start journey command. |
| 15 |
|
|
| 16 |
|
Required params: :user_id, :from_account_id, :to_account_id, :amount, :currency |
| 17 |
|
Optional params: :tier, :transfer_type, :idempotency_key, :correlation_id, :metadata |
| 18 |
|
|
| 19 |
|
Returns `{:ok, journey}` or `{:error, reason, journey}`. |
| 20 |
|
""" |
| 21 |
|
@spec execute(params :: map()) :: {:ok, term()} | {:error, term(), term()} |
| 22 |
|
def execute(params) do |
| 23 |
:-( |
Coordinator.execute_journey(params) |
| 24 |
|
end |
| 25 |
|
end |