TerminalLegView
TerminalLegView shows a card-terminal payment in progress, with its status, reader, steps and the way out.
Import
import { TerminalLegView } from '@tallyui/components';Usage
<TerminalLegView
amountMinor={leg.amountMinor}
currency={order.currency}
phase={phase}
outcome={result?.outcome}
failureReason={result?.failureReason}
method={method}
driver={driver}
onCancel={() => driver.cancel?.()}
onRetry={retry}
onChooseAnother={dismiss}
/>It is presentational: the host runs the leg (for example with collectTerminalLeg from @tallyui/pos) and passes its phase. Top to bottom it shows "ON THE TERMINAL" over the amount, one status line, the method and reader name with a Connected badge (and the battery when the driver reports one), and the steps Sent, On terminal, Approved and Captured. While the leg cancels or ends, the last step reached stays marked.
While the terminal starts or waits for a card, a driver that can cancel from the till (capabilities.cancel is 'app') gets a "Cancel on terminal" button; a driver that only cancels on the reader gets the hint "Cancel on the reader". A failed leg reads "Payment failed: {reason}" with a red mark; a cancelled or timed-out leg reads "Payment cancelled" or "Timed out — payment cancelled" with a grey one. Both offer "Try again" and "Choose another way". A captured or authorized leg renders nothing: the host opens the receipt, or the ledger shows the authorized leg.
It follows WCPOS v2's terminal-leg-view.tsx. v2's Details log, the order number and plan heading, the veto, release and capture-retry states, and the captured-but-unfinished notice are later work.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
amountMinor | number | required | The leg's amount in minor units |
currency | string | required | ISO 4217 code of the amount |
phase | TerminalLegPhase | required | 'starting', 'collecting', 'confirming', 'cancelling' or 'final' |
outcome | 'captured' | 'authorized' | 'failed' | 'voided' | null | — | Read when phase is 'final'. With phase 'final' and no outcome, the leg reads as cancelled (grey, Try again). |
failureReason | string | null | — | The driver's reason, e.g. 'card_declined' or 'timed_out'; an unknown reason shows as itself |
method | PaymentMethodDescriptor | required | The leg's payment method; its title names the reader row |
driver | PaymentDriver | required | The method's driver; its status and capabilities.cancel are read |
onCancel | () => void | — | Called by "Cancel on terminal" |
onRetry | () => void | — | Called by "Try again" |
onChooseAnother | () => void | — | Called by "Choose another way" |
testID | string | 'terminal-leg' | Test identifier |
TenderPane
TenderPane is the tender pane for a host that owns the tender reducer, with the balance headline, payment legs, method tiles, keypad, quick-cash chips, Take and Complete sale.
ReaderConnection
ReaderConnection is the pay sheet's one line about the card reader, and reconnects the remembered reader once.