diff --git a/apps/machine/src/services/lightning.ts b/apps/machine/src/services/lightning.ts index a2e237f..c4f4d51 100644 --- a/apps/machine/src/services/lightning.ts +++ b/apps/machine/src/services/lightning.ts @@ -795,11 +795,19 @@ function createATMServices( source: 'bitspire', type: 'cash_out', txid: context.txid, + // `fiat_amount` is the customer's transaction value — the bills + // that physically went into (cash-in) or out of (cash-out) the + // machine via the validator/dispenser. Sourced from + // `context.fiatCents` directly; never re-derive downstream from + // sats × rate (those have rounding edges and assume commission + // lives in BTC, which is true today but is exactly the kind of + // invariant we don't want a consumer baking in). + fiat_amount: context.fiatCents / 100, + currency: context.currency, principal_sats: principalSats, fee_sats: feeSats, fee_percent: feePercent, exchange_rate: context.exchangeRate, - currency: context.currency, // bills/cassettes deferred — they're meaningful for cash-in // and for partial-dispense reconciliation, neither of which // is wired on the satmachineadmin side yet (#22, #3).