commands

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package commands contains the application's command message definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApproveDeposit

type ApproveDeposit struct {
	TransactionID string
	AccountID     string
	Amount        int64
}

ApproveDeposit is a command that approves an account deposit.

func (*ApproveDeposit) MarshalBinary

func (m *ApproveDeposit) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*ApproveDeposit) MessageDescription

func (m *ApproveDeposit) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*ApproveDeposit) UnmarshalBinary

func (m *ApproveDeposit) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*ApproveDeposit) Validate

Validate returns a non-nil error if the message is invalid.

type ApproveTransfer

type ApproveTransfer struct {
	TransactionID string
	FromAccountID string
	ToAccountID   string
	Amount        int64
}

ApproveTransfer is a command that approves an account transfer.

func (*ApproveTransfer) MarshalBinary

func (m *ApproveTransfer) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*ApproveTransfer) MessageDescription

func (m *ApproveTransfer) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*ApproveTransfer) UnmarshalBinary

func (m *ApproveTransfer) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*ApproveTransfer) Validate

Validate returns a non-nil error if the message is invalid.

type ApproveWithdrawal

type ApproveWithdrawal struct {
	TransactionID string
	AccountID     string
	Amount        int64
}

ApproveWithdrawal is a command that approves an account withdrawal.

func (*ApproveWithdrawal) MarshalBinary

func (m *ApproveWithdrawal) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*ApproveWithdrawal) MessageDescription

func (m *ApproveWithdrawal) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*ApproveWithdrawal) UnmarshalBinary

func (m *ApproveWithdrawal) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*ApproveWithdrawal) Validate

Validate returns a non-nil error if the message is invalid.

type ConsumeDailyDebitLimit

type ConsumeDailyDebitLimit struct {
	TransactionID string
	AccountID     string
	DebitType     messages.TransactionType
	Amount        int64
	Date          string
}

ConsumeDailyDebitLimit is a command requesting that an amount of an account daily debit limit be consumed.

func (*ConsumeDailyDebitLimit) MarshalBinary

func (m *ConsumeDailyDebitLimit) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*ConsumeDailyDebitLimit) MessageDescription

func (m *ConsumeDailyDebitLimit) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*ConsumeDailyDebitLimit) UnmarshalBinary

func (m *ConsumeDailyDebitLimit) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*ConsumeDailyDebitLimit) Validate

Validate returns a non-nil error if the message is invalid.

type CreditAccount

type CreditAccount struct {
	TransactionID   string
	AccountID       string
	TransactionType messages.TransactionType
	Amount          int64
}

CreditAccount is a command that requests a bank account be credited.

func (*CreditAccount) MarshalBinary

func (m *CreditAccount) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*CreditAccount) MessageDescription

func (m *CreditAccount) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*CreditAccount) UnmarshalBinary

func (m *CreditAccount) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*CreditAccount) Validate

Validate returns a non-nil error if the message is invalid.

type CreditThirdPartyAccount

type CreditThirdPartyAccount struct {
	TransactionID string
	AccountID     string
	Amount        int64
}

CreditThirdPartyAccount is a command to credit an account held at a third-party bank.

func (*CreditThirdPartyAccount) MarshalBinary

func (m *CreditThirdPartyAccount) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*CreditThirdPartyAccount) MessageDescription

func (m *CreditThirdPartyAccount) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*CreditThirdPartyAccount) UnmarshalBinary

func (m *CreditThirdPartyAccount) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*CreditThirdPartyAccount) Validate

Validate returns a non-nil error if the message is invalid.

type DebitAccount

type DebitAccount struct {
	TransactionID   string
	AccountID       string
	TransactionType messages.TransactionType
	Amount          int64
	ScheduledTime   time.Time
}

DebitAccount is a command that requests a bank account be debited.

func (*DebitAccount) MarshalBinary

func (m *DebitAccount) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*DebitAccount) MessageDescription

func (m *DebitAccount) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*DebitAccount) UnmarshalBinary

func (m *DebitAccount) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*DebitAccount) Validate

Validate returns a non-nil error if the message is invalid.

type DeclineTransfer

type DeclineTransfer struct {
	TransactionID string
	FromAccountID string
	ToAccountID   string
	Amount        int64
	Reason        messages.DebitFailureReason
}

DeclineTransfer is a command that rejects an account transfer.

func (*DeclineTransfer) MarshalBinary

func (m *DeclineTransfer) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*DeclineTransfer) MessageDescription

func (m *DeclineTransfer) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*DeclineTransfer) UnmarshalBinary

func (m *DeclineTransfer) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*DeclineTransfer) Validate

Validate returns a non-nil error if the message is invalid.

type DeclineWithdrawal

type DeclineWithdrawal struct {
	TransactionID string
	AccountID     string
	Amount        int64
	Reason        messages.DebitFailureReason
}

DeclineWithdrawal is a command that rejects an account withdrawal.

func (*DeclineWithdrawal) MarshalBinary

func (m *DeclineWithdrawal) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*DeclineWithdrawal) MessageDescription

func (m *DeclineWithdrawal) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*DeclineWithdrawal) UnmarshalBinary

func (m *DeclineWithdrawal) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*DeclineWithdrawal) Validate

Validate returns a non-nil error if the message is invalid.

type Deposit

type Deposit struct {
	TransactionID string
	AccountID     string
	Amount        int64
}

Deposit is a command requesting that funds be deposited into a bank account.

func (*Deposit) MarshalBinary

func (m *Deposit) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*Deposit) MessageDescription

func (m *Deposit) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*Deposit) UnmarshalBinary

func (m *Deposit) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*Deposit) Validate

Validate returns a non-nil error if the message is invalid.

type MarkTransferAsFailed

type MarkTransferAsFailed struct {
	TransactionID string
	FromAccountID string
	ToAccountID   string
	Amount        int64
}

MarkTransferAsFailed is a command that marks an account transfer as failed due to an operational error that occurred after the transfer was initiated.

func (*MarkTransferAsFailed) MarshalBinary

func (m *MarkTransferAsFailed) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*MarkTransferAsFailed) MessageDescription

func (m *MarkTransferAsFailed) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*MarkTransferAsFailed) UnmarshalBinary

func (m *MarkTransferAsFailed) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*MarkTransferAsFailed) Validate

Validate returns a non-nil error if the message is invalid.

type OpenAccount

type OpenAccount struct {
	CustomerID  string
	AccountID   string
	AccountName string
}

OpenAccount is a command requesting that a new bank account be opened for an existing customer.

func (*OpenAccount) MarshalBinary

func (m *OpenAccount) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*OpenAccount) MessageDescription

func (m *OpenAccount) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*OpenAccount) UnmarshalBinary

func (m *OpenAccount) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*OpenAccount) Validate

Validate returns a non-nil error if the message is invalid.

type OpenAccountForNewCustomer

type OpenAccountForNewCustomer struct {
	CustomerID   string
	CustomerName string
	AccountID    string
	AccountName  string
}

OpenAccountForNewCustomer is a command requesting that a new bank account be opened for a new customer.

func (*OpenAccountForNewCustomer) MarshalBinary

func (m *OpenAccountForNewCustomer) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*OpenAccountForNewCustomer) MessageDescription

func (m *OpenAccountForNewCustomer) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*OpenAccountForNewCustomer) UnmarshalBinary

func (m *OpenAccountForNewCustomer) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*OpenAccountForNewCustomer) Validate

Validate returns a non-nil error if the message is invalid.

type Transfer

type Transfer struct {
	TransactionID    string
	FromAccountID    string
	ToAccountID      string
	ToThirdPartyBank bool
	Amount           int64
	ScheduledTime    time.Time
}

Transfer is a command requesting that funds be transferred from one bank account to another.

func (*Transfer) MarshalBinary

func (m *Transfer) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*Transfer) MessageDescription

func (m *Transfer) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*Transfer) UnmarshalBinary

func (m *Transfer) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*Transfer) Validate

Validate returns a non-nil error if the message is invalid.

type Withdraw

type Withdraw struct {
	TransactionID string
	AccountID     string
	Amount        int64
	ScheduledTime time.Time
}

Withdraw is a command requesting that funds be withdrawn from a bank account.

func (*Withdraw) MarshalBinary

func (m *Withdraw) MarshalBinary() ([]byte, error)

MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.

func (*Withdraw) MessageDescription

func (m *Withdraw) MessageDescription() string

MessageDescription returns a human-readable description of the message.

func (*Withdraw) UnmarshalBinary

func (m *Withdraw) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.

func (*Withdraw) Validate

Validate returns a non-nil error if the message is invalid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL