feat(machine): record failed dispenses and per-cassette tracking
Failed dispenses (sats debited, cash not dispensed) were invisible —
transactions only recorded on 'complete'. Now records on 'dispenseError'
with status ('dispense_error'|'partial'|'complete'), error message, and
per-cassette detail.
Also fixes a bug in both HAL services where dispense results were mapped
by amounts-array index instead of cassette position, causing swapped
denomination counts when cassette order differs from request order.
Schema v3→v4: adds status/error columns to transactions, new
cassette_bills table for per-cassette provisioned/dispensed/rejected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3ab03d05ac
commit
a21865ff20
10 changed files with 287 additions and 53 deletions
|
|
@ -55,9 +55,23 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
recordTransaction: (tx: {
|
||||
txid: string
|
||||
type: 'cash_in' | 'cash_out'
|
||||
status: 'complete' | 'dispense_error' | 'partial'
|
||||
fiatCents: number
|
||||
sats: number
|
||||
feeSats: number
|
||||
feePercent: number
|
||||
exchangeRate: number
|
||||
currency: string
|
||||
bills: { denomination: number; count: number }[]
|
||||
cassettes?: {
|
||||
name: string
|
||||
position: number
|
||||
denomination: number
|
||||
provisioned: number
|
||||
dispensed: number
|
||||
rejected: number
|
||||
}[]
|
||||
error?: string | null
|
||||
}) => ipcRenderer.invoke('state:record-transaction', tx),
|
||||
emptyCashbox: () => ipcRenderer.invoke('state:empty-cashbox'),
|
||||
|
||||
|
|
@ -114,9 +128,23 @@ declare global {
|
|||
recordTransaction: (tx: {
|
||||
txid: string
|
||||
type: 'cash_in' | 'cash_out'
|
||||
status: 'complete' | 'dispense_error' | 'partial'
|
||||
fiatCents: number
|
||||
sats: number
|
||||
feeSats: number
|
||||
feePercent: number
|
||||
exchangeRate: number
|
||||
currency: string
|
||||
bills: { denomination: number; count: number }[]
|
||||
cassettes?: {
|
||||
name: string
|
||||
position: number
|
||||
denomination: number
|
||||
provisioned: number
|
||||
dispensed: number
|
||||
rejected: number
|
||||
}[]
|
||||
error?: string | null
|
||||
}) => Promise<void>
|
||||
emptyCashbox: () => Promise<void>
|
||||
// HAL hardware IPC
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue