Call For Rent (CFR) Process Documentation
Context
The Call For Rent (CFR) process is a core business flow used to charge tenants for their rent. This is achieved by generating a hierarchy of accounting events.
There are two types of parent events:
INITIAL_RENTβ when it's the first rent call.RECURRING_RENTβ for subsequent periods.
These parent events wrap a set of child accounting events:
| Parent Event | Child Events |
|---|---|
| INITIAL_RENT | CALL_FOR_RENT, CALL_FOR_RENTAL_CHARGES, CFR_CHARGES_HOUSEHOLD_WASTE, CALL_FOR_DEPOSIT |
| RECURRING_RENT | CALL_FOR_RENT, CALL_FOR_RENTAL_CHARGES, CFR_CHARGES_HOUSEHOLD_WASTE |
Project Structure
Components:
- adb-contracts: A BE service that exposes
/proposeand/processendpoints, reads and updates contract data, and coordinates with accounting. - adb-accounting: A BE service that handles accounting logic and data. It generates accounting events and corresponding entries.
- MongoDB: Each service has its own MongoDB instance. For
adb-contracts, it stores real and temporary contract data. Foradb-accounting, it stores event and entry records. - MongoDB Triggers: Similar to SQL triggers, they react to insert/update/delete events on collections and can emit messages externally (in our case, to AWS).
- AWS EventBridge: An event bus that routes triggered messages to specific SQS queues.
- AWS SQS Queues: Queues that ensure reliable, asynchronous delivery of messages between services.
- WebSocket (WS): Used by
adb-contractsto push real-time propose results back to the frontend UI.
Architecture Overview

CFR Process Flows
A. User-Initiated Flows
A1. Propose Flow
The Propose Flow is the first step in the Call For Rent process. It allows users to preview the generation of accounting events for eligible contracts without making any real changes. This flow simulates the process and returns event data in real time.
- User clicks "Generate Call for Rent".
- Frontend sends a
POST /contracts/accounting/rent/periods/{period}/proposerequest toadb-contracts. adb-contractsfilters eligible contracts and saves them to the temporarypropose_contractscollection.- For each contract, it calls
adb-accountingto simulate the generation of events. - Event data is returned (not persisted).
- Final result is sent back to the user in real time via WebSocket.

A2. Process Flow
The Process Flow is the second step in the Call For Rent process. It finalizes the proposed contracts and updates their statuses in the database, triggering downstream event generation.
- After previewing results, the user selects the contracts to finalize.
- A
POST /contracts/accounting/rent/periods/{period}/processrequest is sent. - The
adb-contractsservice updates the real contract with aPROCESSINGstatus. - This change activates the downstream event generation flow.

B. DB-Initiated Flows
Triggered automatically after a contract is marked as PROCESSING.
- MongoDB
contract-modifiedtrigger detects the change. - Event is sent to
contracts-contract-modifiedSQS queue. adb-accountinglistens and generates real accounting events and entries.- Events and entries are saved in the
adb-accountingMongoDB collections. adb-contractsis notified viaaccounting-contract-modifiedqueue to update the contract'snextCallForRentPeriod.adb-contractsupdates the contract with the newcallForRentPeriodsandnextCallForRentPeriod.- The user can then view the updated contract with the new rent periods.
- The process is complete, and the contract is ready for further actions.
B1. Contract Modified β Generate Events

B2. Accounting Events Saved β Contract Final Update

Trigger & Queue Event Map

Post-CFR Actions
Once the Call For Rent (CFR) process is finalized and accounting events are created, both adb-accounting and adb-contracts perform additional actions to complete downstream workflows. These actions are automated and triggered by event-driven mechanisms.
On the adb-accounting Side
When a CALL_FOR_RENT event is stored in the accounting_events collection, the MongoDB accounting-event-modified trigger fires and emits a message to the accounting-accounting-event-modified SQS queue.
adb-accounting listens to this queue and processes the following logic:
Invoice for Management Fees
- A new invoice is generated for the owner to reflect management fees charged by the platform.
Invoice for GLI Insurance (if applicable)
- If the rental contract includes GLI insurance, an additional invoice is generated.
- This invoice records the insurance-related charge.
These invoices are persisted and can be reviewed under the accounting records of the respective contract and organization.
On the adb-contracts Side
After the CFR period is marked as processed for a contract, adb-contracts automatically generates relevant tenant-facing files.
File 1: Individual Call For Rent Report (PDF)
- A PDF file is generated summarizing the rent call for the tenant.
- This file is sent to the
adb-filesservice.adb-filesstores file metadata in its database.- The actual PDF is uploaded to AWS S3.
- Once processed, the file becomes visible:
- On the documents tab of the rental contract.
- On the tenant's personal page.
This file serves as the tenantβs official notice that rent has been generated and is due.
File 2: Rent Review Notification (Conditional)
- If a rent amount review took place in the called period:
- A second notification PDF is generated to inform the tenant of the reviewed rent amount.
- This file follows the same flow through
adb-filesand appears alongside the first document.
These files ensure the tenant is clearly informed and all compliance requirements are met.
Summary
- CFR is a multi-stage process:
/proposeβ previews rent generation and events, without real data changes./processβ finalizes and saves changes using Mongo triggers + SQS.
- Each service owns its data and reacts via event-driven architecture.
- Diagrams break down the logic across UI, services, data, and events.
Related Endpoints
POST /contracts/accounting/rent/periods/{period}/proposePOST /contracts/accounting/rent/periods/{period}/processPOST /accounting/events/proposePOST /files- Triggers:
contract-modifiedaccounting-event-modifiedaccounting-entry-modified