loans

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const EntityType = "loans"

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregate

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

func New

func New() *Aggregate

New creates a new aggregate with a new ID.

func Reify

func Reify(previousEvents []Event) (*Aggregate, error)

Reify recreates an aggregate from a list of events stored to its current state.

func (*Aggregate) AcceptTermsAndConditions

func (a *Aggregate) AcceptTermsAndConditions(
	term int,
	deferredPct Percent,
	acceptConditions bool,
) error

func (*Aggregate) ConfirmEmail

func (a *Aggregate) ConfirmEmail() error

func (*Aggregate) StartFlow

func (a *Aggregate) StartFlow(cmd StartFlowCmd) error

func (*Aggregate) State

func (a *Aggregate) State() State

type ClientID

type ClientID string

type EmailConfirmed

type EmailConfirmed struct {
	es.Metadata[ID]
}

func (EmailConfirmed) Apply

func (e EmailConfirmed) Apply(snapshot *Snapshot) error

type Event

type Event = es.Event[ID, Snapshot]

type FlowStarted

type FlowStarted struct {
	es.Metadata[ID]
	ClientID      ClientID
	TransactionID string
	TotalAmount   Money
}

func (FlowStarted) Apply

func (f FlowStarted) Apply(state *Snapshot) error

type ID

type ID string

func NewId

func NewId() ID

func (ID) Empty

func (id ID) Empty() bool

func (ID) Eq

func (id ID) Eq(id2 es.EntityID) bool

func (ID) String

func (id ID) String() string

type Money

type Money float64

type Percent

type Percent float64

type PhoneConfirmed

type PhoneConfirmed struct {
	es.Metadata[ID]
}

type Snapshot

type Snapshot struct {
	ID               ID
	Version          int
	ClientID         ClientID
	TransactionID    string
	TotalAmount      Money
	State            State
	Term             int
	DeferredPct      Percent
	IsEmailConfirmed bool
}

func (Snapshot) SetVersion

func (s Snapshot) SetVersion(version int)

type StartFlowCmd

type StartFlowCmd struct {
	ClientID      ClientID
	TransactionID string
	TotalAmount   Money
}

type State

type State string
const (
	Started   State = "started"
	Accepted  State = "accepted"
	Confirmed State = "confirmed"
)

type TermsAndConditionsAccepted

type TermsAndConditionsAccepted struct {
	es.Metadata[ID]

	Term             int
	DeferredPct      Percent
	AcceptConditions bool
}

func (TermsAndConditionsAccepted) Apply

func (t TermsAndConditionsAccepted) Apply(snapshot *Snapshot) error

Jump to

Keyboard shortcuts

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