Packages
treasury_prime
1.0.0
An unofficial, complete Elixir client for the Treasury Prime banking API (Ledger product) -- accounts, ACH, wires, book transfers, FedNow, cards, KYC/account opening, check deposit, webhooks, sandbox simulations, and more.
Current section
Files
Jump to
Current section
Files
lib/treasury_prime/additional_person_application.ex
defmodule TreasuryPrime.AdditionalPersonApplication do
@moduledoc """
Adds a new owner, signer, or authorized user to an *already open*
account (as opposed to `person_applications` passed at
`TreasuryPrime.AccountApplication.create/3` time, which is for people
added during initial account opening).
## Creating one
{:ok, additional_person_app} =
TreasuryPrime.AdditionalPersonApplication.create(client, %{
person_application_id: "apsn_01d5w7mvmwvy",
role: "owner"
})
"""
use TreasuryPrime.Resource
alias TreasuryPrime.{Client, Error, Page, Resource}
@resource_path "apply/additional_person_application"
@type t :: %__MODULE__{
id: String.t() | nil,
account_id: String.t() | nil,
bankdata: map() | nil,
person_application_id: String.t() | nil,
role: String.t() | nil,
status: String.t() | nil,
userdata: map() | nil,
created_at: String.t() | nil,
updated_at: String.t() | nil
}
defstruct [
:id,
:account_id,
:bankdata,
:person_application_id,
:role,
:status,
:userdata,
:created_at,
:updated_at
]
@fields ~w(id account_id bankdata person_application_id role status userdata created_at updated_at)a
def __fields__, do: @fields
@doc """
Lists additional person applications.
## Filterable params
`account_id`, `role`, `status`.
"""
@spec list(Client.t(), map()) :: {:ok, Page.t()} | {:error, Error.t()}
def list(client, params \\ %{}), do: Resource.list(client, @resource_path, __MODULE__, params)
@spec list!(Client.t(), map()) :: Page.t()
def list!(client, params \\ %{}), do: Resource.list!(client, @resource_path, __MODULE__, params)
@doc "Fetches a single additional person application by id."
@spec get(Client.t(), String.t()) :: {:ok, t()} | {:error, Error.t()}
def get(client, id), do: Resource.get(client, @resource_path, __MODULE__, id)
@spec get!(Client.t(), String.t()) :: t()
def get!(client, id), do: Resource.get!(client, @resource_path, __MODULE__, id)
@doc """
Adds a person (already represented by a `TreasuryPrime.PersonApplication`)
to an existing account. Required: `person_application_id`, `role`
(`"owner"` | `"signer"` | `"authorized_user"`, etc., per your bank
partner's configuration), and an `account_id` to attach to (or the
account is inferred for some flows — check your specific integration).
"""
@spec create(Client.t(), map(), keyword()) :: {:ok, t()} | {:error, Error.t()}
def create(client, params, opts \\ []),
do: Resource.create(client, @resource_path, __MODULE__, params, opts)
@spec create!(Client.t(), map(), keyword()) :: t()
def create!(client, params, opts \\ []),
do: Resource.create!(client, @resource_path, __MODULE__, params, opts)
end