# `BankingCircle.Schemas.BulkPayment`
[🔗](https://github.com/iamkanishka/banking_circle/blob/main/lib/banking_circle/schemas/bulk_payment.ex#L1)

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.

# `build`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
