LatticeStripe.BankAccount (LatticeStripe v1.1.0)

Copy Markdown View Source

A Stripe bank account attached to a Connect connected account (external account).

Bank accounts are one of the two sum-type members returned by LatticeStripe.ExternalAccount CRUDL operations; the other is LatticeStripe.Card. All network operations live on LatticeStripe.ExternalAccount — this module owns only the struct shape, the map-to-struct cast/1 / from_map/1 helpers, and a PII-safe Inspect implementation.

PII and Inspect

inspect/1 shows only id, object, bank_name, country, currency, and status. The following fields are deliberately hidden because they are sensitive banking information that must never appear in logs or error reports: routing_number, fingerprint, last4, account_holder_name, account_holder_type.

The struct intentionally does NOT define an :account_number field — Stripe strips the raw number after tokenization, and if a future API version ever returned it, it would flow into :extra (never into Inspect output). Never add :account_number to defstruct.

F-001 forward-compat

Unknown keys from Stripe are preserved in the :extra map so new fields added by Stripe flow through without code changes. The "deleted" => true flag from a DELETE response is preserved in :extra.

Stripe API Reference

Summary

Types

t()

A Stripe bank account on a Connect connected account.

Functions

Converts a decoded Stripe API map to a %BankAccount{} struct.

Alias for cast/1. Provided for callers that prefer the from_map naming.

Types

t()

@type t() :: %LatticeStripe.BankAccount{
  account: String.t() | nil,
  account_holder_name: String.t() | nil,
  account_holder_type: String.t() | nil,
  account_type: String.t() | nil,
  available_payout_methods: [String.t()] | nil,
  bank_name: String.t() | nil,
  country: String.t() | nil,
  currency: String.t() | nil,
  customer: String.t() | nil,
  default_for_currency: boolean() | nil,
  extra: map(),
  fingerprint: String.t() | nil,
  id: String.t() | nil,
  last4: String.t() | nil,
  metadata: map() | nil,
  object: String.t(),
  routing_number: String.t() | nil,
  status: String.t() | nil
}

A Stripe bank account on a Connect connected account.

Functions

cast(map)

@spec cast(map() | nil) :: t() | nil

Converts a decoded Stripe API map to a %BankAccount{} struct.

Maps all known Stripe bank account fields. Any unrecognized fields are collected into :extra so no data is silently lost (F-001).

from_map(map)

@spec from_map(map() | nil) :: t() | nil

Alias for cast/1. Provided for callers that prefer the from_map naming.