Parameter building and validation helpers.
Provides a lightweight, chainable API for constructing validated request parameter maps before sending them to Column resource modules.
Example
import Column.Params
params =
new()
|> put_required(:bank_account_id, "bacc_123")
|> put_required(:counterparty_id, "cpty_456")
|> put_required(:amount, 10_000)
|> put_required(:currency_code, "USD")
|> put_required(:type, "CREDIT")
|> put_optional(:entry_class_code, "PPD")
|> put_optional(:effective_date, nil) # nil values are omitted
|> validate_amount(:amount)
|> build!()
Column.ACH.create(params)
Summary
Functions
Build the params map, returning {:ok, map()} or {:error, Column.Error.t()}.
Build the params map, raising Column.Error if there are validation errors.
Merge a map of optional fields, omitting nil values.
Start a new params builder.
Add an optional field. Nil values are silently omitted.
Add a required field. Adds a validation error if value is nil or empty string.
Add a field only when the condition is true.
Validate that an amount field is a positive integer (cents).
Validate that a currency_code field is a 3-letter ISO 4217 code.
Validate that a field matches one of the allowed values.
Types
Functions
@spec build(t()) :: {:ok, map()} | {:error, Column.Error.t()}
Build the params map, returning {:ok, map()} or {:error, Column.Error.t()}.
Build the params map, raising Column.Error if there are validation errors.
Returns the raw map() suitable for passing to Column resource functions.
Merge a map of optional fields, omitting nil values.
@spec new() :: %{params: %{}, errors: []}
Start a new params builder.
Add an optional field. Nil values are silently omitted.
Add a required field. Adds a validation error if value is nil or empty string.
Add a field only when the condition is true.
Validate that an amount field is a positive integer (cents).
Validate that a currency_code field is a 3-letter ISO 4217 code.
Validate that a field matches one of the allowed values.