> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Inbound messaging from BACEN

> How Lerian SPB consumes the inbound STR settlement replies (R-legs) and the GEN-family notices that arrive from BACEN over the RSFN.

Lerian SPB consumes the inbound STR settlement replies (R-legs) and the GEN-family notices. Both arrive from BACEN over the RSFN. A submitted operation stays open until its R-leg arrives. The R-leg then moves the operation to `CONFIRMED` or `REJECTED`. Lerian SPB projects BACEN's settlement fields verbatim.

When Lerian SPB records a third-party electronic-money advice, it emits `str.emoney.transferAdvised`. Its `data` object always includes `messageCode`, `numCtrlSTR`, `dtHrBC`, `vlrLanc`, and `dtMovto`. Depending on the advice leg, it can also include `debitedIspb`, `creditedIspb`, `numCtrlSTROr`, `hist`, `ispbIFCredtd`, `agCredtd`, and `ctCredtd`. The event does not expose `CNPJCliCredtd`. Deduplicate this event by `(eventType, data.numCtrlSTR)`, not by `ce-id`: a retry can produce a fresh `ce-id`, while the same control number identifies the same movement.
