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) AcceptCredit(ctx context.Context, maxPrice currency.Amount, mainAlive *alive.Alive, ...) error
- func (ms *MoneySystem) AddDirty(dirty currency.Amount)
- func (ms *MoneySystem) BillEscrow() currency.Amount
- func (ms *MoneySystem) BillEscrowReject()
- func (ms *MoneySystem) BillEscrowToStacker()
- func (ms *MoneySystem) GetCredit() currency.Amount
- func (ms *MoneySystem) GetDirty() currency.Amount
- func (ms *MoneySystem) GetGiftCredit() currency.Amount
- func (ms *MoneySystem) ResetMoney()
- func (ms *MoneySystem) ReturnDirty() error
- func (ms *MoneySystem) ReturnMoney() error
- 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) TestingDispense()
- func (ms *MoneySystem) WaitEscrowAccept(amount currency.Amount) (wait bool)
- 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(ctx context.Context, amount currency.Amount) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type MoneySystem ¶
type MoneySystem struct {
Log *log2.Log
CoinValidator *coin.CoinAcceptor
// contains filtered or unexported fields
}
func GetGlobal ¶
func GetGlobal(ctx context.Context) *MoneySystem
func (*MoneySystem) AcceptCredit ¶
func (*MoneySystem) AddDirty ¶
func (ms *MoneySystem) AddDirty(dirty currency.Amount)
func (*MoneySystem) BillEscrow ¶ added in v0.250402.0
func (ms *MoneySystem) BillEscrow() currency.Amount
func (*MoneySystem) BillEscrowReject ¶ added in v0.230424.2
func (ms *MoneySystem) BillEscrowReject()
func (*MoneySystem) BillEscrowToStacker ¶ added in v0.230424.2
func (ms *MoneySystem) BillEscrowToStacker()
func (*MoneySystem) GetCredit ¶ added in v0.230424.2
func (ms *MoneySystem) GetCredit() currency.Amount
func (*MoneySystem) GetDirty ¶
func (ms *MoneySystem) GetDirty() currency.Amount
func (*MoneySystem) GetGiftCredit ¶
func (ms *MoneySystem) GetGiftCredit() currency.Amount
func (*MoneySystem) ResetMoney ¶
func (ms *MoneySystem) ResetMoney()
func (*MoneySystem) ReturnDirty ¶ added in v0.230424.2
func (ms *MoneySystem) ReturnDirty() error
ReturnDirty gives back the withdrawn-but-uncommitted amount (see WithdrawPrepare) when the order it was reserved for didn't complete. dirty is cleared only once the money has actually left the machine — if there's no validator to dispense through, or the dispense itself fails, dirty stays as-is so the amount isn't silently dropped from the books while still physically unreturned.
func (*MoneySystem) ReturnMoney ¶ added in v0.230424.2
func (ms *MoneySystem) ReturnMoney() error
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) TestingDispense ¶ added in v0.231111.0
func (ms *MoneySystem) TestingDispense()
func (*MoneySystem) WaitEscrowAccept ¶ added in v0.230424.2
func (ms *MoneySystem) WaitEscrowAccept(amount currency.Amount) (wait bool)
func (*MoneySystem) WithdrawCommit ¶
WithdrawCommit Store spending to durable memory, no user initiated return after this point.
func (*MoneySystem) WithdrawPrepare ¶
возвращаем сдачу. если неполучиться приготовить то вернем стоимость напитка
func (*MoneySystem) XXX_InjectCoin ¶
XXX_InjectCoin is a test helper: it credits the given amount the same way coin.CoinRun does on a real CoinCredit event, then notifies the running UI so the front screen refreshes — a direct balance mutation alone is invisible to the UI loop, which only reacts to events on its channel. EnsureValid is needed because in tests there is no real CoinValidator to call SetValid with the supported nominals — without it, Add silently rejects the amount (nominal group considers it invalid).