Accrue.Billing.PaymentMethod (accrue v0.3.0)

Copy Markdown View Source

Ecto schema for the accrue_payment_methods table.

Stores processor-side payment method references (e.g. Stripe pm_xxx). Card details are stored as Stripe references (brand, last4, expiry), never as raw PAN or PII (CLAUDE.md security constraint).

Phase 3 adds:

  • exp_month / exp_year — top-level expiry used by the expiring-card notice scheduler (alias for the card_exp_* columns already in place)
  • last_stripe_event_ts / last_stripe_event_id — webhook watermark
  • virtual existing? — set by the attach_payment_method/2 dedup path (Plan 06) when fingerprint matches an existing row on the customer

Summary

Functions

Builds a changeset for creating or updating a PaymentMethod.

Types

t()

@type t() :: %Accrue.Billing.PaymentMethod{
  __meta__: term(),
  card_brand: term(),
  card_exp_month: term(),
  card_exp_year: term(),
  card_last4: term(),
  customer: term(),
  customer_id: term(),
  data: term(),
  existing?: term(),
  exp_month: term(),
  exp_year: term(),
  fingerprint: term(),
  id: term(),
  inserted_at: term(),
  is_default: term(),
  last_stripe_event_id: term(),
  last_stripe_event_ts: term(),
  lock_version: term(),
  metadata: term(),
  processor: term(),
  processor_id: term(),
  type: term(),
  updated_at: term()
}

Functions

changeset(payment_method_or_changeset, attrs \\ %{})

@spec changeset(
  %Accrue.Billing.PaymentMethod{
    __meta__: term(),
    card_brand: term(),
    card_exp_month: term(),
    card_exp_year: term(),
    card_last4: term(),
    customer: term(),
    customer_id: term(),
    data: term(),
    existing?: term(),
    exp_month: term(),
    exp_year: term(),
    fingerprint: term(),
    id: term(),
    inserted_at: term(),
    is_default: term(),
    last_stripe_event_id: term(),
    last_stripe_event_ts: term(),
    lock_version: term(),
    metadata: term(),
    processor: term(),
    processor_id: term(),
    type: term(),
    updated_at: term()
  }
  | Ecto.Changeset.t(),
  map()
) :: Ecto.Changeset.t()

Builds a changeset for creating or updating a PaymentMethod.