Skip to content

Deposit Product Flags

Flag-driven product configuration for the deposit domain.

Overview

Deposit products in Pinkapple use a flag-driven architecture to control account behavior. Instead of hardcoding product variants (e.g. "Senior Citizen FD", "Green FD"), behavior is composed from reusable flags that can be enabled, disabled, or configured per product type and per individual product.

Architecture

Resolution Chain

When the system needs to determine a product's effective configuration, flags are resolved in priority order:

  1. PRODUCT — Per-product overrides (deposit_product_flag_config)
  2. TYPE_DEFAULT — Default values for the product type (deposit_type_default_flag_profile)
  3. LEGACY_PRODUCT — Legacy product_config_flags JSON on deposit_product
  4. LEGACY_TYPE — Legacy custom_flags + product_characteristics JSON on deposit_product_group_type_map
  5. CATALOG_DEFAULT — Master flag definition defaults (deposit_flag_catalog)

Tables

TablePurpose
deposit_flag_catalogMaster flag definitions (code, name, type, defaults, UI metadata)
deposit_flag_value_optionENUM option labels for flags
deposit_type_allowed_flagWhich flags are allowed per product group/type
deposit_type_default_flag_profileDefault flag values per product type
deposit_product_flag_configPer-product flag overrides

Flag Groups

GroupFlagsPurpose
LIMITS9 flagsBalance limits, transaction caps, monthly count limits
ACCESS6 flagsATM, mobile, online, checkbook, debit card, branch
OVERDRAFT4 flagsNegative balance, OD allowed/limit, OD interest
KYC7 flagsKYC level, biometric, residency, employment, age
INTEREST6 flagsInterest bearing, rate type, payout frequency, compounding, WHT
FIXED_DEPOSIT12 flagsTerm, tenure, withdrawal, penalty, rollover, maturity
SAVINGS_PLAN5 flagsGoal-based, installments, missed payments
COMMUNITY3 flagsGroup accounts, pooled funds, rotation schedule
GOVERNANCE2 flagsJoint accounts, signatories
DORMANCY3 flagsDetection, inactivity days, dormancy fees
INTEGRATION5 flagsGL, pricing engine, sweeps, wallet, agent banking
REGULATORY3 flagsTax exemption, green certification, deposit insurance
TRIGGER_EVENTS4 flagsPricing triggers per transaction type, GL callbacks

Product Types (Simplified)

The system ships with 18 core product types across 7 groups:

GroupTypes
FIXED_DEPOSITStandard, Flexible, Periodic Payout, Cumulative
SAVINGS_ACCOUNTBasic, High Yield, Digital, SACCO
SAVINGS_PLANGoal-Based, Recurring, Micro
CURRENT_ACCOUNTPersonal, Business, Salary
STORED_VALUEWallet
FUNDING_ACCOUNTOperational
COMMUNITY_FINANCEVSLA, ROSCA

Variants that previously existed as separate types (e.g. "Senior Citizen FD", "Green FD", "Tax Saver FD") are now created as standard products with flag overrides.

How It Works

Creating a Deposit Product

  1. Select a Product Classification (group/type) from the type catalog
  2. The form automatically loads the type flag profile — which flags are available, which start enabled, and their default values
  3. Override individual flags as needed for this specific product
  4. On submit, both the legacy product fields AND the flag configs are saved

Runtime Resolution

When a procedure needs to check a product's flags (e.g. during account opening, transaction processing, or EOD batch):

sql
CALL resolve_deposit_product_flags(
  @deposit_product_id,
  @effective_flags,    -- OUT: flat JSON object { "flag_code": value }
  @flag_details        -- OUT: detailed array for debugging
);

The procedure builds a temp table tmp_deposit_flag_resolution that can be queried directly for complex flag-dependent logic.

Affects Metadata

Each flag declares which subsystems it affects via affects_* boolean columns:

ColumnSubsystem
affects_account_stateAccount lifecycle / status
affects_workflowApproval or process workflows
affects_transactionsTransaction processing
affects_interestInterest accrual / capitalisation
affects_feesFee calculation / charging
affects_glGL posting engine
affects_pricingPricing engine integration
affects_limitsTransaction / balance limits
affects_maturityFD maturity processing
affects_dormancyDormancy detection
affects_onboardingAccount opening / KYC

API Endpoints

MethodPathDescription
GET/flag-catalogList flag catalog (paginated, filterable by group)
POST/flag-catalogCreate new flags
PUT/flag-catalogUpdate existing flags
DELETE/flag-catalogSoft-delete flags
GET/effective-flagsResolve effective flags for a product

All endpoints are under /api/administration/products/deposit-products/.

Frontend Integration

The DepositProductFlagConfigEditor.vue component is integrated into the deposit product form as a custom section. It:

  1. Watches the selected product taxonomy (group/type)
  2. Loads the type's flag profile (from seeded data or via API)
  3. Renders flags grouped by flag_group with appropriate editors
  4. Shows a Runtime Preview card summarizing enabled features
  5. Syncs flag configs to the form engine for submission

Pricing Engine Integration

Flags in the TRIGGER_EVENTS group control when the pricing engine is invoked:

  • PRICING_TRIGGER_ON_DEPOSIT — Evaluate fees on deposit transactions
  • PRICING_TRIGGER_ON_WITHDRAWAL — Evaluate fees on withdrawal transactions
  • PRICING_TRIGGER_ON_TRANSFER — Evaluate fees on transfer transactions
  • GL_CALLBACK_ON_POST — Enable GL callback dispatch after posting

These flags work with the existing pricing_binding and gl_domain_callback systems.

PinkApple ERP by Stat Solutions Network