Validates and casts a single-payment request before it's sent to
POST /payments/singles, using an Ecto embedded schema purely as a
typed-casting + changeset-validation tool (no database involved).
Catching malformed requests client-side — wrong currency format, missing beneficiary details, negative amounts — avoids a round trip for errors that are knowable before the request ever leaves the BEAM.
Summary
Functions
Validates and returns {:ok, payload_map} ready for JSON encoding, or
{:error, %Ecto.Changeset{}} with field-level errors.
Builds a changeset from a map of attributes (string or atom keys).
Functions
@spec build(map()) :: {:ok, map()} | {:error, Ecto.Changeset.t()}
Validates and returns {:ok, payload_map} ready for JSON encoding, or
{:error, %Ecto.Changeset{}} with field-level errors.
@spec changeset(map()) :: Ecto.Changeset.t()
Builds a changeset from a map of attributes (string or atom keys).
Examples
iex> BankingCircle.Schemas.Payment.changeset(%{
...> debtor_account_id: "acc_123",
...> amount: Decimal.new("100.50"),
...> currency: "EUR",
...> creditor_name: "Jane Doe",
...> creditor_iban: "DE89370400440532013000",
...> transaction_reference: "INV-2026-001"
...> }).valid?
true