Attaches an Idempotency-Key header to a request, either from a caller
supplied value or a generated UUIDv4.
As of this writing, Banking Circle documents idempotency-key support
specifically for Direct Debit Collections endpoints, with a note that
other payment operations are planned to align with the same pattern
later. Attaching the header on unsupported endpoints is harmless (it will
simply be ignored), but callers should not rely on idempotency
protection outside the documented scope — check BankingCircle.Payments
function docs for per-endpoint guidance before assuming a blind retry is
safe.
A replayed key returns HTTP 400 with a body identifying the original
acceptance; BankingCircle.Error.parse/2 normalizes that like any other
error.
Summary
Functions
Generates a UUIDv4 suitable for use as an idempotency key.
Functions
@spec attach(Req.Request.t(), String.t() | nil) :: Req.Request.t()
@spec generate_key() :: String.t()
Generates a UUIDv4 suitable for use as an idempotency key.