Skip to main content

Version Docs Updated

Purpose

This page describes the workflow states, transition rules, and security barriers a Payout request passes through from creation to finalization.

πŸ”„ Payout Lifecycle

MHM Rentiva uses a strict Approval State Machine to manage Payout processes. Each transition is subject to both the system's risk score and human intervention (Maker-Checker).


πŸ—οΈ States​

Every Payout request in the system exists in one of the following states:

StateCodeDescription
PendingpendingRequest just created, awaiting risk analysis.
Under Reviewunder_reviewManual review stage for medium-risk requests.
Approved Stage 1approved_stage_1First-level approval obtained (review complete).
Approved Stage 2approved_stage_2Final approval (Finalize) stage.
Time Lockedtime_lockedApproved but waiting within the "Cooling Period".
ExecutedexecutedPayout successfully completed (Ledger closed).
RejectedrejectedRequest rejected, balance returned to the vendor.

🌳 State Transition Diagram​


πŸ›‘οΈ Transition Rules​

1. Maker-Checker Segregation​

The person who approves a Payout (Checker) cannot be the same person who initiated or prepared it (Maker). This rule is enforced at the code level (ApprovalStateMachine::validate_transition) to prevent internal misconduct.

2. Fast-Track​

Requests with a LOW risk score can move directly from Pending to Approved Stage 2, bypassing Under Review. This is a convenience applied to trusted vendors to reduce operational overhead.

3. Atomic Updates​

State transitions are executed atomically in the database. The UPDATE ... WHERE current_state = old_state query prevents two administrators from acting on the same Payout request simultaneously (Race Condition).


⏳ Time-Lock and Finalization​

When Approved Stage 2 is granted, the balance is atomically deducted from the Ledger as payout_debit, but the physical payment is not sent yet. The funds wait in Time Locked status. When the lock period expires, the system automatically moves the Payout to Executed.

Section Summary​

  • State transitions are constrained by a strict matrix; arbitrary transitions are not possible.
  • Maker-Checker is the system's fundamental security pillar.
  • Time-Lock provides a "Rollback" opportunity for erroneous transactions.

Changelog​

DateVersionNote
23.04.20264.27.2English translation added.
19.03.20264.21.2Page updated with ApprovalStateMachine state matrix and Time-Lock logic.