Accrue.Processor.Fake.State (accrue v0.3.0)

Copy Markdown View Source

Internal state struct for Accrue.Processor.Fake.

Shape is intentionally wider than Phase 1 needs so Phase 3+ can grow the Fake's callback list without state-shape churn (per-resource counters for subscriptions/invoices/payment_intents/setup_intents/payment_methods/ charges/refunds are already provisioned — D-20, D3-60).

Summary

Functions

The module's epoch DateTime — the value clock is reset to on reset/0.

Types

id()

@type id() :: String.t()

t()

@type t() :: %Accrue.Processor.Fake.State{
  billing_portal_sessions: %{optional(id()) => map()},
  call_counts: %{optional(atom()) => non_neg_integer()},
  charges: %{optional(id()) => map()},
  checkout_sessions: %{optional(id()) => map()},
  clock: DateTime.t(),
  connect_accounts: %{optional(id()) => map()},
  counters: %{
    customer: non_neg_integer(),
    subscription: non_neg_integer(),
    subscription_item: non_neg_integer(),
    subscription_schedule: non_neg_integer(),
    invoice: non_neg_integer(),
    payment_intent: non_neg_integer(),
    setup_intent: non_neg_integer(),
    payment_method: non_neg_integer(),
    charge: non_neg_integer(),
    transfer: non_neg_integer(),
    refund: non_neg_integer(),
    coupon: non_neg_integer(),
    promotion_code: non_neg_integer(),
    checkout_session: non_neg_integer(),
    billing_portal_session: non_neg_integer(),
    connect_account: non_neg_integer(),
    event: non_neg_integer()
  },
  coupons: %{optional(id()) => map()},
  customers: %{optional(id()) => map()},
  idempotency_cache: %{optional(String.t()) => term()},
  invoices: %{optional(id()) => map()},
  meter_events: %{optional(id()) => map()},
  payment_intents: %{optional(id()) => map()},
  payment_methods: %{optional(id()) => map()},
  promotion_codes: %{optional(id()) => map()},
  refunds: %{optional(id()) => map()},
  scripts: %{optional(atom()) => term()},
  setup_intents: %{optional(id()) => map()},
  stubs: %{optional(atom()) => (... -> term())},
  subscription_items: %{optional(id()) => map()},
  subscription_schedules: %{optional(id()) => map()},
  subscriptions: %{optional(id()) => map()},
  transfers: %{optional(id()) => map()}
}

Functions

epoch()

@spec epoch() :: DateTime.t()

The module's epoch DateTime — the value clock is reset to on reset/0.