Validates a batch of payment rows destined for POST /payments/bulks
and renders them into the CSV format that endpoint expects.
Each row is validated with BankingCircle.Schemas.Payment.changeset/1.
Per Banking Circle's documented bulk error shape, a failing row is
reported by its 1-based elementIndex, which skips blank lines —
build/1 preserves row ordering (including any caller-supplied blank
separators) so that index maps back correctly if the API rejects part of
a batch.
Summary
Functions
Validates every row and, if all are valid, returns {:ok, csv_binary}.
Functions
@spec build([map()]) :: {:ok, binary()} | {:error, [{pos_integer(), Ecto.Changeset.t()}]}
Validates every row and, if all are valid, returns {:ok, csv_binary}.
If any row fails validation, returns {:error, [{index, changeset}, ...]}
with 1-based indices matching Banking Circle's elementIndex semantics,
so client-side and server-side validation errors are reportable the same
way.