This flow is a suggested interpretation of the Dataprev manuals for Crédito do Trabalhador. The manuals prevail over this page. Your institution validates the flow and implements it on the Lerian APIs. See how to read the diagrams.
Participants
- Your institution. The financial institution that makes the loan.
- Lerian. Lerian Consignado. It exchanges the requests with Dataprev, and exposes the API and the events your institution uses.
- Dataprev. Runs the Crédito do Trabalhador system: the loan auctions and the registry of payroll loans.
Diagram
Steps
The Dataprev Manual 004 gives your institution 7 days after the averbação to send the documentation.
GET /v1/consignado/contracts/{numero_contrato}/averbacao shows documentation_due_at and documentation_overdue.
A contract takes one accepted documentation. Lerian reports the outstanding balance of the contract to Dataprev from the accepted averbação on.
When numero_proposta names a proposal that Lerian holds, the matricula must match the one of that proposal. Otherwise the averbação answers 422 MATRICULA_DIFFERS_FROM_PROPOSAL, and nothing reaches Dataprev.
When Dataprev refuses the averbação with a code that Lerian recognizes, the operation reads rejected, and Lerian publishes consignado.averbacao.rejected. The numero_contrato is then free again. Send the corrected averbação with the same numero_contrato, a new contract_id and a new X-Idempotency key. The refused contract_id stays spent, and a resend under it answers 409 AVERBACAO_CLAIM_CONFLICT. Correlate the events by contract_id, because one numero_contrato can have several attempts.
When Dataprev answers the averbação with any other code, or its answer does not arrive, the operation reads averbacao_unknown. Do not send it again under a new key. Read the averbação, and contact Lerian with the contract number if it stays averbacao_unknown.
Documentation sent before Dataprev accepts the averbação answers 409 AVERBACAO_NOT_ACCEPTED, and nothing reaches Dataprev. If Dataprev refuses the documentation, the answer is 422 with the Dataprev codes in upstream. Send the corrected documentation under a new X-Idempotency key. If the call ends without a verdict, send the same documentation again.
How you know it finished
The documentation answers
confirmed, and Lerian publishes consignado.averbacao.confirmed.

