client

package
v0.0.0-...-a42c888 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientNotFound     = errors.New("client not found")
	ErrClientCannotAfford = errors.New("client cannot afford this transaction")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	ID      string
	Limit   int
	Balance int
}

func NewClient

func NewClient(id string, limit int, balance int) *Client

func (*Client) AddTransaction

func (c *Client) AddTransaction(value int, kind string)

func (*Client) CanAfford

func (c *Client) CanAfford(value int, kind string) bool

type CreateTransaction

type CreateTransaction struct {
	Repository Repository
}

func NewCreateTransaction

func NewCreateTransaction(repository Repository) *CreateTransaction

func (*CreateTransaction) Execute

func (c *CreateTransaction) Execute(clientID string, value int, kind string, description string) (*models.ClientTransactionResponse, error)

type GetClientExtract

type GetClientExtract struct {
	Repository Repository
}

func NewGetClientExtract

func NewGetClientExtract(repository Repository) *GetClientExtract

func (*GetClientExtract) Execute

func (c *GetClientExtract) Execute(clientID string) (*models.GetClientExtractResponse, error)

type Repository

type Repository interface {
	CreateTransaction(clientID string, value int, kind string, description string) (*models.ClientTransactionResponse, error)
	GetClientExtract(clientID string) (*models.GetClientExtractResponse, error)
}

Jump to

Keyboard shortcuts

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