Ecto schema for accrue_connect_accounts — the local projection of a
Stripe Connected Account (D5-02, CONN-01/03).
Predicates (D3-04, pattern 3)
Never inspect raw booleans on the account struct. Use the predicates
below — each ships 3 clauses (struct match, bare-map match, catch-all)
so they work equally well on %__MODULE__{} rows and on raw atom/string
keyed maps returned from the processor before the changeset settles.
charges_enabled?/1payouts_enabled?/1details_submitted?/1fully_onboarded?/1— all three above must be truedeauthorized?/1— truthydeauthorized_at
Changesets
changeset/2— strict path; validates:typeinclusion and requires[:stripe_account_id, :type].force_status_changeset/2— webhook path (D3-17); bypasses required validation so out-of-orderaccount.updatedreducers can settle arbitrary state without tripping the strict gate.
Summary
Functions
Builds a changeset for creating or updating a connected account.
Validates :type and enforces the unique stripe_account_id constraint.
True if the account can accept charges.
True if the account has been deauthorized (D5-05).
True if the account owner finished the onboarding flow.
Webhook-path changeset (D3-17). Casts only the state fields so
out-of-order account.updated reducers can settle arbitrary state
without failing the user-path required-field guard.
True if the account has charges, payouts, AND onboarding completed — the canonical "ready to do business" predicate.
True if Stripe has approved payouts for the account.
Canonical list of Connect account types (D5-02).
Types
@type t() :: %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() }
Functions
@spec changeset( %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() } | Ecto.Changeset.t(), map() ) :: Ecto.Changeset.t()
Builds a changeset for creating or updating a connected account.
Validates :type and enforces the unique stripe_account_id constraint.
@spec charges_enabled?( %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() } | map() ) :: boolean()
True if the account can accept charges.
@spec deauthorized?( %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() } | map() ) :: boolean()
True if the account has been deauthorized (D5-05).
@spec details_submitted?( %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() } | map() ) :: boolean()
True if the account owner finished the onboarding flow.
@spec force_status_changeset( %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() } | Ecto.Changeset.t(), map() ) :: Ecto.Changeset.t()
Webhook-path changeset (D3-17). Casts only the state fields so
out-of-order account.updated reducers can settle arbitrary state
without failing the user-path required-field guard.
@spec fully_onboarded?( %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() } | map() ) :: boolean()
True if the account has charges, payouts, AND onboarding completed — the canonical "ready to do business" predicate.
@spec payouts_enabled?( %Accrue.Connect.Account{ __meta__: term(), capabilities: term(), charges_enabled: term(), country: term(), data: term(), deauthorized_at: term(), details_submitted: term(), email: term(), id: term(), inserted_at: term(), lock_version: term(), owner_id: term(), owner_type: term(), payouts_enabled: term(), requirements: term(), stripe_account_id: term(), type: term(), updated_at: term() } | map() ) :: boolean()
True if Stripe has approved payouts for the account.
@spec types() :: [String.t()]
Canonical list of Connect account types (D5-02).