@@ -15,6 +15,8 @@ defmodule Helix.Universe.Bank.Action.Flow.BankAccount do
1515
1616 alias Helix.Universe.Bank.Process.Bank.Account.RevealPassword ,
1717 as: BankAccountRevealPasswordProcess
18+ alias Helix.Universe.Bank.Process.Bank.Account.ChangePassword ,
19+ as: BankAccountChangePasswordProcess
1820
1921 @ typep relay :: Event . relay
2022
@@ -46,6 +48,33 @@ defmodule Helix.Universe.Bank.Action.Flow.BankAccount do
4648 BankAccountRevealPasswordProcess . execute ( gateway , atm , params , meta , relay )
4749 end
4850
51+ @ spec open ( Account . id , ATM . id ) ::
52+ { :ok , BankAccount . t }
53+ | { :error , :internal }
54+ def open ( account_id , atm_id ) do
55+ bank_account =
56+ BankAction . open_account ( account_id , atm_id )
57+ case bank_account do
58+ { :ok , bank_account } ->
59+ { :ok , bank_account }
60+ { :error , _ } ->
61+ { :error , :internal }
62+ end
63+ end
64+
65+ @ spec change_password ( BankAccount . t , Server . t , Server . t , relay ) ::
66+ { :ok , Process . t }
67+ | BankAccountChangePasswordProcess . executable_error
68+ def change_password ( account , gateway , atm , relay ) do
69+ meta = % {
70+ network_id: NetworkQuery . internet ( ) . network_id ,
71+ src_atm_id: atm . server_id ,
72+ src_acc_number: account . account_number ,
73+ bounce: nil
74+ }
75+
76+ BankAccountChangePasswordProcess . execute ( gateway , atm , % { } , meta , relay )
77+ end
4978 @ doc """
5079 Logs into a bank account using a password. If the given password matches the
5180 current account password, the login is successful, in which case a BankLogin
@@ -74,9 +103,9 @@ defmodule Helix.Universe.Bank.Action.Flow.BankAccount do
74103 { :ok , _ , events } <- BankAction . login_password ( acc , password , entity ) ,
75104 on_success ( fn -> Event . emit ( events ) end ) ,
76105
77- { :ok , _ , connection } <- start_connection . ( )
106+ { :ok , tunnel , connection } <- start_connection . ( )
78107 do
79- { :ok , connection }
108+ { :ok , tunnel , connection }
80109 end
81110 end
82111 end
0 commit comments