module AccountComponent::Controls::Write::Deposit

Public Class Methods

call(id: nil, account_id: nil, amount: nil) click to toggle source
# File lib/account_component/controls/write/deposit.rb, line 5
def self.call(id: nil, account_id: nil, amount: nil)
  id ||= ID.example
  account_id ||= Account.id
  amount ||= Money.example

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

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

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