Liking cljdoc? Tell your friends :D
Clojure only.

monero-store.pipeline.checkout

Opening a payment, and applying its settlement.

Two operations and one invariant between them: money is never accepted without what it bought being handed over, and what it bought is never handed over twice. The store's pending -> paid transition is the gate — it is a compare-and-set, so a redelivered notice, a poll that races a webhook, and a retry after a crash all converge on exactly one fulfilment.

Opening a payment, and applying its settlement.

Two operations and one invariant between them: money is never accepted
without what it bought being handed over, and what it bought is never handed
over twice. The store's pending -> paid transition is the gate — it is a
compare-and-set, so a redelivered notice, a poll that races a webhook, and a
retry after a crash all converge on exactly one fulfilment.
raw docstring

grant!clj

(grant! {:keys [rails] :as deps} {:keys [customer item-id reference]})

Open a manual invoice for customer and settle it in the same breath.

The operator path: no API can tell the store that a bank transfer landed, so a person asserts it. reference is whatever proves it to a human later — a transfer id, a bank line, a ticket — and is recorded on the payment so the grant is never unattributable.

Open a manual invoice for `customer` and settle it in the same breath.

The operator path: no API can tell the store that a bank transfer landed, so
a person asserts it. `reference` is whatever proves it to a human later — a
transfer id, a bank line, a ticket — and is recorded on the payment so the
grant is never unattributable.
sourceraw docstring

open!clj

(open! {:keys [store rails callback-base analytics now-fn]
        :or {now-fn (fn* [] (Date.))}
        :as deps}
       {:keys [customer item-id provider-id variants visitor]})

Open a payment for item-id with provider-id, or hand back the one the customer already has.

A customer who reloads the checkout page must not accumulate invoices, so a still-chargeable one for the same item and rail is resumed when its rail can resume it. Otherwise the amount is quoted once, in the rail's own currency, and handed down — a rail never prices an item itself.

:variants — the experiment arms this visitor is in — is recorded ON THE INVOICE rather than only reported, because the settlement that decides whether the experiment worked can arrive days later, from a webhook that knows nothing about the browser that started it.

Returns {:invoice .. :handle ..}. Throws ExceptionInfo (:monero-store/error :quote-required) before writing anything when the price cannot be established.

Open a payment for `item-id` with `provider-id`, or hand back the one the
customer already has.

A customer who reloads the checkout page must not accumulate invoices, so a
still-chargeable one for the same item and rail is resumed when its rail can
resume it. Otherwise the amount is quoted once, in the rail's own currency,
and handed down — a rail never prices an item itself.

`:variants` — the experiment arms this visitor is in — is recorded ON THE
INVOICE rather than only reported, because the settlement that decides
whether the experiment worked can arrive days later, from a webhook that
knows nothing about the browser that started it.

Returns {:invoice .. :handle ..}. Throws ExceptionInfo
(`:monero-store/error :quote-required`) before writing anything when the
price cannot be established.
sourceraw docstring

settle!clj

(settle!
  {:keys [store rails analytics now-fn] :or {now-fn (fn* [] (Date.))} :as deps}
  invoice
  settlement)

Apply settlement to the invoice behind it.

Money against an invoice that was already paid, or whose quote has lapsed, is recorded and reported as :settle/late rather than applied. That decision is made on the resolution alone.

:settle/suspect leaves the invoice open and changes no status.

Returns the SettlementOutcome that was applied, or nil when settlement was produced by a rail other than the invoice's own.

Apply `settlement` to the invoice behind it.

Money against an invoice that was already paid, or whose quote has lapsed, is
recorded and reported as `:settle/late` rather than applied. That decision is
made on the resolution alone.

`:settle/suspect` leaves the invoice open and changes no status.

Returns the SettlementOutcome that was applied, or nil when `settlement` was
produced by a rail other than the invoice's own.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close