Accrue.Billing.Refund (accrue v0.3.1)

Copy Markdown View Source

Ecto schema for the accrue_refunds table (D3-45).

Models a Stripe refund with first-class fee reconciliation:

  • stripe_fee_refunded_amount_minor — portion of the original Stripe fee that Stripe returned to the merchant on refund
  • merchant_loss_amount_minor — non-recoverable fee the merchant eats
  • fees_settled_at — wall-clock when the fee pull-forward completes

See Accrue.Billing.Refund.fees_settled?/1.

Summary

Functions

Builds a changeset for creating or updating a Refund.

True if the fee reconciliation has completed.

Canonical list of refund statuses.

Types

t()

@type t() :: %Accrue.Billing.Refund{
  __meta__: term(),
  amount_minor: term(),
  charge: term(),
  charge_id: term(),
  currency: 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(),
  merchant_loss_amount_minor: term(),
  metadata: term(),
  reason: term(),
  status: term(),
  stripe_fee_refunded_amount_minor: term(),
  stripe_id: term(),
  updated_at: term()
}

Functions

changeset(refund_or_changeset, attrs \\ %{})

@spec changeset(
  %Accrue.Billing.Refund{
    __meta__: term(),
    amount_minor: term(),
    charge: term(),
    charge_id: term(),
    currency: 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(),
    merchant_loss_amount_minor: term(),
    metadata: term(),
    reason: term(),
    status: term(),
    stripe_fee_refunded_amount_minor: term(),
    stripe_id: term(),
    updated_at: term()
  }
  | Ecto.Changeset.t(),
  map()
) :: Ecto.Changeset.t()

Builds a changeset for creating or updating a Refund.

fees_settled?(arg1)

@spec fees_settled?(
  %Accrue.Billing.Refund{
    __meta__: term(),
    amount_minor: term(),
    charge: term(),
    charge_id: term(),
    currency: 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(),
    merchant_loss_amount_minor: term(),
    metadata: term(),
    reason: term(),
    status: term(),
    stripe_fee_refunded_amount_minor: term(),
    stripe_id: term(),
    updated_at: term()
  }
  | map()
) :: boolean()

True if the fee reconciliation has completed.

statuses()

@spec statuses() :: [atom()]

Canonical list of refund statuses.