Skip to main content
Version: Next

Domain Events

Lana Bank publishes domain events via the transactional outbox pattern. These events can be consumed by external systems for integration, analytics, and audit purposes.

All events are serialized as JSON and include metadata for tracing and ordering.


Event Structure

Each event is wrapped in an envelope with the following structure:

{
"id": "uuid",
"event_type": "core.credit.facility-activated",
"payload": { ... },
"recorded_at": "2024-01-15T10:30:00Z",
"trace_id": "trace-uuid"
}

Access Events

Events related to user and role management.

EventDescriptionPayload Fields
UserCreatedA new user was createdentity.email, entity.id, entity.role_id
RoleCreatedA new role was createdentity.id, entity.name

Accounting Events

Events related to chart of accounts and accounting operations.

EventDescriptionPayload Fields
LedgerAccountCsvExportUploadedA ledger account CSV export was uploadedid, ledger_account_id
ChartNodeCreatedA chart of accounts node was createdentity.account_set_id, entity.chart_id, entity.code, entity.id, entity.name

Credit Events

Events related to credit facility lifecycle and operations.

EventDescriptionPayload Fields
FacilityProposalCreatedA credit facility proposal was createdentity.amount, entity.created_at, entity.customer_id, entity.id, entity.status, entity.terms
FacilityProposalConcludedA credit facility proposal was concludedentity.amount, entity.created_at, entity.customer_id, entity.id, entity.status, entity.terms
PendingCreditFacilityCollateralizationChangedCollateralization state changed for pending facilityentity.amount, entity.collateralization, entity.completed_at, entity.created_at, entity.credit_facility_proposal_id, entity.customer_id, entity.id, entity.status, entity.terms
PendingCreditFacilityCompletedA pending credit facility was completedentity.amount, entity.collateralization, entity.completed_at, entity.created_at, entity.credit_facility_proposal_id, entity.customer_id, entity.id, entity.status, entity.terms
FacilityActivatedA credit facility was activatedentity.account_ids, entity.accrual_spec, entity.activated_at, entity.activation_tx_id, entity.amount, entity.collateral_id, entity.collateralization, entity.completed_at, entity.customer_id, entity.id, entity.liquidation_trigger, entity.pending_credit_facility_id, entity.terms
FacilityCompletedA credit facility was fully repaid and closedentity.account_ids, entity.accrual_spec, entity.activated_at, entity.activation_tx_id, entity.amount, entity.collateral_id, entity.collateralization, entity.completed_at, entity.customer_id, entity.id, entity.liquidation_trigger, entity.pending_credit_facility_id, entity.terms
FacilityCollateralizationChangedCollateralization state changed for active facilityentity.account_ids, entity.accrual_spec, entity.activated_at, entity.activation_tx_id, entity.amount, entity.collateral_id, entity.collateralization, entity.completed_at, entity.customer_id, entity.id, entity.liquidation_trigger, entity.pending_credit_facility_id, entity.terms
DisbursalInitializedA disbursal was initiated and is pending approvalentity.amount, entity.approved, entity.cancelled, entity.credit_facility_id, entity.due_date, entity.id, entity.obligation_id, entity.settlement, entity.status
DisbursalApprovalConcludedA disbursal approval process was concludedentity.amount, entity.approved, entity.cancelled, entity.credit_facility_id, entity.due_date, entity.id, entity.obligation_id, entity.settlement, entity.status
DisbursalSettledA disbursal was settledentity.amount, entity.approved, entity.cancelled, entity.credit_facility_id, entity.due_date, entity.id, entity.obligation_id, entity.settlement, entity.status
DisbursalCancelledA disbursal was cancelledentity.amount, entity.approved, entity.cancelled, entity.credit_facility_id, entity.due_date, entity.id, entity.obligation_id, entity.settlement, entity.status
AccrualPostedInterest accrual was postedentity.credit_facility_id, entity.due_at, entity.id, entity.period, entity.posting
FacilityMaturedNo description availableentity.account_ids, entity.accrual_spec, entity.activated_at, entity.activation_tx_id, entity.amount, entity.collateral_id, entity.collateralization, entity.completed_at, entity.customer_id, entity.id, entity.liquidation_trigger, entity.pending_credit_facility_id, entity.terms
PartialLiquidationInitiatedA partial liquidation was initiatedentity.account_ids, entity.accrual_spec, entity.activated_at, entity.activation_tx_id, entity.amount, entity.collateral_id, entity.collateralization, entity.completed_at, entity.customer_id, entity.id, entity.liquidation_trigger, entity.pending_credit_facility_id, entity.terms

CreditCollateral Events

Events related to credit facility collateral management and liquidation.

EventDescriptionPayload Fields
CollateralUpdatedCollateral amount was updatedentity.adjustment, entity.amount, entity.id, entity.secured_loan_id
LiquidationCollateralSentOutCollateral was sent for liquidationamount, effective, ledger_tx_id, liquidation_id, recorded_at, secured_loan_id
LiquidationProceedsReceivedLiquidation proceeds were receivedamount, collateral_id, effective, ledger_tx_id, liquidation_id, payment_id, recorded_at, secured_loan_id
LiquidationCompletedLiquidation was completedliquidation_id, secured_loan_id

CreditCollection Events

Events related to credit facility obligations and payment collection.

EventDescriptionPayload Fields
PaymentCreatedA payment was createdentity.amount, entity.beneficiary_id, entity.effective, entity.id, entity.recorded_at
PaymentAllocationCreatedA payment allocation was createdentity.amount, entity.beneficiary_id, entity.effective, entity.id, entity.obligation_id, entity.obligation_type, entity.payment_id, entity.recorded_at
ObligationCreatedA new obligation was createdentity.beneficiary_id, entity.defaulted_at, entity.due_at, entity.effective, entity.id, entity.initial_amount, entity.obligation_type, entity.outstanding_amount, entity.overdue_at, entity.recorded_at
ObligationDueAn obligation became dueentity.beneficiary_id, entity.defaulted_at, entity.due_at, entity.effective, entity.id, entity.initial_amount, entity.obligation_type, entity.outstanding_amount, entity.overdue_at, entity.recorded_at
ObligationOverdueAn obligation became overdueentity.beneficiary_id, entity.defaulted_at, entity.due_at, entity.effective, entity.id, entity.initial_amount, entity.obligation_type, entity.outstanding_amount, entity.overdue_at, entity.recorded_at
ObligationDefaultedAn obligation defaultedentity.beneficiary_id, entity.defaulted_at, entity.due_at, entity.effective, entity.id, entity.initial_amount, entity.obligation_type, entity.outstanding_amount, entity.overdue_at, entity.recorded_at
ObligationCompletedAn obligation was fully paidentity.beneficiary_id, entity.defaulted_at, entity.due_at, entity.effective, entity.id, entity.initial_amount, entity.obligation_type, entity.outstanding_amount, entity.overdue_at, entity.recorded_at

Custody Events

Events related to Bitcoin custody and wallet management.

EventDescriptionPayload Fields
WalletBalanceUpdatedNo description availableentity.address, entity.balance, entity.id, entity.network

Customer Events

Events related to customer lifecycle and KYC.

EventDescriptionPayload Fields
CustomerCreatedA new customer was createdentity.id, entity.party_id, entity.status
CustomerFrozenA customer account was frozen, blocking financial operationsentity.id, entity.party_id, entity.status
CustomerUnfrozenA previously frozen customer account was unfrozen, restoring normal operationsentity.id, entity.party_id, entity.status
CustomerClosedCustomer account was closedentity.id, entity.party_id, entity.status
PartyCreatedNo description availableentity.customer_type, entity.email, entity.id
PartyEmailUpdatedNo description availableentity.customer_type, entity.email, entity.id
ProspectCreatedA new prospect was created for onboardingentity.id, entity.kyc_status, entity.party_id, entity.stage
ProspectKycStartedA prospect started KYC verificationentity.id, entity.kyc_status, entity.party_id, entity.stage
ProspectKycPendingA prospect's KYC verification is pending reviewentity.id, entity.kyc_status, entity.party_id, entity.stage
ProspectKycDeclinedA prospect's KYC verification was declinedentity.id, entity.kyc_status, entity.party_id, entity.stage
ProspectConvertedA prospect was converted to a customerentity.id, entity.kyc_status, entity.party_id, entity.stage
ProspectClosedA prospect was closed without convertingentity.id, entity.kyc_status, entity.party_id, entity.stage

Deposit Events

Events related to deposit accounts and transactions.

EventDescriptionPayload Fields
DepositAccountCreatedA deposit account was createdentity.account_holder_id, entity.currency, entity.id
DepositInitializedA deposit was initializedentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status
DepositRevertedA deposit was revertedentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status
WithdrawalInitializedA withdrawal was initiated and is pending approvalentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status
WithdrawalApprovalConcludedA withdrawal approval process was concludedentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status
WithdrawalDeniedA withdrawal was deniedentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status
WithdrawalConfirmedA withdrawal was confirmedentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status
WithdrawalCancelledA withdrawal was cancelledentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status
WithdrawalRevertedA confirmed withdrawal was revertedentity.amount, entity.deposit_account_id, entity.id, entity.reference, entity.status

Price Events

Events related to BTC/USD price updates.

EventDescriptionPayload Fields
PriceUpdatedBTC/USD price was updatedprice, timestamp
ProviderPriceFetchedNo description availableprice, provider_id, timestamp

Report Events

Events related to report generation.

EventDescriptionPayload Fields
ReportRunCreatedA report run was initiatedentity
ReportRunStateUpdatedA report run state changedentity

Governance Events

Events related to approval workflows.

EventDescriptionPayload Fields
ApprovalProcessConcludedAn approval process was concludedentity.id, entity.process_type, entity.status, entity.target_ref

Time Events

Events related to end-of-day processing.

EventDescriptionPayload Fields
EndOfDayEnd of day was reached for the configured timezoneclosing_time, day, timezone

Event Types Reference

All event types follow the naming convention: core.<module>.<event-name>

ModuleEvent Type Prefix
Accesscore.access.*
Accountingcore.accounting.*
Creditcore.credit.*
CreditCollateralcore.credit-collateral.*
CreditCollectioncore.credit-collection.*
Custodycore.custody.*
Customercore.customer.*
Depositcore.deposit.*
Pricecore.price.*
Reportcore.report.*
Governancegovernance.*
Timecore.time.*

Consuming Events

Events are published via the transactional outbox and can be consumed through:

  1. Direct database polling - Query the outbox table
  2. Event streaming - Integration with message queues (implementation dependent)
  3. ETL pipelines - Via Meltano extraction

For integration details, contact the platform team.