account

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBalanceIsNotHighEnough = errors.New("balance is not high enough")

ErrBalanceIsNotHighEnough happens when balance is not high enough.

Functions

This section is empty.

Types

type Aggregate

type Aggregate struct {
	// contains filtered or unexported fields
}

Aggregate handles operations with an account.

func NewAggregate

func NewAggregate(ID domain.Identifier) *Aggregate

NewAggregate creates a new instance of *Aggregate.

func (*Aggregate) AggregateID

func (a *Aggregate) AggregateID() domain.Identifier

AggregateID returns aggregate ID.

func (*Aggregate) AggregateType

func (a *Aggregate) AggregateType() string

AggregateType return aggregate type.

func (*Aggregate) DepositMoney

func (a *Aggregate) DepositMoney(c command.DepositMoney) ([]domain.Event, error)

DepositMoney credits the account.

func (*Aggregate) OnAccountOpened

func (a *Aggregate) OnAccountOpened(e event.AccountOpened)

OnAccountOpened handles AccountOpened event.

func (*Aggregate) OnMoneyDeposited

func (a *Aggregate) OnMoneyDeposited(e event.MoneyDeposited)

OnMoneyDeposited handles MoneyDeposited event.

func (*Aggregate) OnMoneyWithdrawn

func (a *Aggregate) OnMoneyWithdrawn(e event.MoneyWithdrawn)

OnMoneyWithdrawn handles MoneyWithdrawn event.

func (*Aggregate) OpenAccount

func (a *Aggregate) OpenAccount(c command.OpenAccount) ([]domain.Event, error)

OpenAccount opens a new account with a given number.

func (*Aggregate) WithdrawMoney

func (a *Aggregate) WithdrawMoney(c command.WithdrawMoney) ([]domain.Event, error)

WithdrawMoney debits the account.

Jump to

Keyboard shortcuts

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