PostingRule (v1.0.0)
Defines the rules for posting transactions to specific accounts with appropriate signs (debit/credit)
PostingRule Entity
The PostingRule entity defines the specific rules for how financial transactions are posted to accounts within the double-entry bookkeeping system. Each posting rule specifies which account should be affected and whether the posting should be a debit (positive) or credit (negative) entry.
Properties
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | Required | Unique identifier for the posting rule (auto-generated primary key) |
sign | string | Optional | Indicates whether the posting is POSITIVE (debit) or NEGATIVE (credit) |
account_definition_fk | integer | Optional | Foreign key reference to the target account definition |
transaction_definition_fk | integer | Optional | Foreign key reference to the parent transaction definition |
Schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "title": "PostingRule", "description": "Defines the rules for posting transactions to specific accounts with appropriate signs (debit/credit)", "properties": { "id": { "type": "integer", "description": "Unique identifier for the posting rule (auto-generated primary key)", "example": 15827 }, "sign": { "type": "string", "enum": ["POSITIVE", "NEGATIVE"], "description": "Indicates whether the posting is POSITIVE (debit) or NEGATIVE (credit)", "example": "NEGATIVE" }, "account_definition_fk": { "type": "integer", "description": "Foreign key reference to the target account definition", "example": 15652 }, "transaction_definition_fk": { "type": "integer", "description": "Foreign key reference to the parent transaction definition", "example": 15825 } }, "required": ["id"], "additionalProperties": false}Double-Entry Bookkeeping
PostingRules enforce the fundamental principle of double-entry bookkeeping where:
- Every transaction affects at least two accounts
- Total debits must equal total credits
- Account balances are maintained accurately through proper sign application
Sign Convention
The sign attribute determines the impact on account balances:
- POSITIVE: Increases asset and expense accounts, decreases liability, equity, and revenue accounts
- NEGATIVE: Decreases asset and expense accounts, increases liability, equity, and revenue accounts
Account Type Interactions
Different account types respond differently to positive and negative postings:
Asset Accounts (1xxx)
- Positive postings increase the asset value
- Negative postings decrease the asset value
Liability Accounts (2xxx)
- Positive postings decrease the liability (payment toward debt)
- Negative postings increase the liability (new debt)
Revenue Accounts (4xxx)
- Positive postings decrease revenue (reversals)
- Negative postings increase revenue (new income)
Expense Accounts (5xxx)
- Positive postings increase expenses
- Negative postings decrease expenses (reversals)
Usage in Transaction Processing
When a transaction is processed:
- The system retrieves all posting rules for the transaction type
- For each rule, it applies the specified amount with the appropriate sign
- The posting is made to the target account specified in the rule
- Balance validation ensures the transaction maintains accounting equation balance
Business Examples
Charge Transaction
- Rule 1: Post NEGATIVE to MerchantDebt (increases liability)
- Rule 2: Post POSITIVE to PSPReceivable (increases asset)
Refund Transaction
- Rule 1: Post POSITIVE to MerchantDebt (decreases liability)
- Rule 2: Post NEGATIVE to PSPReceivable (decreases asset)
Validation Rules
- Each posting rule must reference a valid account definition
- Sign must be either POSITIVE or NEGATIVE
- Rules must be associated with a valid transaction definition
- Account types must be compatible with the intended posting direction