Accrue.Billing.Charge (accrue v0.3.0)

Copy Markdown View Source

Ecto schema for the accrue_charges table.

Stores the local projection of a processor charge or payment intent (e.g. Stripe ch_xxx or pi_xxx). Amounts are stored as integers in the smallest currency unit (cents for USD, yen for JPY).

Phase 3 adds Stripe fee tracking (stripe_fee_amount_minor, fees_settled_at) needed by the refund fee-reconciliation path (D3-45).

Summary

Functions

Builds a changeset for creating or updating a Charge.

Types

t()

@type t() :: %Accrue.Billing.Charge{
  __meta__: term(),
  amount_cents: term(),
  currency: term(),
  customer: term(),
  customer_id: term(),
  data: term(),
  fees_settled_at: term(),
  id: term(),
  inserted_at: term(),
  last_stripe_event_id: term(),
  last_stripe_event_ts: term(),
  lock_version: term(),
  metadata: term(),
  payment_method: term(),
  payment_method_id: term(),
  processor: term(),
  processor_id: term(),
  refunds: term(),
  status: term(),
  stripe_fee_amount_minor: term(),
  stripe_fee_currency: term(),
  subscription: term(),
  subscription_id: term(),
  updated_at: term()
}

Functions

changeset(charge_or_changeset, attrs \\ %{})

@spec changeset(
  %Accrue.Billing.Charge{
    __meta__: term(),
    amount_cents: term(),
    currency: term(),
    customer: term(),
    customer_id: term(),
    data: term(),
    fees_settled_at: term(),
    id: term(),
    inserted_at: term(),
    last_stripe_event_id: term(),
    last_stripe_event_ts: term(),
    lock_version: term(),
    metadata: term(),
    payment_method: term(),
    payment_method_id: term(),
    processor: term(),
    processor_id: term(),
    refunds: term(),
    status: term(),
    stripe_fee_amount_minor: term(),
    stripe_fee_currency: term(),
    subscription: term(),
    subscription_id: term(),
    updated_at: term()
  }
  | Ecto.Changeset.t(),
  map()
) :: Ecto.Changeset.t()

Builds a changeset for creating or updating a Charge.