Accrue.Entitlements.Reconcile (accrue v1.5.1)

Copy Markdown View Source

Shared writer for advisory entitlement-summary snapshots.

Webhooks and pull refreshes both reduce to the same summary-shaped Accrue.Billing.EntitlementSummary row. This module owns only that observational cache write; grant decisions remain local-only.

Summary

Types

source()

@type source() :: :webhook | :pull

Functions

write_pull(customer, pull_started_at, data, list_path)

@spec write_pull(Accrue.Billing.Customer.t(), DateTime.t(), [map()], String.t()) ::
  {:ok, Accrue.Billing.EntitlementSummary.t() | :unchanged | :stale}
  | {:error, term()}

write_webhook(evt_id, evt_ts, obj, processor)

@spec write_webhook(String.t() | nil, DateTime.t() | nil, map(), atom() | String.t()) ::
  {:ok, Accrue.Billing.EntitlementSummary.t() | :stale | :deferred | :ignored}
  | {:error, term()}