diff --git a/bitspire.py b/bitspire.py index fa5620b..ac0a4b3 100644 --- a/bitspire.py +++ b/bitspire.py @@ -159,7 +159,13 @@ def _parse_extra( # Without exchange rate we can't compute fiat. Use 1.0 as a stand-in # and let the operator correct via manual reconciliation. exchange_rate = 1.0 - fiat_amount = round(gross_sats / exchange_rate, 2) if exchange_rate > 0 else 0.0 + # `fiat_amount` is sourced directly from bitSpire's bill validator / + # dispenser ledger (lamassu-next@8318489). It's the cash that + # physically entered (cash-in) or exited (cash-out) the machine — + # canonical, not derived. We never recompute it from sats × rate + # downstream: the relationship is't load-bearing (commission lives + # in BTC today, but the cash side has its own ground truth). + fiat_amount = _coerce_float(extra.get("fiat_amount")) or 0.0 fiat_code = _coerce_str(extra.get("currency")) or machine.fiat_code return CreateDcaSettlementData( machine_id=machine.id,