Credential setup
A tenant transacts only after it registers two credentials through the gateway’s control plane:
- an ICP-Brasil A1 client certificate — a PEM certificate and key.
- an OAuth2 client-credentials secret.
Margin fetch
When the credit engine needs a worker’s payroll margin, it issues a margin-request command. The gateway queries Dataprev for the worker’s available margin and disposable remuneration. It then emits a fact that carries the margin, keyed to the originating request.
Averbação
To register a signed contract, the credit engine issues an averbação-request command. The gateway registers the contract with Dataprev and emits one of two facts:
- an averbação-confirmed fact that carries the rail’s own success code. The gateway relays this code and never hardcodes it.
- an averbação-rejected fact that carries the rail’s error code and message.
Loan auction (leilão)
Each worker loan request (solicitação) opens a 24-hour auction. A discovery poller lists these requests page by page. The discovery flow does not submit proposals. It has no authorized producer for the mandatory proposal terms, so no bid can be selected or reach the rail.
Reconciliation
On a configurable cadence, a reconciliation poller sweeps a sliding window of payroll competências. For each competência, it reads two always-on sources. The first source holds the per-contract escrituração records. The second source holds the CEF D+2 repasse records that settle paid installments. The poller normalizes both sources and emits one reconciliation fact per record. The two legs are independent. A failure on one leg never blocks the other.

