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 ¶
- Variables
- func GetCurrentPrice(ctx context.Context) currency.Amount
- func SetCurrentPrice(ctx context.Context, p currency.Amount) context.Context
- type MoneySystem
- func (ms *MoneySystem) Abort(ctx context.Context) error
- func (ms *MoneySystem) AcceptCredit(ctx context.Context, maxPrice currency.Amount, stopAccept <-chan struct{}, ...) error
- func (ms *MoneySystem) AddDirty(dirty currency.Amount)
- func (ms *MoneySystem) Credit(ctx context.Context) currency.Amount
- func (ms *MoneySystem) GetDirty() currency.Amount
- func (ms *MoneySystem) GetGiftCredit() currency.Amount
- func (ms *MoneySystem) ResetMoney()
- func (ms *MoneySystem) SetAcceptMax(ctx context.Context, limit currency.Amount) error
- func (ms *MoneySystem) SetDirty(dirty currency.Amount)
- func (ms *MoneySystem) SetGiftCredit(ctx context.Context, value currency.Amount)
- func (ms *MoneySystem) Start(ctx context.Context) error
- func (ms *MoneySystem) Stop(ctx context.Context) error
- func (ms *MoneySystem) TeleCashbox(ctx context.Context) *tele_api.Telemetry_Money
- func (ms *MoneySystem) TeleChange(ctx context.Context) *tele_api.Telemetry_Money
- func (ms *MoneySystem) WithdrawCommit(ctx context.Context, amount currency.Amount) error
- func (ms *MoneySystem) WithdrawPrepare(ctx context.Context, amount currency.Amount) error
- func (ms *MoneySystem) XXX_InjectCoin(n currency.Nominal) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNeedMoreMoney = errors.New("add-money") ErrChangeRetainOverflow = errors.New("ReturnChange(retain>total)") )
Functions ¶
Types ¶
type MoneySystem ¶
func GetGlobal ¶
func GetGlobal(ctx context.Context) *MoneySystem
func (*MoneySystem) Abort ¶
func (ms *MoneySystem) Abort(ctx context.Context) error
Abort Release bill escrow + inserted coins returns error *only* if unable to return all money
func (*MoneySystem) AcceptCredit ¶
func (*MoneySystem) AddDirty ¶
func (ms *MoneySystem) AddDirty(dirty currency.Amount)
func (*MoneySystem) GetDirty ¶
func (ms *MoneySystem) GetDirty() currency.Amount
func (*MoneySystem) GetGiftCredit ¶
func (ms *MoneySystem) GetGiftCredit() currency.Amount
GetGiftCredit TODO replace with WithdrawPrepare() -> []Spending{Cash: ..., Gift: ...}
func (*MoneySystem) ResetMoney ¶
func (ms *MoneySystem) ResetMoney()
func (*MoneySystem) SetAcceptMax ¶
func (*MoneySystem) SetDirty ¶
func (ms *MoneySystem) SetDirty(dirty currency.Amount)
func (*MoneySystem) SetGiftCredit ¶
func (ms *MoneySystem) SetGiftCredit(ctx context.Context, value currency.Amount)
func (*MoneySystem) TeleCashbox ¶
func (ms *MoneySystem) TeleCashbox(ctx context.Context) *tele_api.Telemetry_Money
TeleCashbox Stored in one-way cashbox Telemetry_Money
func (*MoneySystem) TeleChange ¶
func (ms *MoneySystem) TeleChange(ctx context.Context) *tele_api.Telemetry_Money
TeleChange Dispensable Telemetry_Money
func (*MoneySystem) WithdrawCommit ¶
WithdrawCommit Store spending to durable memory, no user initiated return after this point.
func (*MoneySystem) WithdrawPrepare ¶
func (*MoneySystem) XXX_InjectCoin ¶
func (ms *MoneySystem) XXX_InjectCoin(n currency.Nominal) error
Click to show internal directories.
Click to hide internal directories.