money

package
v0.210504.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: CC0-1.0 Imports: 17 Imported by: 0

Documentation

Overview

Package money provides high-level interaction with money devices. Overview:

  • head->money: enable accepting coins and bills inits required devices, starts polling
  • (parsed device status) money->ui: X money inserted
  • head->money: (ready to serve product) secure transaction, release change

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNeedMoreMoney        = errors.New("add-money")
	ErrChangeRetainOverflow = errors.New("ReturnChange(retain>total)")
)

Functions

func GetCurrentPrice

func GetCurrentPrice(ctx context.Context) currency.Amount

func SetCurrentPrice

func SetCurrentPrice(ctx context.Context, p currency.Amount) context.Context

Types

type MoneySystem

type MoneySystem struct {
	Log *log2.Log
	// contains filtered or unexported fields
}

func GetGlobal

func GetGlobal(ctx context.Context) *MoneySystem

func (*MoneySystem) Abort

func (self *MoneySystem) Abort(ctx context.Context) error

Release bill escrow + inserted coins returns error *only* if unable to return all money

func (*MoneySystem) AcceptCredit

func (self *MoneySystem) AcceptCredit(ctx context.Context, maxPrice currency.Amount, stopAccept <-chan struct{}, out chan<- types.Event) error

func (*MoneySystem) AddDirty added in v0.210323.0

func (ms *MoneySystem) AddDirty(dirty currency.Amount)

func (*MoneySystem) Credit

func (self *MoneySystem) Credit(ctx context.Context) currency.Amount

func (*MoneySystem) GetDirty added in v0.210323.0

func (ms *MoneySystem) GetDirty() currency.Amount

func (*MoneySystem) GetGiftCredit

func (self *MoneySystem) GetGiftCredit() currency.Amount

TODO replace with WithdrawPrepare() -> []Spending{Cash: ..., Gift: ...}

func (*MoneySystem) ResetMoney added in v0.210323.0

func (ms *MoneySystem) ResetMoney()

func (*MoneySystem) SetAcceptMax

func (self *MoneySystem) SetAcceptMax(ctx context.Context, limit currency.Amount) error

func (*MoneySystem) SetDirty added in v0.210323.0

func (ms *MoneySystem) SetDirty(dirty currency.Amount)

func (*MoneySystem) SetGiftCredit

func (self *MoneySystem) SetGiftCredit(ctx context.Context, value currency.Amount)

func (*MoneySystem) Start

func (self *MoneySystem) Start(ctx context.Context) error

func (*MoneySystem) Stop

func (self *MoneySystem) Stop(ctx context.Context) error

func (*MoneySystem) TeleCashbox

func (self *MoneySystem) TeleCashbox(ctx context.Context) *tele_api.Telemetry_Money

Stored in one-way cashbox Telemetry_Money

func (*MoneySystem) TeleChange

func (self *MoneySystem) TeleChange(ctx context.Context) *tele_api.Telemetry_Money

Dispensable Telemetry_Money

func (*MoneySystem) WithdrawCommit

func (self *MoneySystem) WithdrawCommit(ctx context.Context, amount currency.Amount) error

Store spending to durable memory, no user initiated return after this point.

func (*MoneySystem) WithdrawPrepare

func (self *MoneySystem) WithdrawPrepare(ctx context.Context, amount currency.Amount) error

func (*MoneySystem) XXX_InjectCoin

func (self *MoneySystem) XXX_InjectCoin(n currency.Nominal) error

Jump to

Keyboard shortcuts

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