Settlement by asking. A rail that cannot call the store must be polled, or its invoices never settle at all — and a rail that can call is polled anyway, because a webhook that was never delivered leaves money sitting in a wallet.
The poll drives the same checkout/settle! path a notice does, so a payment
seen twice still buys exactly one period.
Settlement by asking. A rail that cannot call the store must be polled, or its invoices never settle at all — and a rail that can call is polled anyway, because a webhook that was never delivered leaves money sitting in a wallet. The poll drives the same `checkout/settle!` path a notice does, so a payment seen twice still buys exactly one period.
(expire-stale! {:keys [store now-fn] :or {now-fn (fn* [] (Date.))}})Mark every open invoice whose quote has lapsed :expired.
Runs after the read, never before it: money that arrived inside the window and is only now being noticed must still settle normally. Returns the ids that moved.
Mark every open invoice whose quote has lapsed `:expired`. Runs after the read, never before it: money that arrived inside the window and is only now being noticed must still settle normally. Returns the ids that moved.
(reconcile! {:keys [rails] :as deps} invoice)Ask invoice's rail what it has seen and apply it.
Returns the applied SettlementOutcome variant, or nil. One invoice's failure is its own: it is logged and the sweep continues, because a wallet that is briefly unreachable must not stop every other invoice from settling.
Ask `invoice`'s rail what it has seen and apply it. Returns the applied SettlementOutcome variant, or nil. One invoice's failure is its own: it is logged and the sweep continues, because a wallet that is briefly unreachable must not stop every other invoice from settling.
(start! deps {:keys [interval-ms] :or {interval-ms 60000}})Sweep every :interval-ms on a daemon thread. Returns a stop function.
A sweep that throws must not kill the schedule, so the top of each run is
guarded: scheduleWithFixedDelay cancels the task forever on the first
escaping throwable, silently.
Sweep every `:interval-ms` on a daemon thread. Returns a stop function. A sweep that throws must not kill the schedule, so the top of each run is guarded: `scheduleWithFixedDelay` cancels the task forever on the first escaping throwable, silently.
(sweep! {:keys [store] :as deps})Reconcile every open invoice, then retire the ones whose window has closed.
Returns the applied outcomes by count, plus how many invoices expired.
Reconcile every open invoice, then retire the ones whose window has closed. Returns the applied outcomes by count, plus how many invoices expired.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |