Module: AccountComponent::Controls::Write::Withdraw

Defined in:
lib/account_component/controls/write/withdraw.rb

Class Method Summary collapse

Class Method Details

.call(id: nil, account_id: nil, amount: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/account_component/controls/write/withdraw.rb', line 5

def self.call(id: nil, account_id: nil, amount: nil)
  id ||= ID.example
   ||= Account.id
  amount ||= Money.example

  deposit = Commands::Withdraw.example(
    id: id,
    account_id: ,
    amount: amount
  )

  stream_name = Messaging::StreamName.command_stream_name(id, 'account')

  Messaging::Postgres::Write.(deposit, stream_name)
end