BankAccount::Created.call
BankAccount::Approved.call
BankAccount::Blocked.call
BankAccount::Destroyed.call
BankAccount::TransactionsImported.call
BankAccount::WithdrawalSuccessful.call
a.k.a. update everything!
def WWW
# [...]
BankAccount::Updated.call bank_account_id: id
end
def XXX
# [...]
BankAccount::Updated.call bank_account_id: id
end
def YYY
# [...]
BankAccount::Updated.call bank_account_id: id
end
def ZZZ
# [...]
BankAccount::Updated.call bank_account_id: id
end
def create_bank_account
# [...]
BankAccount::Updated.call bank_account_id: id
end
def approve_bank_account
# [...]
BankAccount::Updated.call bank_account_id: id
end
def import_transactions
# [...]
BankAccount::Updated.call bank_account_id: id
end
def destroy_bank_account
# [...]
BankAccount::Updated.call bank_account_id: id
end
def create_bank_account
# [...]
BankAccount::Created.call bank_account_id: id, organization_id: id, [...]
end
def approve_bank_account
# [...]
BankAccount::Approved.call bank_account_id: id
end
def import_transactions
# [...]
BankAccount::TransactionsReplaced.call bank_account_id: id,
transactions: [...]
end
def destroy_bank_account
# [...]
BankAccount::Destroyed.call bank_account_id: id
end
class BankAccount
class Created
def self.call(bank_account_id: id, organization_id: id, [...])
# [...]
end
end
class Approved
def self.call(bank_account_id: id)
# [...]
end
end
class TransactionsReplaced
def self.call(bank_account_id: id, transactions: [...])
# [...]
end
end
class Destroyed
def self.call(bank_account_id: id)
# [...]
end
end
end
a.k.a. "but someone need this in payload"
BankAccount::Approved.call bank_account_id: id, transactions: [...]
BankAccount::Approved.call bank_account_id: id
class BankAccount::ApprovedHandler
def call(bank_account_id:)
transactions = TransactionsQuery.for_bank_account bank_account_id
Enriched::BankAccount::Approved.call bank_account_id: bank_account_id,
transactions: transactions
end
end