Skip to main content
Lender publishes CloudEvents 1.0 in binary content mode through Lerian’s streaming library. Business emission is outbox-only and at least once: the domain write and outbox envelope share one database transaction, and the relay publishes after commit.

Application-stream contract

  • ce-source: lender
  • Facts: lerian.streaming.lender
  • Commands: lerian.streaming.lender.commands
  • Route dead letters: lerian.streaming.lender.dlq
  • ce-type: studio.lerian.lender.<resource>.<event>
  • Dispatch key: <resource>.<event> from ce-resourcetype and ce-eventtype
The topic identifies the producing application and stream class, not one event. Route on CloudEvents headers, not on a per-event topic name. Lender serves the exact catalog and application topics at GET /api/v1/streaming/manifest.

Emitted events

Lender emits 54 events: 53 facts and 1 command. The table separates catalog keys from the CloudEvent routing type.

Emitted payload contracts

The contracts below mirror the CloudEvent data JSON tags in the published Lender contract. ? means the field can be absent. unknown is raw JSON and may carry any JSON value, including null. Decimal values are JSON strings, timestamps are UTC RFC 3339 strings, and YYYYMM is a six-digit competência.
Definition key: accounting_profile.configuredTopic: lerian.streaming.lenderSchema: 1.1.0Subject: profile_id
effective_from is the civil day the chart it describes starts governing. Without it, two events about one product version describe two different charts and nothing on the wire says which one governs a given month.
Definition keys: assignment_set.approved, assignment_set.acceptedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: assignment_set_idA cession composition is durably approved. The event identifies the immutable approval that determines the offer file.
A fund administrator accepts the entire cession. The event reports the set-level money totals after the write-off of the receivables from the tenant portfolio. The risk_retention field names the retention regime the cession was booked under. The retained_fraction field is the share of the expected loss the institution keeps after the sale.
Definition key: assignment_set.cancelledTopic: lerian.streaming.lenderSchema: 1.0.0Subject: assignment_set_idA cession whose approval was announced is called off, and the set stops holding every receivable still in it. A set called off before its approval publishes nothing. reason is abandoned, member_ineligible, counterparty_declined, superseded or operator_removed_all_lines. The event is emitted once. No order is guaranteed against assignment_receivable.cut.
Definition key: assignment_receivable.acceptedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: receivable_refA fund administrator accepts one receivable of a cession, in a partial or a whole acceptance. receivable_ref names the contract as the fund’s registry knows it. offered_receivable_ref is the number the offer file and the return file carry. The two are equal unless the registry renamed the receivable later. The event is emitted once per receivable.
Definition key: assignment_receivable.cutTopic: lerian.streaming.lenderSchema: 1.0.0Subject: receivable_refOne receivable leaves an approved cession and is not ceded in it. exit_source is remessa when the fund refuses the receivable in its return file, and operator when the client operator takes the line out through an exception case. repeated_cut_brake is true when this cut reaches the repeated-cut limit of the fund and opens a case. The brake applies to the pair of fund and receivable: the receivable stays out of offers to that fund until an operator resolves the case, and stays offerable to any other fund. The event is emitted once per receivable. No order is guaranteed against assignment_set.cancelled.
Definition keys: assignment_fund.registered, assignment_fund.updatedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: assignment_fund_idassignment_fund.registered fires when a registration creates the fund. assignment_fund.updated fires when a registration replaces a fund under its fund_tax_id and keeps its assignment_fund_id. Both carry the same payload, so a subscriber that never saw the first can project the fund from the second.
Definition key: loan_application.submittedTopic: lerian.streaming.lenderSchema: 2.0.0Subject: loan_application_id
Definition key: loan_application.approvedTopic: lerian.streaming.lenderSchema: 2.0.0Subject: loan_application_id
Definition key: loan_application.rejectedTopic: lerian.streaming.lenderSchema: 2.0.0Subject: loan_application_id
Definition key: loan_application.withdrawnTopic: lerian.streaming.lenderSchema: 2.0.0Subject: loan_application_id
Definition key: loan_application.disbursedTopic: lerian.streaming.lenderSchema: 2.0.0Subject: loan_application_id
disbursed_by is the operator who released the disbursement. It can differ from assigned_officer_id and is absent when no operator released it.
Definition key: loan_application.b3_registeredTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_application_idA client, as bancarizadora, registered the CCB of a contract at B3 and informed Lender the instrument code (Código IF). Lender commands nothing at any registradora. The event is published once per contract. registration_date and ccb_number are absent when the client did not inform them.
Definition key: loan_charge.appliedTopic: lerian.streaming.lenderSchema: 1.1.0Subject: loan_account_id
billed_installment_number and billed_due_date name the installment the charge is billed on. Both are absent on a charge recorded before charges were billed. They are present from 1.1.0.
Definition key: loan_product.createdTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_product_id
Definition key: loan_product.activatedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_product_id
Definition key: loan_product.current_version_promotedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_product_idThe product is the aggregate after the repoint, so current_version_id is the new pin. Contracts already written keep the version they were born on. Only new applications originate on the promoted one. The promoted_by field holds the authenticated subject verbatim. It is empty when no human asked for the promotion.
Definition key: loan_product.archivedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_product_idThe product is the aggregate after the change, so status is its new status. The archived_by field holds the authenticated subject verbatim. It is empty when no human asked for the change.
Definition key: loan_product.unarchivedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_product_idThe product is the aggregate after the change, so status is its new status. The unarchived_by field holds the authenticated subject verbatim. It is empty when no human asked for the change.
Definition key: loan_product_version.createdTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_product_version_id
min/max rate bands are absent when the version stores none. A version with no band emits neither key rather than a zero-to-zero band, which would read as “only 0% is allowed”. The admitted_borrower_kinds field is always present. An empty array means the version admits no borrower.terms holds the version terms in the shape of the API. refinance, late_payment and payoff_quote_validity_hours are absent when the version does not set them, and so is an unset bound of limits.
Definition key: loan_schedule.prepayment_appliedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: schedule_version_id
Definition key: loan_schedule.rescheduledTopic: lerian.streaming.lenderSchema: 1.0.0Subject: schedule_version_id
financed_tax_amount is the tax the reschedule levied and financed into principal. It is 0.00 when none.
Definition key: repayment.recordedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: transaction_id
Definition keys: returned_payment_receivable.opened, returned_payment_receivable.collected, returned_payment_receivable.written_offTopic: lerian.streaming.lenderSchema: 1.0.0Subject: receivable_idThe three facts project the same aggregate through one shared projection, so two facts about one debt cannot describe it differently. Every field is always present. A field that does not apply yet holds an empty string. It is never absent and never null. Read status to tell the states apart, not the emptiness of a field.The stage and provision_amount fields carry the aging of the debt. The provision_consumed and loss fields split the write-off. The reversal_transaction_id field is unique per receivable and is the anchor that a redelivery of the same reversal resolves to.
Definition key: repayment_reversal.recordedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: transaction_id
Definition key: loan_account.pdd_stage_transitionedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_account_id
Definition key: prepayment_quote.createdTopic: lerian.streaming.lenderSchema: 1.0.0Subject: quote_id
instrument_id, instrument_type and instrument_requested_at are absent when the held cash covers the payoff.
Definition key: prepayment_settlement.recordedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: settlement_id
net_settlement_amount plus held_cash_applied equals final_principal_amount plus accrued_interest plus final_charge_amount plus final_iof_amount plus late_charges plus fees. final_interest_amount is disclosure only (Portaria MTE 435/2025 art. 17): it is forgiven future interest, never accrued and never part of the settlement cash. interest_to_refund is interest receipts paid past the exit of the payoff, owed back to the borrower. held_cash_to_refund is what the payoff left of the held cash.
Definition key: loan_account.payoff_refund_recordedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: refund_idA client paid a borrower, outside Lender, interest or held cash that a payoff owed back, and the refund cleared that much held cash.
Definition key: loan_account.written_offTopic: lerian.streaming.lenderSchema: 1.0.0Subject: write_off_idA direct-credit loan account is written off as a credit loss (Res. CMN 4.966 art. 49). The held cash pays the debt first, the entry clears the book against the withheld income and the provision, and the contract leaves the book.
Definition key: loan_account.credit_loss_recoveredTopic: lerian.streaming.lenderSchema: 1.0.0Subject: recovery_idMoney a written-off borrower pays later settles the old debt. The event splits the amount into what settles the write-off, the new revenue and its tax, the control released and the debt that remains.
Definition key: loan_account.credit_loss_recovery_reversedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: recovery_idAn operator gives a recovery back. The revenue, the tax and the control the recovery booked are reversed, and the debt stays standing.
Definition keys: loan_account.write_off_collection_ended, loan_account.write_off_control_releasedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: write_off_idloan_account.write_off_collection_ended fires when the client operator declares that collection of a written-off loan account ended (Res. CMN 4.966 art. 49 par. 1). loan_account.write_off_control_released fires when the rest of the write-off’s control leaves the books, at the later of 5 years after the write-off and the declared end of collection. control_released is the amount released.
Definition key: loan_account.debt_balance_changedTopic: lerian.streaming.lenderSchema: 2.0.0Subject: loan_account_id
Definition key: loan_account.payment_overdueTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_account_id
Definition key: loan_account.problem_asset_assessedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_account_idLender emits it on both verdicts. A declaration with characterizes_problem_asset set to false is the only way to withdraw an earlier characterization.
Definition key: loan_account.problem_asset_reassessment_overdueTopic: lerian.streaming.lenderSchema: 1.0.0Subject: loan_account_idThis fact is a call to review. It changes nothing on the contract: the stage, the provision, and the income-recognition decision stay as they were. Lender emits it once per contract per business date, and a declaration of either verdict ends it.
Definition key: consignado.exclusao.requestedTopic: lerian.streaming.lender.commandsSchema: 1.0.0Subject: request_ref
Definition key: payroll_deduction.refund_requiredTopic: lerian.streaming.lenderSchema: 1.1.0Subject: receipt_id
amount is this event’s refund: the first refund, or one growth. A growth emits one more event with the same receipt_id. refunded_total holds the refunds of the receipt after this event; on the first event it equals amount. It is absent on 1.0.0 events. A subscriber that deduplicates by receipt_id keys on (receipt_id, refunded_total) instead: a replay repeats the pair, and a growth carries a higher total.
Definition key: payroll_overdeduction.refund_requiredTopic: lerian.streaming.lenderSchema: 1.1.0Subject: refund_case_id
amount is this event’s refund: the opening amount of the case, or one growth. A growth emits one more event with the same refund_case_id. refunded_total holds the amount of the case after this event; on the opening event it equals amount. It is absent on 1.0.0 events. A subscriber that deduplicates by refund_case_id keys on (refund_case_id, refunded_total) instead: a replay repeats the pair, and a growth carries a higher total.
Definition key: collection.instruction.issuedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: instrument_id
Definition key: collection.instruction.withdrawnTopic: lerian.streaming.lenderSchema: 1.0.0Subject: instrument_idLender withdrew a collection instruction that the client’s collection agent holds, because the installment was credited another way, or because the fund early-settlement instruction of a refinanced sold contract was withdrawn. In the second case reason is fund_settlement_withdrawn and competencia is empty. The agent withdraws (baixa) that boleto. Only a channel appointed to handle withdrawal receives the event. It names no amount and no replacement: what the borrower still owes arrives as its own collection.instruction.issued event.
Definition key: collection.payment.appliedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: application_idEvery collection.payment.* event keeps the conservation rule: applied_amount + unapplied_amount + refunded_amount equals received_amount. An absent refunded_amount is zero.
applied_amount is positive, refunded_amount is absent, and applied_transaction_id is set.
Definition key: collection.payment.unappliedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: application_idIt carries the same payload as collection.payment.applied. unapplied_amount is positive, refunded_amount is absent, and repair_reason is set.
Definition key: collection.payment.reappliedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: application_idIt carries the same payload as collection.payment.applied. applied_amount is positive, refunded_amount is absent, and applied_transaction_id is set.
Definition key: collection.payment.refundedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: application_idIt carries the same payload as collection.payment.applied. refunded_amount is positive, unapplied_amount is 0, and refund_request_id and refund_transaction_id are set.
Definition key: collection.payment.routed_to_fundTopic: lerian.streaming.lenderSchema: 1.0.0Subject: application_idIt carries the same payload as collection.payment.applied.
Definition key: collection.payment.routed_to_retainedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: application_idIt carries the same payload as collection.payment.applied.
Definition key: consignado.booking.quarantinedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: contract_idLender quarantined the booking of an averbado contract until an operator clears it. reason is terminal_refusal or attempt_budget_exhausted.
Definition key: guarantee_recovery.cash_allocatedTopic: lerian.streaming.lenderSchema: 1.0.0Subject: receipt_id
refund is the severance cash above the debt, paid back to the worker. amount equals the sum of repayment_applied, prepayment_applied, unapplied and refund.

Cataloged but not emitted

These two definitions are present in the manifest but have no non-test Lender emission caller. Do not treat their lender-sourced forms as operational integrations.

Events consumed

Lender wires gateway fact keys from lerian.streaming.consignado-gw and one Matcher fact from lerian.streaming.matcher. Each consumer is configuration-gated and registered in bootstrap. For a refinancing, Lender books the new contract only when consignado.refinanciamento.efetivado carries novo_contrato. Without that block, Lender quarantines the fact for operational intervention. Lender does not register consignado.proposal.accepted. That key is not a Lender booking input.

Internal event planes

Lender also writes internal outbox event types for ledger intents, collection work, and signed hub handoffs. They are process-local coordination contracts, not entries of the event catalog. This public inventory omits them on purpose.

Delivery and compatibility rules

  • Deduplicate by (ce-source, ce-id) and make handlers idempotent.
  • Read ce-schemaversion before decoding. The version is a CloudEvents header, never a topic suffix.
  • Money and rates are decimal strings. Timestamps are UTC RFC 3339.
  • The wired fact consumers filter exact keys. They skip and commit unmatched facts on the shared application topics. Malformed handled records follow the consumer DLQ policy.
  • A missing required business identifier prevents emission or command execution. Lender never synthesizes it.