Repository navigation
v0.1.10 — fxContext consistency across all FX handlers
Added
-
fxContextis now populated consistently across all four
FX-affected handlers, not justinvoicePaymentSucceeded. The field
was introduced in v0.1.9 but only on invoice payments; this release
closes the consistency hole by populating it onchargeSucceeded,
chargeRefunded, anddisputeFundsWithdrawnas well.Per-handler semantics:
Handler customerAmountsettlementAmountchargeSucceededcharge.amountbt.amountchargeRefundedrefund.amount(per refund)` disputeFundsWithdrawndispute.amountactualClawbackinvoicePaymentSucceededinvoice.amount_paid(+ pro-rated per schedule entry)bt.amount(+ pro-rated)Note on dispute design:
fxContext.settlementAmountis the
actual clawback at dispute time, not theexpectedClawback
computed at the original-charge rate.fxContextdescribes the
conversion that actually happened on the event; the realized FX
gain/loss against the original is already captured by the 7000 line
(when present). Two pieces of information, two slots. -
New
src/util/fxContext.tshouses the sharedbuildFxContext+
withFxhelpers. Previously inlined ininvoicePaymentSucceeded;
now imported by all four FX-aware handlers. -
New fixture
charge_succeeded_fxexercises the chargeSucceeded FX
path end-to-end: USD-50 charge converted to CAD at rate 1.375 →
CAD 68.75 entry withfxContext { USD 5000 / CAD 6875 }. Plus QBO
and Xero exporter goldens.
Changed
- Existing FX fixtures'
expected.jsonregenerated to include the
newfxContextfield:charge_refunded_fx,
dispute_funds_withdrawn_fx,dispute_funds_withdrawn_fx_rate_drift.
Exporter (.qbo.json/.xero.json) goldens unchanged — the
exporters ignorefxContext; it's engine-output metadata only.
Compatibility
Same-currency events on all four handlers continue to omit fxContext
from their JSON output (buildFxContext returns undefined, withFx
returns the entry untouched). Every existing same-currency fixture
passes byte-identical to v0.1.9.